diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 5a985be08a133..4141d952683ef 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -41,7 +41,7 @@ use rustc_index::vec::Idx; use rustc_middle::lint::{in_external_macro, LintDiagnosticBuilder}; use rustc_middle::ty::layout::{LayoutError, LayoutOf}; use rustc_middle::ty::print::with_no_trimmed_paths; -use rustc_middle::ty::subst::{GenericArgKind, Subst}; +use rustc_middle::ty::subst::GenericArgKind; use rustc_middle::ty::Instance; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason}; @@ -2777,7 +2777,7 @@ impl ClashingExternDeclarations { let mut ty = ty; loop { if let ty::Adt(def, substs) = *ty.kind() { - let is_transparent = def.subst(tcx, substs).repr().transparent(); + let is_transparent = def.repr().transparent(); let is_non_null = crate::types::nonnull_optimization_guaranteed(tcx, def); debug!( "non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}", @@ -2837,11 +2837,7 @@ impl ClashingExternDeclarations { ensure_sufficient_stack(|| { match (a_kind, b_kind) { - (Adt(a_def, a_substs), Adt(b_def, b_substs)) => { - let a = a.subst(cx.tcx, a_substs); - let b = b.subst(cx.tcx, b_substs); - debug!("Comparing {:?} and {:?}", a, b); - + (Adt(a_def, _), Adt(b_def, _)) => { // We can immediately rule out these types as structurally same if // their layouts differ. match compare_layouts(a, b) { diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs index 6d78a863d54cf..a83924d4636c5 100644 --- a/compiler/rustc_typeck/src/check/compare_method.rs +++ b/compiler/rustc_typeck/src/check/compare_method.rs @@ -7,10 +7,10 @@ use rustc_hir::intravisit; use rustc_hir::{GenericParamKind, ImplItemKind, TraitItemKind}; use rustc_infer::infer::{self, InferOk, TyCtxtInferExt}; use rustc_infer::traits::util; -use rustc_middle::ty; use rustc_middle::ty::error::{ExpectedFound, TypeError}; use rustc_middle::ty::subst::{InternalSubsts, Subst}; use rustc_middle::ty::util::ExplicitSelf; +use rustc_middle::ty::{self, DefIdTree}; use rustc_middle::ty::{GenericParamDefKind, ToPredicate, TyCtxt}; use rustc_span::Span; use rustc_trait_selection::traits::error_reporting::InferCtxtExt; @@ -48,6 +48,10 @@ crate fn compare_impl_method<'tcx>( return; } + if let Err(_) = compare_generic_param_kinds(tcx, impl_m, trait_m) { + return; + } + if let Err(_) = compare_number_of_method_arguments(tcx, impl_m, impl_m_span, trait_m, trait_item_span) { @@ -62,10 +66,6 @@ crate fn compare_impl_method<'tcx>( { return; } - - if let Err(_) = compare_const_param_types(tcx, impl_m, trait_m, trait_item_span) { - return; - } } fn compare_predicate_entailment<'tcx>( @@ -579,6 +579,27 @@ fn compare_self_type<'tcx>( Ok(()) } +/// Checks that the number of generics on a given assoc item in a trait impl is the same +/// as the number of generics on the respective assoc item in the trait definition. +/// +/// For example this code emits the errors in the following code: +/// ``` +/// trait Trait { +/// fn foo(); +/// type Assoc; +/// } +/// +/// impl Trait for () { +/// fn foo() {} +/// //~^ error +/// type Assoc = u32; +/// //~^ error +/// } +/// ``` +/// +/// Notably this does not error on `foo` implemented as `foo` or +/// `foo` implemented as `foo`. This is handled in +/// [`compare_generic_param_kinds`]. This function also does not handle lifetime parameters fn compare_number_of_generics<'tcx>( tcx: TyCtxt<'tcx>, impl_: &ty::AssocItem, @@ -589,6 +610,15 @@ fn compare_number_of_generics<'tcx>( let trait_own_counts = tcx.generics_of(trait_.def_id).own_counts(); let impl_own_counts = tcx.generics_of(impl_.def_id).own_counts(); + // This avoids us erroring on `foo` implemented as `foo` as this is implemented + // in `compare_generic_param_kinds` which will give a nicer error message than something like: + // "expected 1 type parameter, found 0 type parameters" + if (trait_own_counts.types + trait_own_counts.consts) + == (impl_own_counts.types + impl_own_counts.consts) + { + return Ok(()); + } + let matchings = [ ("type", trait_own_counts.types, impl_own_counts.types), ("const", trait_own_counts.consts, impl_own_counts.consts), @@ -914,60 +944,93 @@ fn compare_synthetic_generics<'tcx>( if let Some(reported) = error_found { Err(reported) } else { Ok(()) } } -fn compare_const_param_types<'tcx>( +/// Checks that all parameters in the generics of a given assoc item in a trait impl have +/// the same kind as the respective generic parameter in the trait def. +/// +/// For example all 4 errors in the following code are emitted here: +/// ``` +/// trait Foo { +/// fn foo(); +/// type bar; +/// fn baz(); +/// type blah; +/// } +/// +/// impl Foo for () { +/// fn foo() {} +/// //~^ error +/// type bar {} +/// //~^ error +/// fn baz() {} +/// //~^ error +/// type blah = u32; +/// //~^ error +/// } +/// ``` +/// +/// This function does not handle lifetime parameters +fn compare_generic_param_kinds<'tcx>( tcx: TyCtxt<'tcx>, - impl_m: &ty::AssocItem, - trait_m: &ty::AssocItem, - trait_item_span: Option, + impl_item: &ty::AssocItem, + trait_item: &ty::AssocItem, ) -> Result<(), ErrorGuaranteed> { - let const_params_of = |def_id| { - tcx.generics_of(def_id).params.iter().filter_map(|param| match param.kind { - GenericParamDefKind::Const { .. } => Some(param.def_id), - _ => None, + assert_eq!(impl_item.kind, trait_item.kind); + + let ty_const_params_of = |def_id| { + tcx.generics_of(def_id).params.iter().filter(|param| { + matches!( + param.kind, + GenericParamDefKind::Const { .. } | GenericParamDefKind::Type { .. } + ) }) }; - let const_params_impl = const_params_of(impl_m.def_id); - let const_params_trait = const_params_of(trait_m.def_id); - - for (const_param_impl, const_param_trait) in iter::zip(const_params_impl, const_params_trait) { - let impl_ty = tcx.type_of(const_param_impl); - let trait_ty = tcx.type_of(const_param_trait); - if impl_ty != trait_ty { - let (impl_span, impl_ident) = match tcx.hir().get_if_local(const_param_impl) { - Some(hir::Node::GenericParam(hir::GenericParam { span, name, .. })) => ( - span, - match name { - hir::ParamName::Plain(ident) => Some(ident), - _ => None, - }, - ), - other => bug!( - "expected GenericParam, found {:?}", - other.map_or_else(|| "nothing".to_string(), |n| format!("{:?}", n)) - ), - }; - let trait_span = match tcx.hir().get_if_local(const_param_trait) { - Some(hir::Node::GenericParam(hir::GenericParam { span, .. })) => Some(span), - _ => None, - }; + + for (param_impl, param_trait) in + iter::zip(ty_const_params_of(impl_item.def_id), ty_const_params_of(trait_item.def_id)) + { + use GenericParamDefKind::*; + if match (¶m_impl.kind, ¶m_trait.kind) { + (Const { .. }, Const { .. }) + if tcx.type_of(param_impl.def_id) != tcx.type_of(param_trait.def_id) => + { + true + } + (Const { .. }, Type { .. }) | (Type { .. }, Const { .. }) => true, + // this is exhaustive so that anyone adding new generic param kinds knows + // to make sure this error is reported for them. + (Const { .. }, Const { .. }) | (Type { .. }, Type { .. }) => false, + (Lifetime { .. }, _) | (_, Lifetime { .. }) => unreachable!(), + } { + let param_impl_span = tcx.def_span(param_impl.def_id); + let param_trait_span = tcx.def_span(param_trait.def_id); + let mut err = struct_span_err!( tcx.sess, - *impl_span, + param_impl_span, E0053, - "method `{}` has an incompatible const parameter type for trait", - trait_m.name - ); - err.span_note( - trait_span.map_or_else(|| trait_item_span.unwrap_or(*impl_span), |span| *span), - &format!( - "the const parameter{} has type `{}`, but the declaration \ - in trait `{}` has type `{}`", - &impl_ident.map_or_else(|| "".to_string(), |ident| format!(" `{ident}`")), - impl_ty, - tcx.def_path_str(trait_m.def_id), - trait_ty - ), + "{} `{}` has an incompatible generic parameter for trait `{}`", + assoc_item_kind_str(&impl_item), + trait_item.name, + &tcx.def_path_str(tcx.parent(trait_item.def_id)) ); + + let make_param_message = |prefix: &str, param: &ty::GenericParamDef| match param.kind { + Const { .. } => { + format!("{} const parameter of type `{}`", prefix, tcx.type_of(param.def_id)) + } + Type { .. } => format!("{} type parameter", prefix), + Lifetime { .. } => unreachable!(), + }; + + let trait_header_span = tcx.def_ident_span(tcx.parent(trait_item.def_id)).unwrap(); + err.span_label(trait_header_span, ""); + err.span_label(param_trait_span, make_param_message("expected", param_trait)); + + let impl_header_span = + tcx.sess.source_map().guess_head_span(tcx.def_span(tcx.parent(impl_item.def_id))); + err.span_label(impl_header_span, ""); + err.span_label(param_impl_span, make_param_message("found", param_impl)); + let reported = err.emit(); return Err(reported); } @@ -1095,6 +1158,8 @@ crate fn compare_ty_impl<'tcx>( let _: Result<(), ErrorGuaranteed> = (|| { compare_number_of_generics(tcx, impl_ty, impl_ty_span, trait_ty, trait_item_span)?; + compare_generic_param_kinds(tcx, impl_ty, trait_ty)?; + let sp = tcx.def_span(impl_ty.def_id); compare_type_predicate_entailment(tcx, impl_ty, sp, trait_ty, impl_trait_ref)?; diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index e38368790e69a..977714281fbbe 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -12,7 +12,7 @@ use crate::collections::TryReserveErrorKind; use crate::fmt::{self, Debug}; #[allow(deprecated)] use crate::hash::{BuildHasher, Hash, Hasher, SipHasher13}; -use crate::iter::{FromIterator, FusedIterator}; +use crate::iter::FusedIterator; use crate::ops::Index; use crate::sys; diff --git a/library/std/src/collections/hash/set.rs b/library/std/src/collections/hash/set.rs index fa471a3c3f323..13bba0a6fd892 100644 --- a/library/std/src/collections/hash/set.rs +++ b/library/std/src/collections/hash/set.rs @@ -7,7 +7,7 @@ use crate::borrow::Borrow; use crate::collections::TryReserveError; use crate::fmt; use crate::hash::{BuildHasher, Hash}; -use crate::iter::{Chain, FromIterator, FusedIterator}; +use crate::iter::{Chain, FusedIterator}; use crate::ops::{BitAnd, BitOr, BitXor, Sub}; use super::map::{map_try_reserve_error, RandomState}; diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index 9b5e5d6c0cc4b..ae13275e4b35d 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -6,7 +6,7 @@ use crate::cmp; use crate::collections::TryReserveError; use crate::fmt; use crate::hash::{Hash, Hasher}; -use crate::iter::{Extend, FromIterator}; +use crate::iter::Extend; use crate::ops; use crate::rc::Rc; use crate::str::FromStr; diff --git a/library/std/src/io/cursor.rs b/library/std/src/io/cursor.rs index 57f1d628f6ad9..0ce6ae00ee250 100644 --- a/library/std/src/io/cursor.rs +++ b/library/std/src/io/cursor.rs @@ -7,8 +7,6 @@ use crate::alloc::Allocator; use crate::cmp; use crate::io::{self, ErrorKind, IoSlice, IoSliceMut, ReadBuf, SeekFrom}; -use core::convert::TryInto; - /// A `Cursor` wraps an in-memory buffer and provides it with a /// [`Seek`] implementation. /// diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index cd2197fca350e..94812e3fe3b2c 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -252,7 +252,6 @@ mod tests; use crate::cmp; -use crate::convert::TryInto; use crate::fmt; use crate::mem::replace; use crate::ops::{Deref, DerefMut}; diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 8ee50925f85f8..6dc3fd9858451 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -343,7 +343,7 @@ // to import the prelude implicitly when building crates that depend on std. #[prelude_import] #[allow(unused)] -use prelude::v1::*; +use prelude::rust_2021::*; // Access to Bencher, etc. #[cfg(test)] diff --git a/library/std/src/net/addr.rs b/library/std/src/net/addr.rs index 201cbf3f08d28..81dd042425c1d 100644 --- a/library/std/src/net/addr.rs +++ b/library/std/src/net/addr.rs @@ -2,7 +2,6 @@ mod tests; use crate::cmp::Ordering; -use crate::convert::TryInto; use crate::fmt; use crate::hash; use crate::io::{self, Write}; diff --git a/library/std/src/net/parser.rs b/library/std/src/net/parser.rs index fb292ed29a18a..069b660998559 100644 --- a/library/std/src/net/parser.rs +++ b/library/std/src/net/parser.rs @@ -6,7 +6,6 @@ #[cfg(test)] mod tests; -use crate::convert::TryInto as _; use crate::error::Error; use crate::fmt; use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; diff --git a/library/std/src/os/unix/net/ancillary.rs b/library/std/src/os/unix/net/ancillary.rs index 658c79896eb2e..9e31b8b32a197 100644 --- a/library/std/src/os/unix/net/ancillary.rs +++ b/library/std/src/os/unix/net/ancillary.rs @@ -1,5 +1,4 @@ use super::{sockaddr_un, SocketAddr}; -use crate::convert::TryFrom; use crate::io::{self, IoSlice, IoSliceMut}; use crate::marker::PhantomData; use crate::mem::{size_of, zeroed}; diff --git a/library/std/src/os/unix/net/tests.rs b/library/std/src/os/unix/net/tests.rs index aa0df61c1920d..c1f11c56b8f65 100644 --- a/library/std/src/os/unix/net/tests.rs +++ b/library/std/src/os/unix/net/tests.rs @@ -10,7 +10,6 @@ use crate::io::{self, ErrorKind, IoSlice, IoSliceMut}; target_os = "netbsd", target_os = "openbsd", ))] -use crate::iter::FromIterator; #[cfg(any( target_os = "android", target_os = "dragonfly", diff --git a/library/std/src/os/windows/io/handle.rs b/library/std/src/os/windows/io/handle.rs index f3d7be3f95c6b..41758f2ced111 100644 --- a/library/std/src/os/windows/io/handle.rs +++ b/library/std/src/os/windows/io/handle.rs @@ -3,7 +3,6 @@ #![unstable(feature = "io_safety", issue = "87074")] use super::raw::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle}; -use crate::convert::TryFrom; use crate::fmt; use crate::fs; use crate::io; diff --git a/library/std/src/os/windows/process.rs b/library/std/src/os/windows/process.rs index e189630991436..1c7e361c2a4a8 100644 --- a/library/std/src/os/windows/process.rs +++ b/library/std/src/os/windows/process.rs @@ -180,3 +180,17 @@ impl CommandExt for process::Command { self } } + +#[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")] +pub trait ChildExt: Sealed { + /// Extracts the main thread raw handle, without taking ownership + #[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")] + fn main_thread_handle(&self) -> BorrowedHandle<'_>; +} + +#[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")] +impl ChildExt for process::Child { + fn main_thread_handle(&self) -> BorrowedHandle<'_> { + self.handle.main_thread_handle() + } +} diff --git a/library/std/src/sys/hermit/net.rs b/library/std/src/sys/hermit/net.rs index f65fd8e53bdc9..74547617150b0 100644 --- a/library/std/src/sys/hermit/net.rs +++ b/library/std/src/sys/hermit/net.rs @@ -1,4 +1,3 @@ -use crate::convert::TryFrom; use crate::fmt; use crate::io::{self, ErrorKind, IoSlice, IoSliceMut}; use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; diff --git a/library/std/src/sys/hermit/time.rs b/library/std/src/sys/hermit/time.rs index 27173de630729..c17e6c8af6276 100644 --- a/library/std/src/sys/hermit/time.rs +++ b/library/std/src/sys/hermit/time.rs @@ -1,7 +1,6 @@ #![allow(dead_code)] use crate::cmp::Ordering; -use crate::convert::TryInto; use crate::sys::hermit::abi; use crate::sys::hermit::abi::timespec; use crate::sys::hermit::abi::{CLOCK_MONOTONIC, CLOCK_REALTIME, NSEC_PER_SEC}; diff --git a/library/std/src/sys/itron/spin.rs b/library/std/src/sys/itron/spin.rs index d0149d1f037db..44d409444bca4 100644 --- a/library/std/src/sys/itron/spin.rs +++ b/library/std/src/sys/itron/spin.rs @@ -1,7 +1,6 @@ use super::abi; use crate::{ cell::UnsafeCell, - convert::TryFrom, mem::MaybeUninit, sync::atomic::{AtomicBool, AtomicUsize, Ordering}, }; diff --git a/library/std/src/sys/itron/thread.rs b/library/std/src/sys/itron/thread.rs index 5b718a460dfa9..d28f57f33be20 100644 --- a/library/std/src/sys/itron/thread.rs +++ b/library/std/src/sys/itron/thread.rs @@ -8,7 +8,6 @@ use super::{ }; use crate::{ cell::UnsafeCell, - convert::TryFrom, ffi::CStr, hint, io, mem::ManuallyDrop, diff --git a/library/std/src/sys/itron/time.rs b/library/std/src/sys/itron/time.rs index 25f13ee441aca..427ea0d80e107 100644 --- a/library/std/src/sys/itron/time.rs +++ b/library/std/src/sys/itron/time.rs @@ -1,5 +1,5 @@ use super::{abi, error::expect_success}; -use crate::{convert::TryInto, mem::MaybeUninit, time::Duration}; +use crate::{mem::MaybeUninit, time::Duration}; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] pub struct Instant(abi::SYSTIM); diff --git a/library/std/src/sys/sgx/abi/usercalls/mod.rs b/library/std/src/sys/sgx/abi/usercalls/mod.rs index 4030355f13518..2f99abba77667 100644 --- a/library/std/src/sys/sgx/abi/usercalls/mod.rs +++ b/library/std/src/sys/sgx/abi/usercalls/mod.rs @@ -1,5 +1,4 @@ use crate::cmp; -use crate::convert::TryFrom; use crate::io::{Error as IoError, ErrorKind, IoSlice, IoSliceMut, Result as IoResult}; use crate::sys::rand::rdrand64; use crate::time::{Duration, Instant}; diff --git a/library/std/src/sys/sgx/net.rs b/library/std/src/sys/sgx/net.rs index feb0b62dcd1f7..1d899525081b9 100644 --- a/library/std/src/sys/sgx/net.rs +++ b/library/std/src/sys/sgx/net.rs @@ -1,4 +1,3 @@ -use crate::convert::TryFrom; use crate::error; use crate::fmt; use crate::io::{self, IoSlice, IoSliceMut}; diff --git a/library/std/src/sys/solid/time.rs b/library/std/src/sys/solid/time.rs index ab988be24442a..ce31cb45a69a1 100644 --- a/library/std/src/sys/solid/time.rs +++ b/library/std/src/sys/solid/time.rs @@ -1,5 +1,5 @@ use super::{abi, error::expect_success}; -use crate::{convert::TryInto, mem::MaybeUninit, time::Duration}; +use crate::{mem::MaybeUninit, time::Duration}; pub use super::itron::time::Instant; diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 61fb2814018e0..5d0fb07900326 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -943,7 +943,6 @@ impl File { } pub fn truncate(&self, size: u64) -> io::Result<()> { - use crate::convert::TryInto; let size: off64_t = size.try_into().map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?; cvt_r(|| unsafe { ftruncate64(self.as_raw_fd(), size) }).map(drop) diff --git a/library/std/src/sys/unix/futex.rs b/library/std/src/sys/unix/futex.rs index c1966d6707856..8d5ad18997d07 100644 --- a/library/std/src/sys/unix/futex.rs +++ b/library/std/src/sys/unix/futex.rs @@ -136,7 +136,6 @@ pub fn futex_wake_all(futex: &AtomicU32) { #[cfg(target_os = "openbsd")] pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option) -> bool { - use crate::convert::TryInto; use crate::ptr::{null, null_mut}; let timespec = timeout.and_then(|d| { Some(libc::timespec { @@ -185,8 +184,6 @@ pub fn futex_wake_all(futex: &AtomicU32) { #[cfg(target_os = "dragonfly")] pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option) -> bool { - use crate::convert::TryFrom; - // A timeout of 0 means infinite. // We round smaller timeouts up to 1 millisecond. // Overflows are rounded up to an infinite timeout. diff --git a/library/std/src/sys/unix/kernel_copy.rs b/library/std/src/sys/unix/kernel_copy.rs index e85e4c5d618ce..8f7abb55e2376 100644 --- a/library/std/src/sys/unix/kernel_copy.rs +++ b/library/std/src/sys/unix/kernel_copy.rs @@ -45,7 +45,6 @@ //! * complexity use crate::cmp::min; -use crate::convert::TryInto; use crate::fs::{File, Metadata}; use crate::io::copy::generic_copy; use crate::io::{ diff --git a/library/std/src/sys/unix/l4re.rs b/library/std/src/sys/unix/l4re.rs index f052d8f7f055f..9967588939ac9 100644 --- a/library/std/src/sys/unix/l4re.rs +++ b/library/std/src/sys/unix/l4re.rs @@ -9,7 +9,6 @@ macro_rules! unimpl { pub mod net { #![allow(warnings)] - use crate::convert::TryFrom; use crate::fmt; use crate::io::{self, IoSlice, IoSliceMut}; use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; diff --git a/library/std/src/sys/unix/process/process_fuchsia.rs b/library/std/src/sys/unix/process/process_fuchsia.rs index e3347ab12a730..73f5d3a618bad 100644 --- a/library/std/src/sys/unix/process/process_fuchsia.rs +++ b/library/std/src/sys/unix/process/process_fuchsia.rs @@ -1,4 +1,3 @@ -use crate::convert::{TryFrom, TryInto}; use crate::fmt; use crate::io; use crate::mem; diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs index d48faaa88fb4f..23bb6d6c15f63 100644 --- a/library/std/src/sys/unix/process/process_unix.rs +++ b/library/std/src/sys/unix/process/process_unix.rs @@ -1,4 +1,3 @@ -use crate::convert::{TryFrom, TryInto}; use crate::fmt; use crate::io::{self, Error, ErrorKind}; use crate::mem; diff --git a/library/std/src/sys/unix/process/process_unsupported.rs b/library/std/src/sys/unix/process/process_unsupported.rs index bbabdf787d994..5db57ee9e9e18 100644 --- a/library/std/src/sys/unix/process/process_unsupported.rs +++ b/library/std/src/sys/unix/process/process_unsupported.rs @@ -1,4 +1,3 @@ -use crate::convert::{TryFrom, TryInto}; use crate::fmt; use crate::io; use crate::io::ErrorKind; diff --git a/library/std/src/sys/unix/process/process_vxworks.rs b/library/std/src/sys/unix/process/process_vxworks.rs index 016bc20ec0a47..200ef67196798 100644 --- a/library/std/src/sys/unix/process/process_vxworks.rs +++ b/library/std/src/sys/unix/process/process_vxworks.rs @@ -1,4 +1,3 @@ -use crate::convert::{TryFrom, TryInto}; use crate::fmt; use crate::io::{self, Error, ErrorKind}; use crate::num::NonZeroI32; diff --git a/library/std/src/sys/unix/process/zircon.rs b/library/std/src/sys/unix/process/zircon.rs index 4dfa2b4ff1eb4..2e596486f9c86 100644 --- a/library/std/src/sys/unix/process/zircon.rs +++ b/library/std/src/sys/unix/process/zircon.rs @@ -1,6 +1,5 @@ #![allow(non_camel_case_types, unused)] -use crate::convert::TryInto; use crate::io; use crate::mem::MaybeUninit; use crate::os::raw::c_char; diff --git a/library/std/src/sys/unix/time.rs b/library/std/src/sys/unix/time.rs index ac8355188bb3c..333182bdad4de 100644 --- a/library/std/src/sys/unix/time.rs +++ b/library/std/src/sys/unix/time.rs @@ -2,7 +2,6 @@ use crate::fmt; use crate::time::Duration; pub use self::inner::Instant; -use crate::convert::TryInto; const NSEC_PER_SEC: u64 = 1_000_000_000; pub const UNIX_EPOCH: SystemTime = SystemTime { t: Timespec::zero() }; @@ -127,7 +126,6 @@ impl Timespec { } pub fn to_timespec(&self) -> Option { - use crate::convert::TryInto; Some(libc::timespec { tv_sec: self.tv_sec.try_into().ok()?, tv_nsec: self.tv_nsec.try_into().ok()?, diff --git a/library/std/src/sys/unsupported/net.rs b/library/std/src/sys/unsupported/net.rs index dbb6ce22c22de..360115d503374 100644 --- a/library/std/src/sys/unsupported/net.rs +++ b/library/std/src/sys/unsupported/net.rs @@ -1,4 +1,3 @@ -use crate::convert::TryFrom; use crate::fmt; use crate::io::{self, IoSlice, IoSliceMut}; use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; diff --git a/library/std/src/sys/wasi/net.rs b/library/std/src/sys/wasi/net.rs index c66e0e4d328ad..937b1b850e7ba 100644 --- a/library/std/src/sys/wasi/net.rs +++ b/library/std/src/sys/wasi/net.rs @@ -2,7 +2,6 @@ use super::err2io; use super::fd::WasiFd; -use crate::convert::TryFrom; use crate::fmt; use crate::io::{self, IoSlice, IoSliceMut}; use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; diff --git a/library/std/src/sys/wasm/atomics/futex.rs b/library/std/src/sys/wasm/atomics/futex.rs index 11413ba3bf564..f4fbe9f48554b 100644 --- a/library/std/src/sys/wasm/atomics/futex.rs +++ b/library/std/src/sys/wasm/atomics/futex.rs @@ -1,5 +1,4 @@ use crate::arch::wasm32; -use crate::convert::TryInto; use crate::sync::atomic::AtomicU32; use crate::time::Duration; diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs index 95903899297b6..157d8a044d3cd 100644 --- a/library/std/src/sys/windows/fs.rs +++ b/library/std/src/sys/windows/fs.rs @@ -1,6 +1,5 @@ use crate::os::windows::prelude::*; -use crate::convert::TryInto; use crate::ffi::OsString; use crate::fmt; use crate::io::{self, Error, IoSlice, IoSliceMut, ReadBuf, SeekFrom}; diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs index cc29d1a72fbf4..8e5325b80e4a5 100644 --- a/library/std/src/sys/windows/process.rs +++ b/library/std/src/sys/windows/process.rs @@ -5,7 +5,6 @@ mod tests; use crate::cmp; use crate::collections::BTreeMap; -use crate::convert::{TryFrom, TryInto}; use crate::env; use crate::env::consts::{EXE_EXTENSION, EXE_SUFFIX}; use crate::ffi::{OsStr, OsString}; @@ -14,7 +13,7 @@ use crate::io::{self, Error, ErrorKind}; use crate::mem; use crate::num::NonZeroI32; use crate::os::windows::ffi::{OsStrExt, OsStringExt}; -use crate::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle}; +use crate::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle}; use crate::path::{Path, PathBuf}; use crate::ptr; use crate::sys::args::{self, Arg}; @@ -334,13 +333,14 @@ impl Command { )) }?; - // We close the thread handle because we don't care about keeping - // the thread id valid, and we aren't keeping the thread handle - // around to be able to close it later. unsafe { - drop(Handle::from_raw_handle(pi.hThread)); - - Ok((Process { handle: Handle::from_raw_handle(pi.hProcess) }, pipes)) + Ok(( + Process { + handle: Handle::from_raw_handle(pi.hProcess), + main_thread_handle: Handle::from_raw_handle(pi.hThread), + }, + pipes, + )) } } } @@ -609,6 +609,7 @@ impl From for Stdio { /// for the process to terminate. pub struct Process { handle: Handle, + main_thread_handle: Handle, } impl Process { @@ -621,6 +622,10 @@ impl Process { unsafe { c::GetProcessId(self.handle.as_raw_handle()) as u32 } } + pub fn main_thread_handle(&self) -> BorrowedHandle<'_> { + self.main_thread_handle.as_handle() + } + pub fn wait(&mut self) -> io::Result { unsafe { let res = c::WaitForSingleObject(self.handle.as_raw_handle(), c::INFINITE); diff --git a/library/std/src/sys/windows/process/tests.rs b/library/std/src/sys/windows/process/tests.rs index be3a0f4ed52a9..3fc0c75240c33 100644 --- a/library/std/src/sys/windows/process/tests.rs +++ b/library/std/src/sys/windows/process/tests.rs @@ -24,6 +24,31 @@ fn test_raw_args() { ); } +#[test] +fn test_thread_handle() { + use crate::os::windows::io::BorrowedHandle; + use crate::os::windows::process::{ChildExt, CommandExt}; + const CREATE_SUSPENDED: u32 = 0x00000004; + + let p = Command::new("cmd").args(&["/C", "exit 0"]).creation_flags(CREATE_SUSPENDED).spawn(); + assert!(p.is_ok()); + let mut p = p.unwrap(); + + extern "system" { + fn ResumeThread(_: BorrowedHandle<'_>) -> u32; + } + unsafe { + ResumeThread(p.main_thread_handle()); + } + + crate::thread::sleep(crate::time::Duration::from_millis(100)); + + let res = p.try_wait(); + assert!(res.is_ok()); + assert!(res.unwrap().is_some()); + assert!(p.try_wait().unwrap().unwrap().success()); +} + #[test] fn test_make_command_line() { fn test_wrapper(prog: &str, args: &[&str], force_quotes: bool) -> String { diff --git a/library/std/src/sys/windows/thread.rs b/library/std/src/sys/windows/thread.rs index 2f469513eb4fd..c5c9e97e646fb 100644 --- a/library/std/src/sys/windows/thread.rs +++ b/library/std/src/sys/windows/thread.rs @@ -1,4 +1,3 @@ -use crate::convert::TryInto; use crate::ffi::CStr; use crate::io; use crate::num::NonZeroUsize; diff --git a/library/std/src/sys/windows/thread_parker.rs b/library/std/src/sys/windows/thread_parker.rs index 5144834447503..d876e0f6f3c03 100644 --- a/library/std/src/sys/windows/thread_parker.rs +++ b/library/std/src/sys/windows/thread_parker.rs @@ -57,7 +57,6 @@ // [3]: https://docs.microsoft.com/en-us/archive/msdn-magazine/2012/november/windows-with-c-the-evolution-of-synchronization-in-windows-and-c // [4]: Windows Internals, Part 1, ISBN 9780735671300 -use crate::convert::TryFrom; use crate::pin::Pin; use crate::ptr; use crate::sync::atomic::{ diff --git a/library/std/src/sys/windows/time.rs b/library/std/src/sys/windows/time.rs index a04908b541cdb..8f46781c75340 100644 --- a/library/std/src/sys/windows/time.rs +++ b/library/std/src/sys/windows/time.rs @@ -1,5 +1,4 @@ use crate::cmp::Ordering; -use crate::convert::TryInto; use crate::fmt; use crate::mem; use crate::sys::c; diff --git a/library/std/src/sys_common/net.rs b/library/std/src/sys_common/net.rs index 3b7cdd55a081c..05425f4a3622c 100644 --- a/library/std/src/sys_common/net.rs +++ b/library/std/src/sys_common/net.rs @@ -2,7 +2,6 @@ mod tests; use crate::cmp; -use crate::convert::{TryFrom, TryInto}; use crate::ffi::CString; use crate::fmt; use crate::io::{self, ErrorKind, IoSlice, IoSliceMut}; diff --git a/library/std/src/sys_common/wtf8.rs b/library/std/src/sys_common/wtf8.rs index 7d66973bed6f5..57fa4989358a4 100644 --- a/library/std/src/sys_common/wtf8.rs +++ b/library/std/src/sys_common/wtf8.rs @@ -25,7 +25,7 @@ use crate::char; use crate::collections::TryReserveError; use crate::fmt; use crate::hash::{Hash, Hasher}; -use crate::iter::{FromIterator, FusedIterator}; +use crate::iter::FusedIterator; use crate::mem; use crate::ops; use crate::rc::Rc; diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 677e9b5f03ab2..7754d626e209e 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1323,7 +1323,6 @@ window.initSearch = rawSearchIndex => { } } lev = levenshtein(searchWord, elem.pathLast); - lev += lev_add; if (lev > 0 && elem.pathLast.length > 2 && searchWord.indexOf(elem.pathLast) > -1) { if (elem.pathLast.length < 6) { @@ -1332,6 +1331,7 @@ window.initSearch = rawSearchIndex => { lev = 0; } } + lev += lev_add; if (lev > MAX_LEV_DISTANCE) { return; } else if (index !== -1 && elem.fullPath.length < 2) { diff --git a/src/test/rustdoc-js-std/path-ordering.js b/src/test/rustdoc-js-std/path-ordering.js new file mode 100644 index 0000000000000..7dcdd40231248 --- /dev/null +++ b/src/test/rustdoc-js-std/path-ordering.js @@ -0,0 +1,12 @@ +const QUERY = 'hashset::insert'; + +const EXPECTED = { + 'others': [ + // ensure hashset::insert comes first + { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' }, + { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' }, + ], +}; diff --git a/src/test/rustdoc-js/path-ordering.js b/src/test/rustdoc-js/path-ordering.js new file mode 100644 index 0000000000000..4aee569b0f481 --- /dev/null +++ b/src/test/rustdoc-js/path-ordering.js @@ -0,0 +1,14 @@ +// exact-check + +const QUERY = 'b::ccccccc'; + +const EXPECTED = { + 'others': [ + // `ccccccc` is an exact match for all three of these. + // However `b` is a closer match for `bb` than for any + // of the others, so it ought to go first. + { 'path': 'path_ordering::bb', 'name': 'Ccccccc' }, + { 'path': 'path_ordering::aa', 'name': 'Ccccccc' }, + { 'path': 'path_ordering::dd', 'name': 'Ccccccc' }, + ], +}; diff --git a/src/test/rustdoc-js/path-ordering.rs b/src/test/rustdoc-js/path-ordering.rs new file mode 100644 index 0000000000000..7843cf7f9dc48 --- /dev/null +++ b/src/test/rustdoc-js/path-ordering.rs @@ -0,0 +1,9 @@ +pub mod dd { + pub struct Ccccccc; +} +pub mod aa { + pub struct Ccccccc; +} +pub mod bb { + pub struct Ccccccc; +} diff --git a/src/test/ui/issues/issue-28934.rs b/src/test/ui/borrowck/issue-28934.rs similarity index 100% rename from src/test/ui/issues/issue-28934.rs rename to src/test/ui/borrowck/issue-28934.rs diff --git a/src/test/ui/issues/issue-6801.rs b/src/test/ui/closures/issue-6801.rs similarity index 100% rename from src/test/ui/issues/issue-6801.rs rename to src/test/ui/closures/issue-6801.rs diff --git a/src/test/ui/issues/issue-6801.stderr b/src/test/ui/closures/issue-6801.stderr similarity index 100% rename from src/test/ui/issues/issue-6801.stderr rename to src/test/ui/closures/issue-6801.stderr diff --git a/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.rs b/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.rs new file mode 100644 index 0000000000000..5c9323261a973 --- /dev/null +++ b/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.rs @@ -0,0 +1,41 @@ +trait Trait { + fn foo() {} +} +impl Trait for () { + fn foo() {} + //~^ error: method `foo` has an incompatible generic parameter for trait +} + +trait Other { + fn bar() {} +} +impl Other for () { + fn bar() {} + //~^ error: method `bar` has an incompatible generic parameter for trait +} + +trait Uwu { + fn baz() {} +} +impl Uwu for () { + fn baz() {} + //~^ error: method `baz` has an incompatible generic parameter for trait +} + +trait Aaaaaa { + fn bbbb() {} +} +impl Aaaaaa for () { + fn bbbb() {} + //~^ error: method `bbbb` has an incompatible generic parameter for trait +} + +trait Names { + fn abcd() {} +} +impl Names for () { + fn abcd() {} + //~^ error: method `abcd` has an incompatible generic parameter for trait +} + +fn main() {} diff --git a/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.stderr b/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.stderr new file mode 100644 index 0000000000000..3455f2c8ea97b --- /dev/null +++ b/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.stderr @@ -0,0 +1,68 @@ +error[E0053]: method `foo` has an incompatible generic parameter for trait `Trait` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:5:12 + | +LL | trait Trait { + | ----- +LL | fn foo() {} + | - expected type parameter +LL | } +LL | impl Trait for () { + | ----------------- +LL | fn foo() {} + | ^^^^^^^^^^^^ found const parameter of type `u64` + +error[E0053]: method `bar` has an incompatible generic parameter for trait `Other` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:13:12 + | +LL | trait Other { + | ----- +LL | fn bar() {} + | ----------- expected const parameter of type `u8` +LL | } +LL | impl Other for () { + | ----------------- +LL | fn bar() {} + | ^ found type parameter + +error[E0053]: method `baz` has an incompatible generic parameter for trait `Uwu` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:21:12 + | +LL | trait Uwu { + | --- +LL | fn baz() {} + | ------------ expected const parameter of type `u32` +LL | } +LL | impl Uwu for () { + | --------------- +LL | fn baz() {} + | ^^^^^^^^^^^^ found const parameter of type `i32` + +error[E0053]: method `bbbb` has an incompatible generic parameter for trait `Aaaaaa` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:29:13 + | +LL | trait Aaaaaa { + | ------ +LL | fn bbbb() {} + | ------------ expected const parameter of type `u32` +LL | } +LL | impl Aaaaaa for () { + | ------------------ +LL | fn bbbb() {} + | ^ found type parameter + +error[E0053]: method `abcd` has an incompatible generic parameter for trait `Names` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:37:13 + | +LL | trait Names { + | ----- +LL | fn abcd() {} + | - expected type parameter +LL | } +LL | impl Names for () { + | ----------------- +LL | fn abcd() {} + | ^^^^^^^^^^^^ found const parameter of type `u32` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0053`. diff --git a/src/test/ui/const-generics/issues/issue-86820.rs b/src/test/ui/const-generics/issues/issue-86820.rs index 04650403c6baf..ae4bd943fd415 100644 --- a/src/test/ui/const-generics/issues/issue-86820.rs +++ b/src/test/ui/const-generics/issues/issue-86820.rs @@ -1,6 +1,6 @@ // Regression test for the ICE described in #86820. -#![allow(unused,dead_code)] +#![allow(unused, dead_code)] use std::ops::BitAnd; const C: fn() = || is_set(); @@ -9,13 +9,12 @@ fn is_set() { } trait Bits { - fn bit(self) -> bool; - //~^ NOTE: the const parameter `I` has type `usize`, but the declaration in trait `Bits::bit` has type `u8` + fn bit(self) -> bool; } impl Bits for u8 { - fn bit(self) -> bool { - //~^ ERROR: method `bit` has an incompatible const parameter type for trait [E0053] + fn bit(self) -> bool { + //~^ ERROR: method `bit` has an incompatible generic parameter for trait `Bits` [E0053] let i = 1 << I; let mask = u8::from(i); mask & self == mask diff --git a/src/test/ui/const-generics/issues/issue-86820.stderr b/src/test/ui/const-generics/issues/issue-86820.stderr index f7b8d80eeca7f..3a9cd957f35e7 100644 --- a/src/test/ui/const-generics/issues/issue-86820.stderr +++ b/src/test/ui/const-generics/issues/issue-86820.stderr @@ -1,14 +1,15 @@ -error[E0053]: method `bit` has an incompatible const parameter type for trait - --> $DIR/issue-86820.rs:17:12 +error[E0053]: method `bit` has an incompatible generic parameter for trait `Bits` + --> $DIR/issue-86820.rs:16:12 | -LL | fn bit(self) -> bool { - | ^^^^^^^^^^^^^^^ - | -note: the const parameter `I` has type `usize`, but the declaration in trait `Bits::bit` has type `u8` - --> $DIR/issue-86820.rs:12:12 - | -LL | fn bit(self) -> bool; - | ^^^^^^^^^^^^ +LL | trait Bits { + | ---- +LL | fn bit(self) -> bool; + | ----------- expected const parameter of type `u8` +... +LL | impl Bits for u8 { + | ---------------- +LL | fn bit(self) -> bool { + | ^^^^^^^^^^^^^^ found const parameter of type `usize` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/const_params_have_right_type.rs b/src/test/ui/generic-associated-types/const_params_have_right_type.rs new file mode 100644 index 0000000000000..6bed8e3aff975 --- /dev/null +++ b/src/test/ui/generic-associated-types/const_params_have_right_type.rs @@ -0,0 +1,12 @@ +#![feature(generic_associated_types)] + +trait Trait { + type Foo; +} + +impl Trait for () { + type Foo = u32; + //~^ error: type `Foo` has an incompatible generic parameter for trait +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/const_params_have_right_type.stderr b/src/test/ui/generic-associated-types/const_params_have_right_type.stderr new file mode 100644 index 0000000000000..89c993dee5e69 --- /dev/null +++ b/src/test/ui/generic-associated-types/const_params_have_right_type.stderr @@ -0,0 +1,16 @@ +error[E0053]: type `Foo` has an incompatible generic parameter for trait `Trait` + --> $DIR/const_params_have_right_type.rs:8:14 + | +LL | trait Trait { + | ----- +LL | type Foo; + | ----------- expected const parameter of type `u8` +... +LL | impl Trait for () { + | ----------------- +LL | type Foo = u32; + | ^^^^^^^^^^^^ found const parameter of type `u64` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/src/test/ui/issues/issue-38715.rs b/src/test/ui/macros/issue-38715.rs similarity index 100% rename from src/test/ui/issues/issue-38715.rs rename to src/test/ui/macros/issue-38715.rs diff --git a/src/test/ui/issues/issue-38715.stderr b/src/test/ui/macros/issue-38715.stderr similarity index 100% rename from src/test/ui/issues/issue-38715.stderr rename to src/test/ui/macros/issue-38715.stderr diff --git a/src/test/ui/continue-after-missing-main.nll.stderr b/src/test/ui/nll/continue-after-missing-main.nll.stderr similarity index 100% rename from src/test/ui/continue-after-missing-main.nll.stderr rename to src/test/ui/nll/continue-after-missing-main.nll.stderr diff --git a/src/test/ui/continue-after-missing-main.rs b/src/test/ui/nll/continue-after-missing-main.rs similarity index 100% rename from src/test/ui/continue-after-missing-main.rs rename to src/test/ui/nll/continue-after-missing-main.rs diff --git a/src/test/ui/continue-after-missing-main.stderr b/src/test/ui/nll/continue-after-missing-main.stderr similarity index 100% rename from src/test/ui/continue-after-missing-main.stderr rename to src/test/ui/nll/continue-after-missing-main.stderr diff --git a/src/test/ui/issues/issue-48803.rs b/src/test/ui/nll/issue-48803.rs similarity index 100% rename from src/test/ui/issues/issue-48803.rs rename to src/test/ui/nll/issue-48803.rs diff --git a/src/test/ui/issues/issue-48803.stderr b/src/test/ui/nll/issue-48803.stderr similarity index 100% rename from src/test/ui/issues/issue-48803.stderr rename to src/test/ui/nll/issue-48803.stderr diff --git a/src/test/ui/issues/issue-52533-1.nll.stderr b/src/test/ui/nll/issue-52533-1.nll.stderr similarity index 100% rename from src/test/ui/issues/issue-52533-1.nll.stderr rename to src/test/ui/nll/issue-52533-1.nll.stderr diff --git a/src/test/ui/issues/issue-52533-1.rs b/src/test/ui/nll/issue-52533-1.rs similarity index 100% rename from src/test/ui/issues/issue-52533-1.rs rename to src/test/ui/nll/issue-52533-1.rs diff --git a/src/test/ui/issues/issue-52533-1.stderr b/src/test/ui/nll/issue-52533-1.stderr similarity index 100% rename from src/test/ui/issues/issue-52533-1.stderr rename to src/test/ui/nll/issue-52533-1.stderr diff --git a/src/test/ui/issues/issue-14940.rs b/src/test/ui/process/issue-14940.rs similarity index 100% rename from src/test/ui/issues/issue-14940.rs rename to src/test/ui/process/issue-14940.rs diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 6b715f727b223..5712e84adbc20 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -7,8 +7,8 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 977; -const ISSUES_ENTRY_LIMIT: usize = 2278; +const ROOT_ENTRY_LIMIT: usize = 974; +const ISSUES_ENTRY_LIMIT: usize = 2248; fn check_entries(path: &Path, bad: &mut bool) { let dirs = walkdir::WalkDir::new(&path.join("test/ui"))