rust-lang/rust · #166754

Rollup of 4 pull requests

JonathanBrouwer · merged Nov 29, 202631 files · 747 + / 237 −
compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs5 + / 3 −
@@ -1387,7 +1387,9 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> {                 "param: span {:?}, ty_span {:?}, pat.span {:?}",                 param.span, param.ty_span, param.pat.span             );-            if param.ty_span != param.pat.span {+            // Async lowering such as closure parameters changes the pattern's expansion context,+            // but preserves the original source span for its implicit type, issue #139150+            if param.ty_span.lo_hi() != param.pat.span.lo_hi() {                 debug!("skipping param: has explicit type");                 continue;             }@@ -1396,9 +1398,9 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> {              if self.generic_arg_contains_target(param_ty.into()) {                 self.update_infer_source(InferSource {-                    span: param.pat.span,+                    span: param.ty_span,                     kind: InferSourceKind::ClosureArg {-                        insert_span: param.pat.span.shrink_to_hi(),+                        insert_span: param.ty_span.shrink_to_hi(),                         ty: param_ty,                         kind: param.pat.kind,                     },
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs13 + / 44 −
@@ -1,13 +1,12 @@ use std::fmt;  use rustc_data_structures::intern::Interned;-use rustc_errors::{Applicability, Diag, IntoDiagArg};-use rustc_hir as hir;+use rustc_errors::{Diag, IntoDiagArg}; use rustc_hir::def::{DefKind, Namespace}; use rustc_hir::def_id::{CRATE_DEF_ID, DefId}; use rustc_middle::ty::error::ExpectedFound; use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHighlightMode};-use rustc_middle::ty::{self, GenericArgs, IsSuggestable, RePlaceholder, Region, TyCtxt};+use rustc_middle::ty::{self, GenericArgs, RePlaceholder, Region, TyCtxt}; use rustc_span::{Span, bug}; use rustc_structures::Limit; use tracing::{debug, instrument};@@ -451,48 +450,18 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {             }         } -        // When the mismatched trait is an Fn-trait and the self type is a closure with-        // unannotated parameters, suggest adding explicit type annotations. This turns-        // the confusing lifetime-generality error into an actionable hint, e.g.:-        //   |buf|  →  |buf: &mut [u8]|-        if self.tcx().is_fn_trait(trait_def_id) {-            let actual_self_ty = self.cx.deeply_resolve_ignoring_regions(-                ty::TraitRef::new_from_args(self.cx.tcx, trait_def_id, actual_args).self_ty(),+        // For Fn traits, args[1] is the tupled input types (e.g. `(&mut [u8],)`).+        let mut types = expected_args.types();+        if let _ = types.next()+            && let Some(expected_input_tys) = types.next() // fallible `expected_args.type_at(1)`+            && let ty::Tuple(input_tys) = *expected_input_tys.kind()+        {+            self.cx.check_closure_lifetime_mismatch(+                &mut err,+                trait_def_id,+                &*input_tys,+                actual_args,             );-            if let ty::Closure(closure_def_id, _) = *actual_self_ty.kind()-                && let Some(local_def_id) = closure_def_id.as_local()-                && let hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(closure), .. }) =-                    self.tcx().hir_node_by_def_id(local_def_id)-            {-                let body = self.tcx().hir_body(closure.body);-                // For Fn traits, args[1] is the tupled input types (e.g. `(&mut [u8],)`).-                let expected_input_tys = expected_args.type_at(1);-                if let ty::Tuple(input_tys) = *expected_input_tys.kind() {-                    let suggestions: Vec<_> = body-                        .params-                        .iter()-                        .zip(input_tys.iter())-                        .filter_map(|(param, ty)| {-                            // ty_span == pat.span means no explicit type annotation was written.-                            if param.ty_span == param.pat.span-                                && ty.is_suggestable(self.tcx(), false)-                            {-                                Some((param.pat.span.shrink_to_hi(), format!(": {ty}")))-                            } else {-                                None-                            }-                        })-                        .collect();-                    if !suggestions.is_empty() {-                        let msg = if suggestions.len() == 1 {-                            "consider adding an explicit type annotation to the closure's argument"-                        } else {-                            "consider adding explicit type annotations to the closure's arguments"-                        };-                        err.multipart_suggestion(msg, suggestions, Applicability::MaybeIncorrect);-                    }-                }-            }         }          err
compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs65 + / 2 −
@@ -32,8 +32,8 @@ use rustc_middle::ty::print::{ }; use rustc_middle::ty::transmute::{Answer, Reason}; use rustc_middle::ty::{-    self, ConstKind, GenericArgKind, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeFoldable,-    TypeFolder, TypeSuperFoldable, TypeVisitableExt, Unnormalized, Upcast,+    self, ConstKind, GenericArgKind, GenericParamDefKind, IsSuggestable, TraitRef, Ty, TyCtxt,+    TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt, Unnormalized, Upcast, }; use rustc_span::def_id::CrateNum; use rustc_span::{BytePos, DUMMY_SP, STDLIB_STABLE_CRATES, Span, Symbol, bug, span_bug, sym};@@ -3896,6 +3896,69 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {                 ),                 given_args,             );+            if let ty::Closure(..) = given_ty.kind() {+                err.note("clsoure");+            }+            if let ty::FnPtr(sig, _) = expected_ty.kind() {+                self.check_closure_lifetime_mismatch(+                    err,+                    trait_pred.def_id(),+                    sig.inputs_and_output().skip_binder(),+                    trait_pred.skip_binder().trait_ref.args,+                );+            }+        }+    }++    /// When the mismatched trait is an Fn-trait and the self type is a closure with+    /// unannotated parameters, suggest adding explicit type annotations.+    ///+    /// This turns the confusing lifetime-generality error into an actionable hint, e.g.:+    ///+    /// ```text+    /// |buf|  →  |buf: &mut [u8]|+    /// ```+    pub fn check_closure_lifetime_mismatch(+        &self,+        err: &mut Diag<'_>,+        trait_def_id: DefId,+        expected_input_tys: &[Ty<'tcx>],+        actual_args: ty::GenericArgs<'tcx>,+    ) {+        if !self.tcx.is_fn_trait(trait_def_id) {+            return;+        }+        let actual_self_ty = self.deeply_resolve_ignoring_regions(+            ty::TraitRef::new_from_args(self.tcx, trait_def_id, actual_args).self_ty(),+        );+        let ty::Closure(closure_def_id, _) = *actual_self_ty.kind() else { return };+        let Some(local_def_id) = closure_def_id.as_local() else { return };+        let hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(closure), .. }) =+            self.tcx.hir_node_by_def_id(local_def_id)+        else {+            return;+        };+        let body = self.tcx.hir_body(closure.body);+        let suggestions: Vec<_> = body+            .params+            .iter()+            .zip(expected_input_tys)+            .filter_map(|(param, ty)| {+                // ty_span == pat.span means no explicit type annotation was written.+                if param.ty_span == param.pat.span && ty.is_suggestable(self.tcx, false) {+                    Some((param.pat.span.shrink_to_hi(), format!(": {ty}")))+                } else {+                    None+                }+            })+            .collect();+        if !suggestions.is_empty() {+            let msg = if suggestions.len() == 1 {+                "consider adding an explicit type annotation to the closure's argument"+            } else {+                "consider adding explicit type annotations to the closure's arguments"+            };+            err.multipart_suggestion(msg, suggestions, Applicability::MaybeIncorrect);         }     } 
library/std/src/fs.rs32 + / 0 −
@@ -2167,6 +2167,38 @@ impl OpenOptions {         self     } +    /// Sets the option for *not* following symlinks when opening a file.+    ///+    /// If this option is set, then opening the file will fail if the file is a symlink.+    /// This only affects the last component of the path; directory symlinks earlier in the path+    /// will still behave as usual.+    ///+    /// # Platform-specific behavior+    ///+    /// On supported systems (including Windows and some UNIX-based OSes), this check will happen+    /// atomically as part of filename resolution. Specifically, on UNIX this is implemented via the+    /// `O_NOFOLLOW` flag, and on Windows via the `FILE_FLAG_OPEN_REPARSE_POINT` flag followed by a+    /// symlink check after the file got opened.+    ///+    /// When that is not supported, the check will be done before opening the file. In the latter+    /// case, no [TOCTOU] guarantees are made.+    ///+    /// [TOCTOU]: self#time-of-check-to-time-of-use-toctou+    ///+    /// # Examples+    ///+    /// ```no_run+    /// #![feature(open_options_nofollow)]+    /// use std::fs::OpenOptions;+    ///+    /// let file = OpenOptions::new().read(true).nofollow(true).open("foo.txt");+    /// ```+    #[unstable(feature = "open_options_nofollow", issue = "166352")]+    pub fn nofollow(&mut self, nofollow: bool) -> &mut Self {+        self.0.nofollow(nofollow);+        self+    }+     /// Opens a file at `path` with the options specified by `self`.     ///     /// # Errors
library/std/src/fs/tests.rs45 + / 3 −
@@ -2106,6 +2106,48 @@ fn open_flavors() {     assert_eq!(check!(fs::metadata(&tmpdir.join("h"))).len(), 9); } +#[test]+fn nofollow() {+    let tmpdir = tmpdir();+    if !got_symlink_permission(&tmpdir) {+        return;+    }++    let mut opts = OpenOptions::new();+    opts.read(true).nofollow(true);++    let filename = tmpdir.join("file.txt");+    let linkname = tmpdir.join("link");+    check!(fs::write(&filename, b"hello world"));+    check!(symlink_file(&filename, &linkname));++    // Opening the link fails, but opening the file directly still works.+    let err = opts.open(&linkname).unwrap_err();+    assert_eq!(err.kind(), ErrorKind::FilesystemLoop);+    check!(opts.open(&filename));++    // We still follow directory symlinks in the path.+    let dirlinkname = tmpdir.join("dirlink");+    check!(symlink_dir(tmpdir.path(), &dirlinkname));+    check!(opts.open(dirlinkname.join("file.txt")));++    // We also still follow hardlinks.+    let hardlinkname = tmpdir.join("hardlink");+    check!(fs::hard_link(&filename, &hardlinkname));+    check!(opts.open(&hardlinkname));++    // Also check `fs::Dir` methods.+    check!(fs::Dir::open(&dirlinkname)); // just to confirm that it works without nofollow+    let err = fs::Dir::open_with(&dirlinkname, &opts).unwrap_err();+    assert_matches!(err.kind(), ErrorKind::FilesystemLoop | ErrorKind::NotADirectory); // different error on Linux+    let dir = check!(fs::Dir::open_with(tmpdir.path(), &opts));+    let err = dir.open_file_with("link", &opts).unwrap_err();+    assert_eq!(err.kind(), ErrorKind::FilesystemLoop);+    check!(dir.open_dir("dirlink")); // just to confirm that it works without nofollow+    let err = dir.open_dir_with("dirlink", &opts).unwrap_err();+    assert_matches!(err.kind(), ErrorKind::FilesystemLoop | ErrorKind::NotADirectory); // different error on Linux+}+ #[test] #[cfg(windows)] fn windows_access_mode_override() {@@ -2208,7 +2250,7 @@ fn realpath_works() {     let tmpdir = tmpdir();     if !got_symlink_permission(&tmpdir) {         return;-    };+    }      let tmpdir = fs::canonicalize(tmpdir.path()).unwrap();     let file = tmpdir.join("test");@@ -2235,7 +2277,7 @@ fn realpath_works_tricky() {     let tmpdir = tmpdir();     if !got_symlink_permission(&tmpdir) {         return;-    };+    }      let tmpdir = fs::canonicalize(tmpdir.path()).unwrap();     let a = tmpdir.join("a");@@ -2406,7 +2448,7 @@ fn symlink_hard_link() {     let tmpdir = tmpdir();     if !got_symlink_permission(&tmpdir) {         return;-    };+    }      // Create "file", a file.     check!(fs::File::create(tmpdir.join("file")));
library/std/src/sys/fs/common.rs7 + / 1 −
@@ -67,7 +67,13 @@ pub struct Dir { }  impl Dir {-    pub fn open(path: &Path, _opts: &OpenOptions) -> io::Result<Self> {+    pub fn open(path: &Path, opts: &OpenOptions) -> io::Result<Self> {+        if opts.nofollow && path.is_symlink() {+            return Err(io::const_error!(+                ErrorKind::FilesystemLoop,+                "opening a symlink in nofollow mode"+            ));+        }         path.canonicalize().map(|path| Self { path })     } 
library/std/src/sys/fs/hermit.rs18 + / 0 −
@@ -121,6 +121,7 @@ pub struct OpenOptions {     truncate: bool,     create: bool,     create_new: bool,+    pub(super) nofollow: bool,     // system-specific     mode: i32, }@@ -330,6 +331,7 @@ impl OpenOptions {             truncate: false,             create: false,             create_new: false,+            nofollow: false,             // system-specific             mode: 0o777,         }@@ -353,6 +355,9 @@ impl OpenOptions {     pub fn create_new(&mut self, create_new: bool) {         self.create_new = create_new;     }+    pub fn nofollow(&mut self, nofollow: bool) {+        self.nofollow = nofollow;+    }      fn get_access_mode(&self) -> io::Result<i32> {         match (self.read, self.write, self.append) {@@ -398,6 +403,19 @@ impl File {     }      pub fn open_c(path: &CStr, opts: &OpenOptions) -> io::Result<File> {+        if opts.nofollow {+            // No O_NOFOLLOW on hermit, so we have to do a racy check manually.+            let mut stat_val: stat_struct = unsafe { mem::zeroed() };+            cvt(unsafe { hermit_abi::lstat(path.as_ptr(), &mut stat_val) })?;+            let attr = FileAttr { stat_val };+            if attr.file_type().is_symlink() {+                return Err(io::const_error!(+                    ErrorKind::FilesystemLoop,+                    "opening a symlink in nofollow mode"+                ));+            }+        }+         let mut flags = opts.get_access_mode()?;         flags = flags | opts.get_creation_mode()?; 
library/std/src/sys/fs/uefi.rs10 + / 1 −
@@ -36,6 +36,7 @@ pub struct OpenOptions {     append: bool,     truncate: bool,     create_new: bool,+    pub(super) nofollow: bool, }  #[derive(Copy, Clone, Debug, Default)]@@ -209,7 +210,7 @@ impl DirEntry {  impl OpenOptions {     pub fn new() -> OpenOptions {-        OpenOptions { mode: 0, append: false, create_new: false, truncate: false }+        OpenOptions { mode: 0, append: false, create_new: false, truncate: false, nofollow: false }     }      pub fn read(&mut self, read: bool) {@@ -257,6 +258,10 @@ impl OpenOptions {         }     } +    pub fn nofollow(&mut self, nofollow: bool) {+        self.nofollow = nofollow;+    }+     const fn is_mode_valid(&self) -> bool {         // Valid Combinations: Read, Read/Write, Read/Write/Create         self.mode == file::MODE_READ@@ -275,6 +280,10 @@ impl File {             return Err(io::const_error!(io::ErrorKind::AlreadyExists, "File already exists"));         } +        if opts.nofollow {+            // Nothing to check here as UEFI does not support symlinks.+        }+         let f = uefi_fs::File::from_path(path, opts.mode, 0).map(Self)?;          if opts.truncate {
library/std/src/sys/fs/unix.rs34 + / 19 −
@@ -428,6 +428,7 @@ pub struct OpenOptions {     truncate: bool,     create: bool,     create_new: bool,+    pub(super) nofollow: bool,     // system-specific     custom_flags: i32,     mode: mode_t,@@ -1122,6 +1123,7 @@ impl OpenOptions {             truncate: false,             create: false,             create_new: false,+            nofollow: false,             // system-specific             custom_flags: 0,             mode: 0o666,@@ -1146,6 +1148,9 @@ impl OpenOptions {     pub fn create_new(&mut self, create_new: bool) {         self.create_new = create_new;     }+    pub fn nofollow(&mut self, nofollow: bool) {+        self.nofollow = nofollow;+    }      pub fn custom_flags(&mut self, flags: i32) {         self.custom_flags = flags;@@ -1209,19 +1214,44 @@ impl OpenOptions {             (_, _, true) => libc::O_CREAT | libc::O_EXCL,         })     }++    fn get_open_flags(&self) -> io::Result<c_int> {+        let mut flags = self.get_access_mode()?+            | self.get_creation_mode()?+            | (self.custom_flags as c_int & !libc::O_ACCMODE);++        // ESP-IDF and Horizon do not support O_NOFOLLOW, so we skip setting it.+        // Their filesystems do not have symbolic links, so no special handling is required.+        #[cfg(not(any(target_os = "espidf", target_os = "horizon")))]+        if self.nofollow {+            flags |= libc::O_NOFOLLOW;+        }++        Ok(flags)+    } }  impl fmt::Debug for OpenOptions {     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {-        let OpenOptions { read, write, append, truncate, create, create_new, custom_flags, mode } =-            self;+        let OpenOptions {+            read,+            write,+            append,+            truncate,+            create,+            create_new,+            custom_flags,+            nofollow,+            mode,+        } = self;         f.debug_struct("OpenOptions")             .field("read", read)             .field("write", write)             .field("append", append)             .field("truncate", truncate)             .field("create", create)             .field("create_new", create_new)+            .field("nofollow", nofollow)             .field("custom_flags", custom_flags)             .field("mode", &Mode(*mode))             .finish()@@ -1234,10 +1264,7 @@ impl File {     }      pub fn open_c(path: &CStr, opts: &OpenOptions) -> io::Result<File> {-        let flags = libc::O_CLOEXEC-            | opts.get_access_mode()?-            | opts.get_creation_mode()?-            | (opts.custom_flags as c_int & !libc::O_ACCMODE);+        let flags = libc::O_CLOEXEC | opts.get_open_flags()?;         // The third argument of `open64` is documented to have type `mode_t`. On         // some platforms (like macOS, where `open64` is actually `open`), `mode_t` is `u16`.         // However, since this is a variadic function, C integer promotion rules mean that on@@ -1965,19 +1992,7 @@ pub fn set_perm_nofollow(p: &CStr, perm: FilePermissions) -> io::Result<()> {         use crate::fs::{OpenOptions, Permissions};          let mut options = OpenOptions::new();-        options.read(true);--        // ESP-IDF and Horizon do not support O_NOFOLLOW, so we skip setting it.-        // Their filesystems do not have symbolic links, so no special handling is required.-        #[cfg(not(any(target_os = "espidf", target_os = "horizon")))]-        {-            #[cfg(not(target_os = "wasi"))]-            use crate::os::unix::fs::OpenOptionsExt;-            #[cfg(target_os = "wasi")]-            use crate::os::wasi::fs::OpenOptionsExt;--            options.custom_flags(libc::O_NOFOLLOW);-        }+        options.read(true).nofollow(true);          // SAFETY: Since this function is called with `with_native_path`         // and that successfully converted the `&Path` to a `CString`,
library/std/src/sys/fs/unix/dir.rs2 + / 10 −
@@ -99,11 +99,7 @@ impl Dir {     }      fn open_with_c(path: &CStr, opts: &OpenOptions) -> io::Result<Self> {-        let flags = libc::O_CLOEXEC-            | libc::O_DIRECTORY-            | opts.get_access_mode()?-            | opts.get_creation_mode()?-            | (opts.custom_flags as c_int & !libc::O_ACCMODE);+        let flags = libc::O_CLOEXEC | libc::O_DIRECTORY | opts.get_open_flags()?;         let fd = cvt_r(|| unsafe { open64(path.as_ptr(), flags, opts.mode as c_int) })?;         Ok(Self(unsafe { OwnedFd::from_raw_fd(fd) }))     }@@ -120,11 +116,7 @@ impl Dir {         opts: &OpenOptions,         extra_flags: c_int,     ) -> io::Result<OwnedFd> {-        let flags = libc::O_CLOEXEC-            | opts.get_access_mode()?-            | opts.get_creation_mode()?-            | (opts.custom_flags as c_int & !libc::O_ACCMODE)-            | extra_flags;+        let flags = libc::O_CLOEXEC | opts.get_open_flags()? | extra_flags;         let fd = cvt_r(|| unsafe {             openat64(self.0.as_raw_fd(), path.as_ptr(), flags, opts.mode as c_int)         })?;
library/std/src/sys/fs/unsupported.rs7 + / 2 −
@@ -17,7 +17,9 @@ pub struct ReadDir(!); pub struct DirEntry(!);  #[derive(Clone, Debug)]-pub struct OpenOptions {}+pub struct OpenOptions {+    pub(super) nofollow: bool,+}  #[derive(Copy, Clone, Debug, Default)] pub struct FileTimes {}@@ -197,7 +199,7 @@ impl DirEntry {  impl OpenOptions {     pub fn new() -> OpenOptions {-        OpenOptions {}+        OpenOptions { nofollow: false }     }      pub fn read(&mut self, _read: bool) {}@@ -206,6 +208,9 @@ impl OpenOptions {     pub fn truncate(&mut self, _truncate: bool) {}     pub fn create(&mut self, _create: bool) {}     pub fn create_new(&mut self, _create_new: bool) {}+    pub fn nofollow(&mut self, nofollow: bool) {+        self.nofollow = nofollow;+    } }  impl File {
library/std/src/sys/fs/windows.rs49 + / 33 −
@@ -80,6 +80,7 @@ pub struct OpenOptions {     truncate: bool,     create: bool,     create_new: bool,+    pub(super) nofollow: bool,     // system-specific     custom_flags: u32,     access_mode: Option<u32>,@@ -214,6 +215,7 @@ impl OpenOptions {             truncate: false,             create: false,             create_new: false,+            nofollow: false,             // system-specific             custom_flags: 0,             access_mode: None,@@ -244,6 +246,9 @@ impl OpenOptions {     pub fn create_new(&mut self, create_new: bool) {         self.create_new = create_new;     }+    pub fn nofollow(&mut self, nofollow: bool) {+        self.nofollow = nofollow;+    }      pub fn custom_flags(&mut self, flags: u32) {         self.custom_flags = flags;@@ -324,7 +329,9 @@ impl OpenOptions {         self.custom_flags             | self.attributes             | self.security_qos_flags-            | if self.create_new { c::FILE_FLAG_OPEN_REPARSE_POINT } else { 0 }+            // By default, on Windows, CREATE_NEW would follow a symlink and create what it points+            // to. Prevent that from happening.+            | if self.nofollow || self.create_new { c::FILE_FLAG_OPEN_REPARSE_POINT } else { 0 }     } } @@ -355,40 +362,49 @@ impl File {             )         };         let handle = unsafe { HandleOrInvalid::from_raw_handle(handle) };-        if let Ok(handle) = OwnedHandle::try_from(handle) {-            if opts.freeze_last_access_time || opts.freeze_last_write_time {-                let file_time =-                    c::FILETIME { dwLowDateTime: 0xFFFFFFFF, dwHighDateTime: 0xFFFFFFFF };-                cvt(unsafe {-                    c::SetFileTime(-                        handle.as_raw_handle(),-                        core::ptr::null(),-                        if opts.freeze_last_access_time { &file_time } else { core::ptr::null() },-                        if opts.freeze_last_write_time { &file_time } else { core::ptr::null() },-                    )-                })?;-            }-            // Manual truncation. See #115745.-            if opts.truncate-                && creation == c::OPEN_ALWAYS-                && api::get_last_error() == WinError::ALREADY_EXISTS-            {-                // This first tries `FileAllocationInfo` but falls back to-                // `FileEndOfFileInfo` in order to support WINE.-                // If WINE gains support for FileAllocationInfo, we should-                // remove the fallback.-                let alloc = c::FILE_ALLOCATION_INFO { AllocationSize: 0 };-                set_file_information_by_handle(handle.as_raw_handle(), &alloc)-                    .or_else(|_| {-                        let eof = c::FILE_END_OF_FILE_INFO { EndOfFile: 0 };-                        set_file_information_by_handle(handle.as_raw_handle(), &eof)-                    })-                    .io_result()?;+        let Ok(handle) = OwnedHandle::try_from(handle) else {+            return Err(Error::last_os_error());+        };+        if opts.freeze_last_access_time || opts.freeze_last_write_time {+            let file_time = c::FILETIME { dwLowDateTime: 0xFFFFFFFF, dwHighDateTime: 0xFFFFFFFF };+            cvt(unsafe {+                c::SetFileTime(+                    handle.as_raw_handle(),+                    core::ptr::null(),+                    if opts.freeze_last_access_time { &file_time } else { core::ptr::null() },+                    if opts.freeze_last_write_time { &file_time } else { core::ptr::null() },+                )+            })?;+        }+        // Manual truncation. See #115745.+        if opts.truncate+            && creation == c::OPEN_ALWAYS+            && api::get_last_error() == WinError::ALREADY_EXISTS+        {+            // This first tries `FileAllocationInfo` but falls back to+            // `FileEndOfFileInfo` in order to support WINE.+            // If WINE gains support for FileAllocationInfo, we should+            // remove the fallback.+            let alloc = c::FILE_ALLOCATION_INFO { AllocationSize: 0 };+            set_file_information_by_handle(handle.as_raw_handle(), &alloc)+                .or_else(|_| {+                    let eof = c::FILE_END_OF_FILE_INFO { EndOfFile: 0 };+                    set_file_information_by_handle(handle.as_raw_handle(), &eof)+                })+                .io_result()?;+        }+        let file = File { handle: Handle::from_inner(handle) };+        if opts.nofollow {+            // The flag we set just means we open the reparse point, but `nofollow` says+            // we have to fail if it was a symlink.+            if file.file_attr()?.file_type().is_symlink() {+                return Err(io::const_error!(+                    io::ErrorKind::FilesystemLoop,+                    "opening a symlink in nofollow mode"+                ));             }-            Ok(File { handle: Handle::from_inner(handle) })-        } else {-            Err(Error::last_os_error())         }+        Ok(file)     }      pub fn fsync(&self) -> io::Result<()> {
library/std/src/sys/fs/windows/dir.rs50 + / 13 −
@@ -27,6 +27,9 @@ fn to_u16s_without_nul(path: &Path) -> io::Result<Vec<u16>> { /// A wrapper around a raw NtCreateFile call. /// /// This isn't completely safe because `OBJECT_ATTRIBUTES` contains raw pointers.+///+/// Does NOT perform the `nofollow` check! If `opts.nofollow` is set, will open a+/// reparse point rather than following it. unsafe fn nt_create_file(     opts: &OpenOptions,     object_attributes: &c::OBJECT_ATTRIBUTES,@@ -36,8 +39,10 @@ unsafe fn nt_create_file(     let mut io_status = c::IO_STATUS_BLOCK::PENDING;     // SYNCHRONIZE is included in FILE_GENERIC_READ, but not GENERIC_READ, so we add it manually     let access = opts.get_access_mode()? | c::SYNCHRONIZE;-    // one of FILE_SYNCHRONOUS_IO_{,NON}ALERT is required for later operations to succeed.-    let options = create_options | c::FILE_SYNCHRONOUS_IO_NONALERT;+    let options = create_options+        // one of FILE_SYNCHRONOUS_IO_{,NON}ALERT is required for later operations to succeed.+        | c::FILE_SYNCHRONOUS_IO_NONALERT+        | if opts.nofollow { c::FILE_OPEN_REPARSE_POINT } else { 0 };     let status = unsafe {         c::NtCreateFile(             &mut handle,@@ -82,7 +87,16 @@ impl Dir {             return File::open(path, opts);         }         let path = to_u16s_without_nul(path)?;-        self.open_file_native(&path, opts, c::FILE_NON_DIRECTORY_FILE).map(|handle| File { handle })+        let file = self+            .open_file_native(&path, opts, c::FILE_NON_DIRECTORY_FILE)+            .map(|handle| File { handle })?;+        if opts.nofollow && file.file_attr()?.file_type().is_symlink() {+            return Err(io::const_error!(+                io::ErrorKind::FilesystemLoop,+                "opening a symlink in nofollow mode"+            ));+        }+        Ok(file)     }      pub fn remove_file(&self, path: &Path) -> io::Result<()> {@@ -106,7 +120,16 @@ impl Dir {      pub fn open_dir(&self, path: &Path, opts: &OpenOptions) -> io::Result<Self> {         let path = to_u16s_without_nul(&path)?;-        self.open_file_native(&path, &opts, c::FILE_DIRECTORY_FILE).map(|handle| Self { handle })+        let dir = self+            .open_file_native(&path, &opts, c::FILE_DIRECTORY_FILE)+            .map(|handle| Self { handle })?;+        if opts.nofollow && dir.self_metadata()?.file_type().is_symlink() {+            return Err(io::const_error!(+                io::ErrorKind::FilesystemLoop,+                "opening a symlink in nofollow mode"+            ));+        }+        Ok(dir)     }      pub fn remove_dir(&self, path: &Path) -> io::Result<()> {@@ -133,12 +156,22 @@ impl Dir {                 ptr::null_mut(),             )         };-        match OwnedHandle::try_from(unsafe { HandleOrInvalid::from_raw_handle(handle) }) {-            Ok(handle) => Ok(Self { handle: Handle::from_inner(handle) }),-            Err(_) => Err(io::Error::last_os_error()),+        let handle = unsafe { HandleOrInvalid::from_raw_handle(handle) };+        let Ok(handle) = OwnedHandle::try_from(handle) else {+            return Err(io::Error::last_os_error());+        };+        let dir = Self { handle: Handle::from_inner(handle) };+        if opts.nofollow && dir.self_metadata()?.file_type().is_symlink() {+            return Err(io::const_error!(+                io::ErrorKind::FilesystemLoop,+                "opening a symlink in nofollow mode"+            ));         }+        Ok(dir)     } +    /// Does NOT perform the `nofollow` check! If `opts.nofollow` is set, will open a+    /// reparse point rather than following it.     fn open_file_native(         &self,         path: &[u16],@@ -157,17 +190,17 @@ impl Dir {     fn remove_native(&self, path: &[u16], dir: bool) -> io::Result<()> {         let mut opts = OpenOptions::new();         opts.access_mode(c::DELETE);-        let mut create_opt = if dir { c::FILE_DIRECTORY_FILE } else { c::FILE_NON_DIRECTORY_FILE };-        create_opt |= c::FILE_OPEN_REPARSE_POINT;+        opts.nofollow(true);+        let create_opt = if dir { c::FILE_DIRECTORY_FILE } else { c::FILE_NON_DIRECTORY_FILE };         let handle = self.open_file_native(path, &opts, create_opt)?;         File::from_inner(handle).delete().io_result()     }      fn rename_native(&self, from: &[u16], to_dir: &Self, to: &[u16]) -> io::Result<()> {         let mut opts = OpenOptions::new();         opts.access_mode(c::DELETE);-        let handle =-            self.open_file_native(from, &opts, /* create_opt */ c::FILE_OPEN_REPARSE_POINT)?;+        opts.nofollow(true);+        let handle = self.open_file_native(from, &opts, /* create_opt */ 0)?;         // Calculate the layout of the `FILE_RENAME_INFORMATION` we pass to `NtSetInformationFile`         // This is a dynamically sized struct so we need to get the position of the last field to calculate the actual size.         const too_long_err: io::Error =@@ -260,15 +293,19 @@ impl Dir {         let mut opts = OpenOptions::new();         // the NT functions need at least c::FILE_READ_ATTRIBUTES         opts.access_mode(c::FILE_READ_ATTRIBUTES);-        let create_opt = if reparse == ReparsePoint::Open { c::FILE_OPEN_REPARSE_POINT } else { 0 };+        if reparse == ReparsePoint::Open {+            opts.nofollow(true);+        }          let name = UnicodeStrRef::from_slice(path);         let object_attributes = c::OBJECT_ATTRIBUTES {             RootDirectory: self.handle.as_raw_handle(),             ObjectName: name.as_ptr().cast_mut(),             ..c::OBJECT_ATTRIBUTES::with_length()         };-        let handle = unsafe { nt_create_file(&opts, &object_attributes, create_opt)? };+        let handle = unsafe {+            nt_create_file(&opts, &object_attributes, /* create_opt */ 0)?+        };         File { handle }.file_attr()     } }
src/tools/miri/src/lib.rs1 + / 0 −
@@ -9,6 +9,7 @@     feature(abort_unwind) )] #![cfg_attr(windows, feature(windows_by_handle))]+#![cfg_attr(not(bootstrap), feature(open_options_nofollow))] #![feature(array_try_from_fn)] #![feature(clamp_to)] #![feature(rustc_private)]
src/tools/miri/src/shims/files.rs6 + / 5 −
@@ -790,10 +790,10 @@ pub fn open_file_or_dir(                 // Convert back to file so it always has the same type.                 Ok(dir) => Ok(File::from(OwnedHandle::from(dir))),                 Err(err2) => {-                    // If this 2nd attempt says "not a directory", preserve the original error. It's-                    // possible that we lost a race twice if this keeps being changed from directory-                    // to file and back. However, in that case it was entirely non-existent for a-                    // little while, so returning an error is still fine.+                    // It's possible that we lost a race twice if this keeps being changed from+                    // directory to file and back. However, in that case it was entirely+                    // non-existent for a little while, so returning an error is still fine.+                    // If this 2nd attempt says "not a directory", preserve the original error.                     Err(if err2.kind() == io::ErrorKind::NotADirectory { err } else { err2 })                 }             }@@ -804,8 +804,9 @@ pub fn open_file_or_dir(     let file = file?;      let metadata = file.metadata().expect("just-opened file/dir should have metadata");+    #[cfg(not(bootstrap))]+    assert!(!metadata.is_symlink()); // we either follow symlinks or error, never open them     if metadata.is_dir() {-        assert!(!metadata.is_symlink()); // Rust makes this mutually exclusive with `is_dir`         // Convert to dir.         cfg_select! {             unix => {
src/tools/miri/src/shims/unix/fs.rs8 + / 2 −
@@ -630,6 +630,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {         let mut flag = flag;          let mut options = OpenOptions::new();+        #[allow(unused_mut)] // depends on cfg         let mut custom_flags = 0;          let o_rdonly = ecx.eval_libc_i32("O_RDONLY");@@ -750,13 +751,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {             // (Technically we do not support *not* setting this flag, but we ignore that.)         }         let o_nofollow = ecx.eval_libc_i32("O_NOFOLLOW");+        #[cfg(bootstrap)]         let mut nofollow = false;         if flag & o_nofollow == o_nofollow {             flag &= !o_nofollow;-            nofollow = true;             cfg_select! {+                not(bootstrap) => {+                    options.nofollow(true);+                }                 unix => {                     custom_flags |= libc::O_NOFOLLOW;+                    nofollow = true;                 }                 windows => {                     if dirfd.is_some() {@@ -766,6 +771,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {                     }                     custom_flags |=                         windows_sys::Win32::Storage::FileSystem::FILE_FLAG_OPEN_REPARSE_POINT;+                    nofollow = true;                 }             }         }@@ -802,7 +808,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {         match f_or_d {             Err(err) => ecx.set_errno_and_return_neg1_i32(err),             Ok(Either::Right(dir)) => {-                // This means it cannot be a symlink, so `nofollow` is fine.                 if writable {                     // On Windows, opening a folder writable can succeed.                     // But here we want it to always fail.@@ -818,6 +823,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {                 if want_directory {                     return ecx.set_errno_and_return_neg1_i32(LibcError("ENOTDIR"));                 }+                #[cfg(bootstrap)]                 if file.metadata().unwrap().is_symlink() {                     if nofollow {                         // On Windows, FILE_FLAG_OPEN_REPARSE_POINT makes opening still succeed, it
src/tools/miri/src/shims/windows/fs.rs1 + / 1 −
@@ -181,7 +181,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {             // so we cannot even support anything else.             // But for all other creation dispositions we'd have to do actual work, so reject those.             throw_unsup_format!(-                "CreateFileW: FILE_FLAG_OPEN_REPARSE_POINT is only supported if and only if CREATE_NEW is set"+                "CreateFileW: FILE_FLAG_OPEN_REPARSE_POINT must be set if and only if CREATE_NEW is set"             );         }         if attributes.contains(FileAttributes::BACKUP_SEMANTICS)
src/tools/miri/tests/pass-dep/libc/fs.rs4 + / 2 −
@@ -488,13 +488,14 @@ fn test_open_nofollow() {             matches!(err.raw_os_error().unwrap(), libc::ELOOP | libc::EMLINK),             "unexpected errno: {err}"         );-        // If we set O_DIRECTORY, we get a different error on Linux, but still EMLINK on FreeBSD.+        // If we set O_DIRECTORY, we get ENOTDIR on Linux, but still EMLINK on FreeBSD.+        // On Windows hosts we get FilesystemLoop which translates to ELOOP.         let err = errno_result(unsafe {             libc::open(symlink_cpath.as_ptr(), libc::O_NOFOLLOW | libc::O_DIRECTORY)         })         .unwrap_err();         assert!(-            matches!(err.raw_os_error().unwrap(), libc::ENOTDIR | libc::EMLINK),+            matches!(err.raw_os_error().unwrap(), libc::ENOTDIR | libc::ELOOP | libc::EMLINK),             "unexpected errno: {err}"         );     }@@ -649,6 +650,7 @@ fn test_openat(          // FIXME: O_NOFOLLOW does not work with openat on Windows hosts.         // See <https://github.com/rust-lang/miri/issues/5406>.+        // cfg(bootstrap) -- remove `if` on bootstrap bump so test always runs         if cfg!(not(windows_host)) {             // That should fail with O_NOFOLLOW.             let err = errno_result(unsafe { openat(dirfd, c"dirlink".as_ptr(), libc::O_NOFOLLOW) })
tests/ui/async-await/async-closures/ambiguous-arg.stderr8 + / 3 −
@@ -1,12 +1,17 @@ error[E0282]: type annotations needed-  --> $DIR/ambiguous-arg.rs:7:25+  --> $DIR/ambiguous-arg.rs:7:12    | LL |       async |check, a, b| {-   |  _________________________^+   |  ____________^^^^^________- LL | | LL | |         temp.abs_diff(12); LL | |     };-   | |_____^ cannot infer type+   | |_____- type must be known at this point+   |+help: consider giving this closure parameter an explicit type+   |+LL |     async |check: /* Type */, a, b| {+   |                 ++++++++++++  error: aborting due to 1 previous error 
tests/ui/async-await/async-closures/parameter-inference-span-issue-139150.rsadded45 + / 0 −
@@ -0,0 +1,45 @@+//! Regression test for <https://github.com/rust-lang/rust/issues/139150>.+// Prefer the source parameter over the lowered async closure body for type annotations.++//@ edition: 2024++fn wildcard() {+    async |_| {};+    //~^ ERROR type annotations needed+}++fn named() {+    let _ = async |value| { let _ = value; };+    //~^ ERROR type annotations needed+}++fn tuple() {+    let _ = async |(first, second)| { let _ = (first, second); };+    //~^ ERROR type annotations needed+}++fn by_ref() {+    let _ = async |ref value| { let _ = value; };+    //~^ ERROR type annotations needed+}++fn explicit() {+    let _ = async |_: Option<_>| {};+    //~^ ERROR type annotations needed+}++fn synchronous() {+    let _ = |_| {};+    //~^ ERROR type annotations needed+}++macro_rules! generated {+    () => { async |_| {} };+    //~^ ERROR type annotations needed+}++fn from_macro() {+    let _ = generated!();+}++fn main() {}
tests/ui/async-await/async-closures/parameter-inference-span-issue-139150.stderradded74 + / 0 −
@@ -0,0 +1,74 @@+error[E0282]: type annotations needed+  --> $DIR/parameter-inference-span-issue-139150.rs:7:12+   |+LL |     async |_| {};+   |            ^  -- type must be known at this point+   |+help: consider giving this closure parameter an explicit type+   |+LL |     async |_: /* Type */| {};+   |             ++++++++++++++error[E0282]: type annotations needed+  --> $DIR/parameter-inference-span-issue-139150.rs:12:20+   |+LL |     let _ = async |value| { let _ = value; };+   |                    ^^^^^  ------------------ type must be known at this point+   |+help: consider giving this closure parameter an explicit type+   |+LL |     let _ = async |value: /* Type */| { let _ = value; };+   |                         ++++++++++++++error[E0282]: type annotations needed for `(_, _)`+  --> $DIR/parameter-inference-span-issue-139150.rs:17:20+   |+LL |     let _ = async |(first, second)| { let _ = (first, second); };+   |                    ^^^^^^^^^^^^^^^            --------------- type must be known at this point+   |+help: consider giving this closure parameter an explicit type, where the placeholders `_` are specified+   |+LL |     let _ = async |(first, second): (_, _)| { let _ = (first, second); };+   |                                   ++++++++++error[E0282]: type annotations needed+  --> $DIR/parameter-inference-span-issue-139150.rs:22:20+   |+LL |     let _ = async |ref value| { let _ = value; };+   |                    ^^^^^^^^^            ----- type must be known at this point+   |+help: consider giving this closure parameter an explicit type+   |+LL |     let _ = async |ref value: /* Type */| { let _ = value; };+   |                             ++++++++++++++error[E0282]: type annotations needed+  --> $DIR/parameter-inference-span-issue-139150.rs:27:34+   |+LL |     let _ = async |_: Option<_>| {};+   |                                  ^^ cannot infer type++error[E0282]: type annotations needed+  --> $DIR/parameter-inference-span-issue-139150.rs:32:14+   |+LL |     let _ = |_| {};+   |              ^+   |+help: consider giving this closure parameter an explicit type+   |+LL |     let _ = |_: /* Type */| {};+   |               ++++++++++++++error[E0282]: type annotations needed+  --> $DIR/parameter-inference-span-issue-139150.rs:37:23+   |+LL | macro_rules! generated {+LL |     () => { async |_| {} };+   |                       ^^ cannot infer type+...+LL |     let _ = generated!();+   |             ------------ in this macro invocation++error: aborting due to 7 previous errors++For more information about this error, try `rustc --explain E0282`.
tests/ui/closures/hrtb-closure-suggest-type-annotation.next.fixedrenamed5 + / 2 −
@@ -1,4 +1,6 @@ //@ run-rustfix+//@ revisions: next old+//@[next] compile-flags: -Znext-solver // When a closure is passed where a higher-ranked `FnOnce` is expected, but the closure // parameter has no explicit type annotation, the compiler should suggest adding one. // See <https://github.com/rust-lang/rust/issues/141461>.@@ -31,8 +33,9 @@ where     };      inner(buf, outer_closure)-    //~^ ERROR implementation of `FnOnce` is not general enough-    //~| ERROR implementation of `FnOnce` is not general enough+    //[old]~^ ERROR: implementation of `FnOnce` is not general enough+    //[old]~| ERROR: implementation of `FnOnce` is not general enough+    //[next]~^^^ ERROR: expected `FnOnce(&mut [u8])` signature, found `{closure }  fn main() {
tests/ui/closures/hrtb-closure-suggest-type-annotation.next.stderradded30 + / 0 −
@@ -0,0 +1,30 @@+error[E0277]: expected `FnOnce(&mut [u8])` signature, found `{closure@$DIR/hrtb-closure-suggest-type-annotation.rs:22:25: 22:30}`+  --> $DIR/hrtb-closure-suggest-type-annotation.rs:35:16+   |+LL |     inner(buf, outer_closure)+   |     -----      ^^^^^^^^^^^^^ expected `FnOnce(&mut [u8])` signature, found `{closure@$DIR/hrtb-closure-suggest-type-annotation.rs:22:25: 22:30}`+   |     |+   |     required by a bound introduced by this call+   |+help: the trait `for<'a> FnOnce(&'a mut [u8])` is not implemented for closure `{closure@$DIR/hrtb-closure-suggest-type-annotation.rs:22:25: 22:30}`+  --> $DIR/hrtb-closure-suggest-type-annotation.rs:22:25+   |+LL |     let outer_closure = |buf| {+   |                         ^^^^^+   = note: expected type with signature `for<'a> fn(&'a mut _)`+           found closure with signature `fn(&mut _)`+note: required by a bound in `inner`+  --> $DIR/hrtb-closure-suggest-type-annotation.rs:10:8+   |+LL | fn inner<F>(buf: &mut [u8], func: F) -> usize+LL | where+LL |     F: FnOnce(&mut [u8]) -> Result<usize, isize>,+   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `inner`+help: consider adding an explicit type annotation to the closure's argument+   |+LL |     let outer_closure = |buf: &mut [u8]| {+   |                             +++++++++++++error: aborting due to 1 previous error++For more information about this error, try `rustc --explain E0277`.
tests/ui/closures/hrtb-closure-suggest-type-annotation.old.fixedadded47 + / 0 −
@@ -0,0 +1,47 @@+//@ run-rustfix+//@ revisions: next old+//@[next] compile-flags: -Znext-solver+// When a closure is passed where a higher-ranked `FnOnce` is expected, but the closure+// parameter has no explicit type annotation, the compiler should suggest adding one.+// See <https://github.com/rust-lang/rust/issues/141461>.++fn inner<F>(buf: &mut [u8], func: F) -> usize+where+    F: FnOnce(&mut [u8]) -> Result<usize, isize>,+{+    match func(buf) {+        Ok(n) => n,+        Err(e) => e as usize,+    }+}++fn outer<F>(buf: &mut [u8], func: F) -> usize+where+    F: FnOnce(&mut [u8]) -> Result<usize, isize>,+{+    let outer_closure = |buf: &mut [u8]| {+        match func(buf) {+            Ok(n) => {+                println!("OK: {n}");+                Ok(n)+            }+            Err(e) => {+                println!("ERR: {e}");+                Err(e)+            }+        }+    };++    inner(buf, outer_closure)+    //[old]~^ ERROR: implementation of `FnOnce` is not general enough+    //[old]~| ERROR: implementation of `FnOnce` is not general enough+    //[next]~^^^ ERROR: expected `FnOnce(&mut [u8])` signature, found `{closure+}++fn main() {+    let mut x = [0u8; 16];+    let res = outer(&mut x, |buf| {+        if buf.len() % 2 == 0 { Ok(buf.len()) } else { Err(buf.len() as isize) }+    });+    println!("{res:?}");+}
tests/ui/closures/hrtb-closure-suggest-type-annotation.old.stderrrenamed4 + / 4 −
@@ -1,11 +1,11 @@ error: implementation of `FnOnce` is not general enough-  --> $DIR/hrtb-closure-suggest-type-annotation.rs:33:5+  --> $DIR/hrtb-closure-suggest-type-annotation.rs:35:5    | LL |     inner(buf, outer_closure)    |     ^^^^^^^^^^^^^^^^^^^^^^^^^    | note: closure with signature `fn(&'2 mut [u8]) -> Result<usize, isize>` must implement `FnOnce<(&'1 mut [u8],)>`, for any lifetime `'1`...-  --> $DIR/hrtb-closure-suggest-type-annotation.rs:8:8+  --> $DIR/hrtb-closure-suggest-type-annotation.rs:10:8    | LL | fn inner<F>(buf: &mut [u8], func: F) -> usize LL | where@@ -18,13 +18,13 @@ LL |     let outer_closure = |buf: &mut [u8]| {    |                             +++++++++++  error: implementation of `FnOnce` is not general enough-  --> $DIR/hrtb-closure-suggest-type-annotation.rs:33:5+  --> $DIR/hrtb-closure-suggest-type-annotation.rs:35:5    | LL |     inner(buf, outer_closure)    |     ^^^^^^^^^^^^^^^^^^^^^^^^^    | note: closure with signature `fn(&'2 mut [u8]) -> Result<usize, isize>` must implement `FnOnce<(&'1 mut [u8],)>`, for any lifetime `'1`...-  --> $DIR/hrtb-closure-suggest-type-annotation.rs:8:29+  --> $DIR/hrtb-closure-suggest-type-annotation.rs:10:29    | LL | fn inner<F>(buf: &mut [u8], func: F) -> usize LL | where
tests/ui/closures/hrtb-closure-suggest-type-annotation.rs5 + / 2 −
@@ -1,4 +1,6 @@ //@ run-rustfix+//@ revisions: next old+//@[next] compile-flags: -Znext-solver // When a closure is passed where a higher-ranked `FnOnce` is expected, but the closure // parameter has no explicit type annotation, the compiler should suggest adding one. // See <https://github.com/rust-lang/rust/issues/141461>.@@ -31,8 +33,9 @@ where     };      inner(buf, outer_closure)-    //~^ ERROR implementation of `FnOnce` is not general enough-    //~| ERROR implementation of `FnOnce` is not general enough+    //[old]~^ ERROR: implementation of `FnOnce` is not general enough+    //[old]~| ERROR: implementation of `FnOnce` is not general enough+    //[next]~^^^ ERROR: expected `FnOnce(&mut [u8])` signature, found `{closure }  fn main() {
tests/ui/lifetimes/issue-79187-2.next.stderradded74 + / 0 −
@@ -0,0 +1,74 @@+error[E0277]: the trait bound `{closure@$DIR/issue-79187-2.rs:10:14: 10:17}: Foo` is not satisfied+  --> $DIR/issue-79187-2.rs:10:14+   |+LL |     take_foo(|a| a);+   |     -------- ^^^^^ unsatisfied trait bound+   |     |+   |     required by a bound introduced by this call+   |+help: the trait `for<'a> FnOnce(&'a i32)` is not implemented for closure `{closure@$DIR/issue-79187-2.rs:10:14: 10:17}`+  --> $DIR/issue-79187-2.rs:10:14+   |+LL |     take_foo(|a| a);+   |              ^^^+   = note: expected type with signature `for<'a> fn(&'a _)`+           found closure with signature `fn(&_)`+note: required for `{closure@$DIR/issue-79187-2.rs:10:14: 10:17}` to implement `Foo`+  --> $DIR/issue-79187-2.rs:5:9+   |+LL | impl<F> Foo for F where F: Fn(&i32) -> &i32 {}+   |         ^^^     ^                      ---- unsatisfied trait bound introduced here+note: required by a bound in `take_foo`+  --> $DIR/issue-79187-2.rs:7:21+   |+LL | fn take_foo(_: impl Foo) {}+   |                     ^^^ required by this bound in `take_foo`+help: consider adding an explicit type annotation to the closure's argument+   |+LL |     take_foo(|a: &i32| a);+   |                ++++++++error[E0271]: type mismatch resolving `<{closure@issue-79187-2.rs:14:14} as FnOnce<(&i32,)>>::Output == &i32`+  --> $DIR/issue-79187-2.rs:14:24+   |+LL |     take_foo(|a: &i32| a);+   |     -------- --------- ^ types differ+   |     |        |+   |     |        this closure+   |     required by a bound introduced by this call+   |+note: required for `{closure@$DIR/issue-79187-2.rs:14:14: 14:23}` to implement `Foo`+  --> $DIR/issue-79187-2.rs:5:9+   |+LL | impl<F> Foo for F where F: Fn(&i32) -> &i32 {}+   |         ^^^     ^                      ---- unsatisfied trait bound introduced here+note: required by a bound in `take_foo`+  --> $DIR/issue-79187-2.rs:7:21+   |+LL | fn take_foo(_: impl Foo) {}+   |                     ^^^ required by this bound in `take_foo`++error[E0271]: type mismatch resolving `<{closure@issue-79187-2.rs:18:14} as FnOnce<(&i32,)>>::Output == &i32`+  --> $DIR/issue-79187-2.rs:18:34+   |+LL |     take_foo(|a: &i32| -> &i32 { a });+   |     -------- -----------------   ^ types differ+   |     |        |+   |     |        this closure+   |     required by a bound introduced by this call+   |+note: required for `{closure@$DIR/issue-79187-2.rs:18:14: 18:31}` to implement `Foo`+  --> $DIR/issue-79187-2.rs:5:9+   |+LL | impl<F> Foo for F where F: Fn(&i32) -> &i32 {}+   |         ^^^     ^                      ---- unsatisfied trait bound introduced here+note: required by a bound in `take_foo`+  --> $DIR/issue-79187-2.rs:7:21+   |+LL | fn take_foo(_: impl Foo) {}+   |                     ^^^ required by this bound in `take_foo`++error: aborting due to 3 previous errors++Some errors have detailed explanations: E0271, E0277.+For more information about an error, try `rustc --explain E0271`.
tests/ui/lifetimes/issue-79187-2.old.stderrrenamed10 + / 10 −
@@ -1,11 +1,11 @@ error: implementation of `FnOnce` is not general enough-  --> $DIR/issue-79187-2.rs:8:5+  --> $DIR/issue-79187-2.rs:10:5    | LL |     take_foo(|a| a);    |     ^^^^^^^^^^^^^^^    | note: closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i32,)>`, for any lifetime `'1`...-  --> $DIR/issue-79187-2.rs:5:21+  --> $DIR/issue-79187-2.rs:7:21    | LL | fn take_foo(_: impl Foo) {}    |                     ^^^ required by this bound in `take_foo`@@ -16,13 +16,13 @@ LL |     take_foo(|a: &i32| a);    |                ++++++  error: implementation of `Fn` is not general enough-  --> $DIR/issue-79187-2.rs:8:5+  --> $DIR/issue-79187-2.rs:10:5    | LL |     take_foo(|a| a);    |     ^^^^^^^^^^^^^^^    | note: closure with signature `fn(&'2 i32) -> &i32` must implement `Fn<(&'1 i32,)>`, for any lifetime `'1`...-  --> $DIR/issue-79187-2.rs:5:21+  --> $DIR/issue-79187-2.rs:7:21    | LL | fn take_foo(_: impl Foo) {}    |                     ^^^ required by this bound in `take_foo`@@ -33,21 +33,21 @@ LL |     take_foo(|a: &i32| a);    |                ++++++  error[E0308]: mismatched types-  --> $DIR/issue-79187-2.rs:11:5+  --> $DIR/issue-79187-2.rs:14:5    | LL |     take_foo(|a: &i32| a);    |     ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other    |    = note: expected reference `&_`               found reference `&_` note: the lifetime requirement is introduced here-  --> $DIR/issue-79187-2.rs:5:21+  --> $DIR/issue-79187-2.rs:7:21    | LL | fn take_foo(_: impl Foo) {}    |                     ^^^  error: lifetime may not live long enough-  --> $DIR/issue-79187-2.rs:11:24+  --> $DIR/issue-79187-2.rs:14:24    | LL |     take_foo(|a: &i32| a);    |                  -   - ^ returning this value requires that `'1` must outlive `'2`@@ -56,21 +56,21 @@ LL |     take_foo(|a: &i32| a);    |                  let's call the lifetime of this reference `'1`  error[E0308]: mismatched types-  --> $DIR/issue-79187-2.rs:14:5+  --> $DIR/issue-79187-2.rs:18:5    | LL |     take_foo(|a: &i32| -> &i32 { a });    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other    |    = note: expected reference `&_`               found reference `&_` note: the lifetime requirement is introduced here-  --> $DIR/issue-79187-2.rs:5:21+  --> $DIR/issue-79187-2.rs:7:21    | LL | fn take_foo(_: impl Foo) {}    |                     ^^^  error: lifetime may not live long enough-  --> $DIR/issue-79187-2.rs:14:34+  --> $DIR/issue-79187-2.rs:18:34    | LL |     take_foo(|a: &i32| -> &i32 { a });    |                  -        -      ^ returning this value requires that `'1` must outlive `'2`
tests/ui/lifetimes/issue-79187-2.rs11 + / 6 −
@@ -1,3 +1,5 @@+//@ revisions: next old+//@[next] compile-flags: -Znext-solver trait Foo {}  impl<F> Foo for F where F: Fn(&i32) -> &i32 {}@@ -6,14 +8,17 @@ fn take_foo(_: impl Foo) {}  fn main() {     take_foo(|a| a);-    //~^ ERROR implementation of `FnOnce` is not general enough-    //~| ERROR implementation of `Fn` is not general enough+    //[old]~^ ERROR: implementation of `FnOnce` is not general enough+    //[old]~| ERROR: implementation of `Fn` is not general enough+    //[next]~^^^ ERROR: the trait bound `{closure@$DIR/issue-79187-2.rs:10:14: 10:17}: Foo` is not satisfied     take_foo(|a: &i32| a);-    //~^ ERROR lifetime may not live long enough-    //~| ERROR mismatched types+    //[old]~^ ERROR: lifetime may not live long enough+    //[old]~| ERROR: mismatched types+    //[next]~^^^ ERROR: type mismatch     take_foo(|a: &i32| -> &i32 { a });-    //~^ ERROR lifetime may not live long enough-    //~| ERROR mismatched types+    //[old]~^ ERROR: lifetime may not live long enough+    //[old]~| ERROR: mismatched types+    //[next]~^^^ ERROR: type mismatch      // OK     take_foo(identity(|a| a));
tests/ui/mismatched_types/closure-mismatch.next.stderr8 + / 0 −
@@ -25,6 +25,10 @@ note: required by a bound in `baz`    | LL | fn baz<T: Foo>(_: T) {}    |           ^^^ required by this bound in `baz`+help: consider adding an explicit type annotation to the closure's argument+   |+LL |     baz(|_: &()| ());+   |           +++++  error[E0277]: the trait bound `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}: Foo` is not satisfied   --> $DIR/closure-mismatch.rs:16:9@@ -53,6 +57,10 @@ note: required by a bound in `baz`    | LL | fn baz<T: Foo>(_: T) {}    |           ^^^ required by this bound in `baz`+help: consider adding an explicit type annotation to the closure's argument+   |+LL |     baz(|x: &()| ());+   |           +++++  error: aborting due to 2 previous errors 
yarn.lock69 + / 69 −
@@ -74,12 +74,12 @@     "@nodelib/fs.scandir" "2.1.5"     fastq "^1.6.0" -"@puppeteer/browsers@3.2.0":-  version "3.2.0"-  resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-3.2.0.tgz#269293687a4c701a0a4701a15b50e9c0e337de93"-  integrity sha512-LlBrE8oqGfU7b1Nk2d5Q1SbuPhZxTj0cJEMDPEws28OjNMELlflekmPPuf4FnK03x0ZRjKaYwJElUcKK4kyqJA==+"@puppeteer/browsers@3.3.0":+  version "3.3.0"+  resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-3.3.0.tgz#e8e3e4c313f881b0656cddaa5f6b79d91bb783fc"+  integrity sha512-ZiOVHQ5KmsinwZJMwRc/a3xsGHbi9dRuAyf2gq4i9J5vRaI4r7SSIaJUniF1JVClG+qNoVdtBBWfL08N9Oib6g==   dependencies:-    modern-tar "^0.8.0"+    modern-tar "^0.8.6"     yargs "^18.0.0"  "@ungap/structured-clone@^1.2.0":@@ -113,9 +113,9 @@ ansi-regex@^5.0.1:   integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==  ansi-regex@^6.2.2:-  version "6.3.0"-  resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.3.0.tgz#247c8e7b70a1a43b10ce14c0226fcbf58e8815d5"-  integrity sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==+  version "6.6.0"+  resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.6.0.tgz#268bc9253164768541ca6bebee112c83be2c67f2"+  integrity sha512-XZ5apbzreCbXSKwPjJstu8R0zOi247w3XYwWxtwBXgpZrCyc1Ka7p9/xY0A9/diMewmHbEKz+FIraWaEWjlN5g==  ansi-styles@^4.1.0:   version "4.3.0"@@ -177,13 +177,13 @@ chalk@^4.0.0:     ansi-styles "^4.1.0"     supports-color "^7.1.0" -chromium-bidi@17.0.2:-  version "17.0.2"-  resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-17.0.2.tgz#921a586deecd0c2d8b9242c4c1b73c3aa39ff77c"-  integrity sha512-5v9GQFhTktFvotn/OFNJBmKLKRAb6n9r0bVCwf7sHgWc3/JryK0bj1nn93L3pHFrfgcsu6Be6EWsDi+1XHTGDg==+chromium-bidi@157.0.8090-0:+  version "157.0.8090-0"+  resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-157.0.8090-0.tgz#268391b6003612221d899a71ab896ddb0a9dd432"+  integrity sha512-KJw7IQgqXwxpJgJlEIPg5mr2ZoqA+jkTRtc5EABI7sUJ3bu3cpI7NuEBoj4Gn1AsF78CaT9So5WQWspK3/wYag==   dependencies:     mitt "^3.0.1"-    zod "^3.24.1"+    zod "^4.6.5"  cliui@^9.0.1:   version "9.0.1"@@ -237,10 +237,10 @@ deep-is@^0.1.3:   resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz"   integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -devtools-protocol@0.0.1666840:-  version "0.0.1666840"-  resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1666840.tgz#796cbc307f82750afc13a3b471c829bf3da19a65"-  integrity sha512-gCcO42XCHKEs7Ag0S7aGYsnJ7hlgrO3qderYqeiY0Eqk+0GFfuvT13IA0hHreJTa2KCdDVyGMeOhdMNmrrTjVg==+devtools-protocol@0.0.1724436:+  version "0.0.1724436"+  resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1724436.tgz#8a8fb2c7d07b5d78f225b033b7f70642a05969ce"+  integrity sha512-GcO1782pvzpmY4pQO1zjr8WZ95Wv8GodOs0v5J9QWwLGulTzfYIYECEd9iUsnqJmcehu+VMKxZquvjY8T2jhAA==  doctrine@^3.0.0:   version "3.0.0"@@ -442,9 +442,9 @@ get-caller-file@^2.0.5:   integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==  get-east-asian-width@^1.0.0, get-east-asian-width@^1.5.0:-  version "1.6.0"-  resolved "https://registry.yarnpkg.com/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz#216900f91df11a8b2c198c3e1d93d6c035a776b9"-  integrity sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==+  version "1.7.0"+  resolved "https://registry.yarnpkg.com/get-east-asian-width/-/get-east-asian-width-1.7.0.tgz#7ee99f0bd5ab7c622002deeabba232923726d1d4"+  integrity sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==  glob-parent@^5.1.2:   version "5.1.2"@@ -584,10 +584,10 @@ levn@^0.4.1:     prelude-ls "^1.2.1"     type-check "~0.4.0" -lilconfig@^3.1.3:-  version "3.1.3"-  resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.3.tgz#a1bcfd6257f9585bf5ae14ceeebb7b559025e4c4"-  integrity sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==+lilconfig@^3.1.5:+  version "3.1.5"+  resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.5.tgz#7c9342a74d602bb15c0a1ca67f2c99be056c4656"+  integrity sha512-aRAOI9Ia43ygL4o1EOmC/sc/0OFxrm7qcQngiIyWaqVnSnz932ybJ07zyCcgMNGSDP8Yxaf88Xj1zHEXmvQ4SA==  locate-path@^6.0.0:   version "6.0.0"@@ -626,10 +626,10 @@ mitt@^3.0.1:   resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1"   integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw== -modern-tar@^0.8.0:-  version "0.8.4"-  resolved "https://registry.yarnpkg.com/modern-tar/-/modern-tar-0.8.4.tgz#25d2de2f522250012f33a3b366400b49741f6b8e"-  integrity sha512-gN54ddmyzEg10orwZ2u4OOv+bjpMWdIl5jIkodK97bMq8QBSL5c0D7YX0lT1Ooz+99S7+PvFbnxzdjgHo1r41g==+modern-tar@^0.8.6:+  version "0.8.7"+  resolved "https://registry.yarnpkg.com/modern-tar/-/modern-tar-0.8.7.tgz#17851bd0bd3999c1a41ac1625e98ac8faef5ff6e"+  integrity sha512-q17gyzLiCw2wf/Rcl5c3EA5ynB2hOHb5+qMpbaILOQBaTiBx9bumfXC5sMk0wQrVoLtlBhW77dJTnLArlczsGg==  ms@^2.1.3:   version "2.1.3"@@ -716,29 +716,29 @@ punycode@^2.1.0:   resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz"   integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -puppeteer-core@25.7.0:-  version "25.7.0"-  resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-25.7.0.tgz#e1a31698ec4646ecf891de42636d6f6405945625"-  integrity sha512-wgBBj7dU5ceGyoT2PCrJpkYOhxPY8mDOmcSKZP92Cj5GgqQ3kv/UxzawnOLxiYuupe4bDf/yiQm3bzs/1nI0rQ==+puppeteer-core@25.19.0:+  version "25.19.0"+  resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-25.19.0.tgz#1869ccb8c085787f3b13b936a4bef94bb877238c"+  integrity sha512-F4pw8kpSczJS3TCHBw7/qskDxv4cMj09oOv7BwhHGYOerxLF1Sk2t4tpWlLvy6Vx/mM6TuqkDj4j0j3PRN1FiA==   dependencies:-    "@puppeteer/browsers" "3.2.0"-    chromium-bidi "17.0.2"-    devtools-protocol "0.0.1666840"-    typed-query-selector "^2.12.2"-    webdriver-bidi-protocol "0.4.2"-    ws "^8.21.1"+    "@puppeteer/browsers" "3.3.0"+    chromium-bidi "157.0.8090-0"+    devtools-protocol "0.0.1724436"+    typed-query-selector "^2.12.3"+    webdriver-bidi-protocol "1.0.2"+    ws "^8.23.0"  puppeteer@^25.1.0:-  version "25.7.0"-  resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-25.7.0.tgz#4536e40b3685309b9f8444860d237d6be3484c83"-  integrity sha512-zLBIYuW66SGwY7JNqGmiqeKiM92CYOs6xPibSRBPIeYGIfM1nE/8VCE8G0fGot2EfXENC4PbhktxLrQ0EK5Thg==+  version "25.19.0"+  resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-25.19.0.tgz#5f6bd83c19671325a985122551dea819b65c3cbc"+  integrity sha512-38yJg6bAi6TOfQr/UTKllIVfm5zMWxBzURETCF3mzSylKQr9yUMyLz7YMl2yJCgfkJfhRl+j0qeKtm++X4J68w==   dependencies:-    "@puppeteer/browsers" "3.2.0"-    chromium-bidi "17.0.2"-    devtools-protocol "0.0.1666840"-    lilconfig "^3.1.3"-    puppeteer-core "25.7.0"-    typed-query-selector "^2.12.2"+    "@puppeteer/browsers" "3.3.0"+    chromium-bidi "157.0.8090-0"+    devtools-protocol "0.0.1724436"+    lilconfig "^3.1.5"+    puppeteer-core "25.19.0"+    typed-query-selector "^2.12.3"  queue-microtask@^1.2.2:   version "1.2.3"@@ -796,9 +796,9 @@ string-width@^7.0.0, string-width@^7.2.0:     strip-ansi "^7.1.0"  string-width@^8.2.1:-  version "8.2.2"-  resolved "https://registry.yarnpkg.com/string-width/-/string-width-8.2.2.tgz#7310516493df575742fe98af6fae87d85d5ed0ac"-  integrity sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==+  version "8.3.0"+  resolved "https://registry.yarnpkg.com/string-width/-/string-width-8.3.0.tgz#f1e85ca6d276ed9226c979c3651fb7abf548fbbe"+  integrity sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ==   dependencies:     get-east-asian-width "^1.5.0"     strip-ansi "^7.1.2"@@ -853,10 +853,10 @@ type-fest@^0.20.2:   resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz"   integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== -typed-query-selector@^2.12.2:-  version "2.12.2"-  resolved "https://registry.yarnpkg.com/typed-query-selector/-/typed-query-selector-2.12.2.tgz#65e2462ac6b0aecfae1bfac1a4f3027070dbabaa"-  integrity sha512-EOPFbyIub4ngnEdqi2yOcNeDLaX/0jcE1JoAXQDDMIthap7FoN795lc/SHfIq2d416VufXpM8z/lD+WRm2gfOQ==+typed-query-selector@^2.12.3:+  version "2.12.4"+  resolved "https://registry.yarnpkg.com/typed-query-selector/-/typed-query-selector-2.12.4.tgz#80517ab8f94c7000c08009e6d56f22d3c06d1176"+  integrity sha512-lF6/OY655DSWZeuNovde8TZhju6QyC0Xtav57b07oZQ1EQvfSowA3+WfLEhvFJOc9sVfAtW5hie1lGIppOqbpQ==  typescript@^5.8.3:   version "5.9.3"@@ -870,10 +870,10 @@ uri-js@^4.2.2:   dependencies:     punycode "^2.1.0" -webdriver-bidi-protocol@0.4.2:-  version "0.4.2"-  resolved "https://registry.yarnpkg.com/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.2.tgz#f51bb71c2606e90e3d5727607c728b25d617b58b"-  integrity sha512-VSV+fzfChirL3e7jay2yUC7B4HQCGtEWEg/MSSQbK+qWbqeGlRLlXTzPpYr3XGUvbpDHumWZBJxgesg4N7dbtA==+webdriver-bidi-protocol@1.0.2:+  version "1.0.2"+  resolved "https://registry.yarnpkg.com/webdriver-bidi-protocol/-/webdriver-bidi-protocol-1.0.2.tgz#237f16aa10bd93b22d0dfa32103b4fcc115589d3"+  integrity sha512-nghazPI+J5RrLZ+qb6vMjC6l1/tnwqr2muVEax4Ufd6eIdcjeqNnhLsAxTG9s+7Zf4umgf0DrEwDC8CoU91nAA==  which@^2.0.1:   version "2.0.2"@@ -901,10 +901,10 @@ wrappy@1:   resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"   integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@^8.21.1:-  version "8.21.3"-  resolved "https://registry.yarnpkg.com/ws/-/ws-8.21.3.tgz#660b4faddb6a3e575c86e078126919961f4de4fc"-  integrity sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==+ws@^8.23.0:+  version "8.23.1"+  resolved "https://registry.yarnpkg.com/ws/-/ws-8.23.1.tgz#7e32c1948f0a77872fa2fd0580970683986b5fdc"+  integrity sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA==  y18n@^5.0.5:   version "5.0.8"@@ -917,9 +917,9 @@ yargs-parser@^22.0.0:   integrity sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==  yargs@^18.0.0:-  version "18.1.0"-  resolved "https://registry.yarnpkg.com/yargs/-/yargs-18.1.0.tgz#cd7e98c703ef51695bbbf062ed58f28e94291b56"-  integrity sha512-2rAgRKu54VsHkqI0/tYkmluGXHD4KW7yZoycuqDQ15QOTnc2VVfy0nN/1eMhnQLO00A+dwtK20xuCnc1YGeUyg==+  version "18.2.0"+  resolved "https://registry.yarnpkg.com/yargs/-/yargs-18.2.0.tgz#c258276baa935fe8fb911d986067f6d0733e8608"+  integrity sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w==   dependencies:     cliui "^9.0.1"     escalade "^3.1.1"@@ -933,7 +933,7 @@ yocto-queue@^0.1.0:   resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz"   integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -zod@^3.24.1:-  version "3.25.76"-  resolved "https://registry.yarnpkg.com/zod/-/zod-3.25.76.tgz#26841c3f6fd22a6a2760e7ccb719179768471e34"-  integrity sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==+zod@^4.6.5:+  version "4.6.7"+  resolved "https://registry.yarnpkg.com/zod/-/zod-4.6.7.tgz#e806cf64a7f4e37635ce9f2f52c04c3766f75e5b"+  integrity sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==