From 7272b6fc8ce5c5d4b087129029c0a5be2570dd44 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 25 Sep 2021 23:57:26 +0200 Subject: [PATCH 01/11] Make char conversion functions unstably const --- library/core/src/char/convert.rs | 32 ++++++++++++++++++++++---------- library/core/src/char/methods.rs | 15 ++++++++++----- library/core/src/lib.rs | 1 + 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/library/core/src/char/convert.rs b/library/core/src/char/convert.rs index 72921414fb3f..6e48faba84cf 100644 --- a/library/core/src/char/convert.rs +++ b/library/core/src/char/convert.rs @@ -51,8 +51,13 @@ use super::MAX; #[must_use] #[inline] #[stable(feature = "rust1", since = "1.0.0")] -pub fn from_u32(i: u32) -> Option { - char::try_from(i).ok() +#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] +pub const fn from_u32(i: u32) -> Option { + // FIXME: once Result::ok is const fn, use it here + match char_try_from_u32(i) { + Ok(c) => Some(c), + Err(_) => None, + } } /// Converts a `u32` to a `char`, ignoring validity. @@ -91,7 +96,8 @@ pub fn from_u32(i: u32) -> Option { #[inline] #[must_use] #[stable(feature = "char_from_unchecked", since = "1.5.0")] -pub unsafe fn from_u32_unchecked(i: u32) -> char { +#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] +pub const unsafe fn from_u32_unchecked(i: u32) -> char { // SAFETY: the caller must guarantee that `i` is a valid char value. if cfg!(debug_assertions) { char::from_u32(i).unwrap() } else { unsafe { transmute(i) } } } @@ -244,18 +250,23 @@ impl FromStr for char { } } +#[inline] +const fn char_try_from_u32(i: u32) -> Result { + if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) { + Err(CharTryFromError(())) + } else { + // SAFETY: checked that it's a legal unicode value + Ok(unsafe { transmute(i) }) + } +} + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom for char { type Error = CharTryFromError; #[inline] fn try_from(i: u32) -> Result { - if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) { - Err(CharTryFromError(())) - } else { - // SAFETY: checked that it's a legal unicode value - Ok(unsafe { transmute(i) }) - } + char_try_from_u32(i) } } @@ -323,7 +334,8 @@ impl fmt::Display for CharTryFromError { #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] -pub fn from_digit(num: u32, radix: u32) -> Option { +#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] +pub const fn from_digit(num: u32, radix: u32) -> Option { if radix > 36 { panic!("from_digit: radix is too high (maximum 36)"); } diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 3c4972bd3c9a..d5ad0c385c70 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -136,9 +136,10 @@ impl char { /// assert_eq!(None, c); /// ``` #[stable(feature = "assoc_char_funcs", since = "1.52.0")] + #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] #[must_use] #[inline] - pub fn from_u32(i: u32) -> Option { + pub const fn from_u32(i: u32) -> Option { super::convert::from_u32(i) } @@ -178,9 +179,10 @@ impl char { /// assert_eq!('❤', c); /// ``` #[stable(feature = "assoc_char_funcs", since = "1.52.0")] + #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] #[must_use] #[inline] - pub unsafe fn from_u32_unchecked(i: u32) -> char { + pub const unsafe fn from_u32_unchecked(i: u32) -> char { // SAFETY: the safety contract must be upheld by the caller. unsafe { super::convert::from_u32_unchecked(i) } } @@ -235,9 +237,10 @@ impl char { /// let _c = char::from_digit(1, 37); /// ``` #[stable(feature = "assoc_char_funcs", since = "1.52.0")] + #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] #[must_use] #[inline] - pub fn from_digit(num: u32, radix: u32) -> Option { + pub const fn from_digit(num: u32, radix: u32) -> Option { super::convert::from_digit(num, radix) } @@ -331,10 +334,11 @@ impl char { /// let _ = '1'.to_digit(37); /// ``` #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] - pub fn to_digit(self, radix: u32) -> Option { + pub const fn to_digit(self, radix: u32) -> Option { assert!(radix <= 36, "to_digit: radix is too high (maximum 36)"); // If not a digit, a number greater than radix will be created. let mut digit = (self as u32).wrapping_sub('0' as u32); @@ -345,7 +349,8 @@ impl char { // Force the 6th bit to be set to ensure ascii is lower case. digit = (self as u32 | 0b10_0000).wrapping_sub('a' as u32).saturating_add(10); } - (digit < radix).then_some(digit) + // FIXME: once then_some is const fn, use it here + if digit < radix { Some(digit) } else { None } } /// Returns an iterator that yields the hexadecimal Unicode escape of a diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 7bc641c52767..43ba556af638 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -104,6 +104,7 @@ #![feature(const_bigint_helper_methods)] #![feature(const_caller_location)] #![feature(const_cell_into_inner)] +#![feature(const_char_convert)] #![feature(const_discriminant)] #![feature(const_float_bits_conv)] #![feature(const_float_classify)] From 7bc827b34b3836245270025183096d9abebb8659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Fri, 5 Nov 2021 00:00:00 +0000 Subject: [PATCH 02/11] Refactor single variant `Candidate` enum into a struct `Candidate` enum has only a single `Ref` variant. Refactor it into a struct and reduce overall indentation of the code by two levels. No functional changes. --- .../src/transform/promote_consts.rs | 177 ++++++++---------- 1 file changed, 82 insertions(+), 95 deletions(-) diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs index 7bf378601e05..da0c10dc4ee9 100644 --- a/compiler/rustc_const_eval/src/transform/promote_consts.rs +++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs @@ -93,16 +93,13 @@ impl TempState { /// returned value in a promoted MIR, unless it's a subset /// of a larger candidate. #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub enum Candidate { - /// Borrow of a constant temporary, candidate for lifetime extension. - Ref(Location), +pub struct Candidate { + location: Location, } impl Candidate { fn source_info(&self, body: &Body<'_>) -> SourceInfo { - match self { - Candidate::Ref(location) => *body.source_info(*location), - } + *body.source_info(self.location) } } @@ -167,7 +164,7 @@ impl<'tcx> Visitor<'tcx> for Collector<'_, 'tcx> { match *rvalue { Rvalue::Ref(..) => { - self.candidates.push(Candidate::Ref(location)); + self.candidates.push(Candidate { location }); } _ => {} } @@ -209,36 +206,33 @@ struct Unpromotable; impl<'tcx> Validator<'_, 'tcx> { fn validate_candidate(&self, candidate: Candidate) -> Result<(), Unpromotable> { - match candidate { - Candidate::Ref(loc) => { - let statement = &self.body[loc.block].statements[loc.statement_index]; - match &statement.kind { - StatementKind::Assign(box (_, Rvalue::Ref(_, kind, place))) => { - // We can only promote interior borrows of promotable temps (non-temps - // don't get promoted anyway). - self.validate_local(place.local)?; - - // The reference operation itself must be promotable. - // (Needs to come after `validate_local` to avoid ICEs.) - self.validate_ref(*kind, place)?; - - // We do not check all the projections (they do not get promoted anyway), - // but we do stay away from promoting anything involving a dereference. - if place.projection.contains(&ProjectionElem::Deref) { - return Err(Unpromotable); - } + let loc = candidate.location; + let statement = &self.body[loc.block].statements[loc.statement_index]; + match &statement.kind { + StatementKind::Assign(box (_, Rvalue::Ref(_, kind, place))) => { + // We can only promote interior borrows of promotable temps (non-temps + // don't get promoted anyway). + self.validate_local(place.local)?; + + // The reference operation itself must be promotable. + // (Needs to come after `validate_local` to avoid ICEs.) + self.validate_ref(*kind, place)?; - // We cannot promote things that need dropping, since the promoted value - // would not get dropped. - if self.qualif_local::(place.local) { - return Err(Unpromotable); - } + // We do not check all the projections (they do not get promoted anyway), + // but we do stay away from promoting anything involving a dereference. + if place.projection.contains(&ProjectionElem::Deref) { + return Err(Unpromotable); + } - Ok(()) - } - _ => bug!(), + // We cannot promote things that need dropping, since the promoted value + // would not get dropped. + if self.qualif_local::(place.local) { + return Err(Unpromotable); } + + Ok(()) } + _ => bug!(), } } @@ -871,58 +865,55 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { })) }; let (blocks, local_decls) = self.source.basic_blocks_and_local_decls_mut(); - match candidate { - Candidate::Ref(loc) => { - let statement = &mut blocks[loc.block].statements[loc.statement_index]; - match statement.kind { - StatementKind::Assign(box ( - _, - Rvalue::Ref(ref mut region, borrow_kind, ref mut place), - )) => { - // Use the underlying local for this (necessarily interior) borrow. - let ty = local_decls.local_decls()[place.local].ty; - let span = statement.source_info.span; - - let ref_ty = tcx.mk_ref( - tcx.lifetimes.re_erased, - ty::TypeAndMut { ty, mutbl: borrow_kind.to_mutbl_lossy() }, - ); - - *region = tcx.lifetimes.re_erased; - - let mut projection = vec![PlaceElem::Deref]; - projection.extend(place.projection); - place.projection = tcx.intern_place_elems(&projection); - - // Create a temp to hold the promoted reference. - // This is because `*r` requires `r` to be a local, - // otherwise we would use the `promoted` directly. - let mut promoted_ref = LocalDecl::new(ref_ty, span); - promoted_ref.source_info = statement.source_info; - let promoted_ref = local_decls.push(promoted_ref); - assert_eq!(self.temps.push(TempState::Unpromotable), promoted_ref); - - let promoted_ref_statement = Statement { - source_info: statement.source_info, - kind: StatementKind::Assign(Box::new(( - Place::from(promoted_ref), - Rvalue::Use(promoted_operand(ref_ty, span)), - ))), - }; - self.extra_statements.push((loc, promoted_ref_statement)); - - Rvalue::Ref( - tcx.lifetimes.re_erased, - borrow_kind, - Place { - local: mem::replace(&mut place.local, promoted_ref), - projection: List::empty(), - }, - ) - } - _ => bug!(), - } + let loc = candidate.location; + let statement = &mut blocks[loc.block].statements[loc.statement_index]; + match statement.kind { + StatementKind::Assign(box ( + _, + Rvalue::Ref(ref mut region, borrow_kind, ref mut place), + )) => { + // Use the underlying local for this (necessarily interior) borrow. + let ty = local_decls.local_decls()[place.local].ty; + let span = statement.source_info.span; + + let ref_ty = tcx.mk_ref( + tcx.lifetimes.re_erased, + ty::TypeAndMut { ty, mutbl: borrow_kind.to_mutbl_lossy() }, + ); + + *region = tcx.lifetimes.re_erased; + + let mut projection = vec![PlaceElem::Deref]; + projection.extend(place.projection); + place.projection = tcx.intern_place_elems(&projection); + + // Create a temp to hold the promoted reference. + // This is because `*r` requires `r` to be a local, + // otherwise we would use the `promoted` directly. + let mut promoted_ref = LocalDecl::new(ref_ty, span); + promoted_ref.source_info = statement.source_info; + let promoted_ref = local_decls.push(promoted_ref); + assert_eq!(self.temps.push(TempState::Unpromotable), promoted_ref); + + let promoted_ref_statement = Statement { + source_info: statement.source_info, + kind: StatementKind::Assign(Box::new(( + Place::from(promoted_ref), + Rvalue::Use(promoted_operand(ref_ty, span)), + ))), + }; + self.extra_statements.push((loc, promoted_ref_statement)); + + Rvalue::Ref( + tcx.lifetimes.re_erased, + borrow_kind, + Place { + local: mem::replace(&mut place.local, promoted_ref), + projection: List::empty(), + }, + ) } + _ => bug!(), } }; @@ -964,17 +955,13 @@ pub fn promote_candidates<'tcx>( let mut extra_statements = vec![]; for candidate in candidates.into_iter().rev() { - match candidate { - Candidate::Ref(Location { block, statement_index }) => { - if let StatementKind::Assign(box (place, _)) = - &body[block].statements[statement_index].kind - { - if let Some(local) = place.as_local() { - if temps[local] == TempState::PromotedOut { - // Already promoted. - continue; - } - } + let Location { block, statement_index } = candidate.location; + if let StatementKind::Assign(box (place, _)) = &body[block].statements[statement_index].kind + { + if let Some(local) = place.as_local() { + if temps[local] == TempState::PromotedOut { + // Already promoted. + continue; } } } From 59edb9d38280eed96a3012f3ea2a46cb8c254218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Fri, 5 Nov 2021 00:00:00 +0000 Subject: [PATCH 03/11] Remove `Candidate::source_info` --- compiler/rustc_const_eval/src/transform/promote_consts.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs index da0c10dc4ee9..a92b20f5cb52 100644 --- a/compiler/rustc_const_eval/src/transform/promote_consts.rs +++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs @@ -97,12 +97,6 @@ pub struct Candidate { location: Location, } -impl Candidate { - fn source_info(&self, body: &Body<'_>) -> SourceInfo { - *body.source_info(self.location) - } -} - struct Collector<'a, 'tcx> { ccx: &'a ConstCx<'a, 'tcx>, temps: IndexVec, @@ -969,7 +963,7 @@ pub fn promote_candidates<'tcx>( // Declare return place local so that `mir::Body::new` doesn't complain. let initial_locals = iter::once(LocalDecl::new(tcx.types.never, body.span)).collect(); - let mut scope = body.source_scopes[candidate.source_info(body).scope].clone(); + let mut scope = body.source_scopes[body.source_info(candidate.location).scope].clone(); scope.parent_scope = None; let promoted = Body::new( From afd9dfa89d9f7db67f6fe8c3dd0fda87c154fefe Mon Sep 17 00:00:00 2001 From: Alberto Planas Date: Thu, 11 Nov 2021 16:05:32 +0100 Subject: [PATCH 04/11] bootstap: create .cargo/config only if not present In some situations we should want on influence into the .cargo/config when we use vendored source. One example is #90764, when we want to workaround some references to crates forked and living in git, that are missing in the vendor/ directory. This commit will create the .cargo/config file only when the .cargo/ directory needs to be created. --- src/bootstrap/bootstrap.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 38d3c7aec494..22f2e405a1e8 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -1119,17 +1119,22 @@ def check_vendored_status(self): raise Exception("{} not found".format(vendor_dir)) if self.use_vendored_sources: + config = ("[source.crates-io]\n" + "replace-with = 'vendored-sources'\n" + "registry = 'https://example.com'\n" + "\n" + "[source.vendored-sources]\n" + "directory = '{}/vendor'\n" + .format(self.rust_root)) if not os.path.exists('.cargo'): os.makedirs('.cargo') - with output('.cargo/config') as cargo_config: - cargo_config.write( - "[source.crates-io]\n" - "replace-with = 'vendored-sources'\n" - "registry = 'https://example.com'\n" - "\n" - "[source.vendored-sources]\n" - "directory = '{}/vendor'\n" - .format(self.rust_root)) + with output('.cargo/config') as cargo_config: + cargo_config.write(config) + else: + print('info: using vendored source, but .cargo/config is already present.') + print(' Reusing the current configuration file. But you may want to ' + 'configure vendoring like this:') + print(config) else: if os.path.exists('.cargo'): shutil.rmtree('.cargo') From ddc1d58ca83ab2c176929c47bd679cfbe8cf32f9 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 16 Nov 2021 14:36:20 +0900 Subject: [PATCH 05/11] windows: Return the "Not Found" error when a path is empty --- library/std/src/fs/tests.rs | 4 ++++ library/std/src/sys/windows/path.rs | 4 ++-- library/std/src/sys/windows/path/tests.rs | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index 628de13156c6..112b292e6c17 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -1439,4 +1439,8 @@ fn create_dir_long_paths() { // This will fail if the path isn't converted to verbatim. path.push("a"); fs::create_dir(&path).unwrap(); + + // #90940: Ensure an empty path returns the "Not Found" error. + let path = Path::new(""); + assert_eq!(path.canonicalize().unwrap_err().kind(), crate::io::ErrorKind::NotFound); } diff --git a/library/std/src/sys/windows/path.rs b/library/std/src/sys/windows/path.rs index 460c1eff7788..d0b7d9e7377a 100644 --- a/library/std/src/sys/windows/path.rs +++ b/library/std/src/sys/windows/path.rs @@ -174,8 +174,8 @@ pub(crate) fn maybe_verbatim(path: &Path) -> io::Result> { const UNC_PREFIX: &[u16] = &[SEP, SEP, QUERY, SEP, U, N, C, SEP]; let mut path = to_u16s(path)?; - if path.starts_with(VERBATIM_PREFIX) || path.starts_with(NT_PREFIX) { - // Early return for paths that are already verbatim. + if path.starts_with(VERBATIM_PREFIX) || path.starts_with(NT_PREFIX) || path == &[0] { + // Early return for paths that are already verbatim or empty. return Ok(path); } else if path.len() < LEGACY_MAX_PATH { // Early return if an absolute path is less < 260 UTF-16 code units. diff --git a/library/std/src/sys/windows/path/tests.rs b/library/std/src/sys/windows/path/tests.rs index c6c84519f419..425c2011b323 100644 --- a/library/std/src/sys/windows/path/tests.rs +++ b/library/std/src/sys/windows/path/tests.rs @@ -91,7 +91,6 @@ fn verbatim() { // Make sure opening a drive will work. check("Z:", "Z:"); - // An empty path or a path that contains null are not valid paths. - assert!(maybe_verbatim(Path::new("")).is_err()); + // A path that contains null is not a valid path. assert!(maybe_verbatim(Path::new("\0")).is_err()); } From 4ca4e094abf6ef2c4871aa6b395e85e8843eb4a8 Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Tue, 16 Nov 2021 20:35:26 +0000 Subject: [PATCH 06/11] Suggest removal of arguments for unit variant, not replacement --- compiler/rustc_typeck/src/check/callee.rs | 12 +++++++----- src/test/ui/empty/empty-struct-unit-expr.stderr | 10 ++++++---- src/test/ui/error-codes/E0618.stderr | 5 +++-- src/test/ui/resolve/privacy-enum-ctor.stderr | 15 +++++++++------ ...rrect-variant-form-through-alias-caught.stderr | 5 +++-- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_typeck/src/check/callee.rs b/compiler/rustc_typeck/src/check/callee.rs index 5d22e300774d..635ed9381931 100644 --- a/compiler/rustc_typeck/src/check/callee.rs +++ b/compiler/rustc_typeck/src/check/callee.rs @@ -349,9 +349,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty::FnPtr(sig) => (sig, None), ref t => { let mut unit_variant = None; + let mut removal_span = call_expr.span; if let ty::Adt(adt_def, ..) = t { if adt_def.is_enum() { if let hir::ExprKind::Call(expr, _) = call_expr.kind { + removal_span = + expr.span.shrink_to_hi().to(call_expr.span.shrink_to_hi()); unit_variant = self.tcx.sess.source_map().span_to_snippet(expr.span).ok(); } @@ -379,14 +382,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); if let Some(ref path) = unit_variant { - err.span_suggestion( - call_expr.span, + err.span_suggestion_verbose( + removal_span, &format!( - "`{}` is a unit variant, you need to write it \ - without the parentheses", + "`{}` is a unit variant, you need to write it without the parentheses", path ), - path.to_string(), + String::new(), Applicability::MachineApplicable, ); } diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr index 26bfc4355fa1..81651c5bf6f4 100644 --- a/src/test/ui/empty/empty-struct-unit-expr.stderr +++ b/src/test/ui/empty/empty-struct-unit-expr.stderr @@ -22,8 +22,9 @@ LL | let e4 = E::Empty4(); | help: `E::Empty4` is a unit variant, you need to write it without the parentheses | -LL | let e4 = E::Empty4; - | ~~~~~~~~~ +LL - let e4 = E::Empty4(); +LL + let e4 = E::Empty4; + | error[E0618]: expected function, found `empty_struct::XEmpty2` --> $DIR/empty-struct-unit-expr.rs:18:15 @@ -43,8 +44,9 @@ LL | let xe4 = XE::XEmpty4(); | help: `XE::XEmpty4` is a unit variant, you need to write it without the parentheses | -LL | let xe4 = XE::XEmpty4; - | ~~~~~~~~~~~ +LL - let xe4 = XE::XEmpty4(); +LL + let xe4 = XE::XEmpty4; + | error: aborting due to 4 previous errors diff --git a/src/test/ui/error-codes/E0618.stderr b/src/test/ui/error-codes/E0618.stderr index db1b3f098374..a3a90968df70 100644 --- a/src/test/ui/error-codes/E0618.stderr +++ b/src/test/ui/error-codes/E0618.stderr @@ -11,8 +11,9 @@ LL | X::Entry(); | help: `X::Entry` is a unit variant, you need to write it without the parentheses | -LL | X::Entry; - | ~~~~~~~~ +LL - X::Entry(); +LL + X::Entry; + | error[E0618]: expected function, found `i32` --> $DIR/E0618.rs:9:5 diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index 06c52befd52b..c93ba915efb2 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -340,8 +340,9 @@ LL | let _ = Z::Unit(); | help: `Z::Unit` is a unit variant, you need to write it without the parentheses | -LL | let _ = Z::Unit; - | ~~~~~~~ +LL - let _ = Z::Unit(); +LL + let _ = Z::Unit; + | error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:43:16 @@ -374,8 +375,9 @@ LL | let _: E = m::E::Unit(); | help: `m::E::Unit` is a unit variant, you need to write it without the parentheses | -LL | let _: E = m::E::Unit; - | ~~~~~~~~~~ +LL - let _: E = m::E::Unit(); +LL + let _: E = m::E::Unit; + | error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:51:16 @@ -408,8 +410,9 @@ LL | let _: E = E::Unit(); | help: `E::Unit` is a unit variant, you need to write it without the parentheses | -LL | let _: E = E::Unit; - | ~~~~~~~ +LL - let _: E = E::Unit(); +LL + let _: E = E::Unit; + | error: aborting due to 23 previous errors diff --git a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr index e918551020c3..0cf020861c74 100644 --- a/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr +++ b/src/test/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr @@ -29,8 +29,9 @@ LL | Alias::Unit(); | help: `Alias::Unit` is a unit variant, you need to write it without the parentheses | -LL | Alias::Unit; - | ~~~~~~~~~~~ +LL - Alias::Unit(); +LL + Alias::Unit; + | error[E0164]: expected tuple struct or tuple variant, found unit variant `Alias::Unit` --> $DIR/incorrect-variant-form-through-alias-caught.rs:17:9 From 552073701f0c20c26b8579b7b6810bbeb6595f26 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 16 Nov 2021 09:28:26 +1100 Subject: [PATCH 07/11] Remove unnecessary lifetime argument from arena macros. Because it's always `'tcx`. In fact, some of them use a mixture of passed-in `$tcx` and hard-coded `'tcx`, so no other lifetime would even work. This makes the code easier to read. --- compiler/rustc_arena/src/lib.rs | 10 ++-- compiler/rustc_ast_lowering/src/lib.rs | 2 +- compiler/rustc_hir/src/arena.rs | 74 +++++++++++++------------- compiler/rustc_middle/src/arena.rs | 28 +++++----- compiler/rustc_middle/src/ty/codec.rs | 18 +++---- 5 files changed, 66 insertions(+), 66 deletions(-) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index e54fcaf6fc1b..39def2a6f1f1 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -517,9 +517,9 @@ impl DroplessArena { } #[rustc_macro_transparency = "semitransparent"] -pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) { +pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { #[derive(Default)] - pub struct Arena<$tcx> { + pub struct Arena<'tcx> { pub dropless: $crate::DroplessArena, $($name: $crate::TypedArena<$ty>,)* } @@ -547,9 +547,9 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) { } $( - impl<$tcx> ArenaAllocatable<$tcx, $ty> for $ty { + impl<'tcx> ArenaAllocatable<'tcx, $ty> for $ty { #[inline] - fn allocate_on<'a>(self, arena: &'a Arena<$tcx>) -> &'a mut Self { + fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self { if !::std::mem::needs_drop::() { arena.dropless.alloc(self) } else { @@ -559,7 +559,7 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) { #[inline] fn allocate_from_iter<'a>( - arena: &'a Arena<$tcx>, + arena: &'a Arena<'tcx>, iter: impl ::std::iter::IntoIterator, ) -> &'a mut [Self] { if !::std::mem::needs_drop::() { diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 79464a751721..cd468bcf4474 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -84,7 +84,7 @@ mod item; mod pat; mod path; -rustc_hir::arena_types!(rustc_arena::declare_arena, 'tcx); +rustc_hir::arena_types!(rustc_arena::declare_arena); struct LoweringContext<'a, 'hir: 'a> { /// Used to assign IDs to HIR nodes that do not directly correspond to AST nodes. diff --git a/compiler/rustc_hir/src/arena.rs b/compiler/rustc_hir/src/arena.rs index 5091a7bccc55..175845fb9e58 100644 --- a/compiler/rustc_hir/src/arena.rs +++ b/compiler/rustc_hir/src/arena.rs @@ -4,49 +4,49 @@ /// where `T` is the type listed. These impls will appear in the implement_ty_decoder! macro. #[macro_export] macro_rules! arena_types { - ($macro:path, $tcx:lifetime) => ( + ($macro:path) => ( $macro!([ // HIR types - [] hir_krate: rustc_hir::Crate<$tcx>, - [] arm: rustc_hir::Arm<$tcx>, - [] asm_operand: (rustc_hir::InlineAsmOperand<$tcx>, Span), + [] hir_krate: rustc_hir::Crate<'tcx>, + [] arm: rustc_hir::Arm<'tcx>, + [] asm_operand: (rustc_hir::InlineAsmOperand<'tcx>, Span), [] asm_template: rustc_ast::InlineAsmTemplatePiece, [] attribute: rustc_ast::Attribute, - [] block: rustc_hir::Block<$tcx>, - [] bare_fn_ty: rustc_hir::BareFnTy<$tcx>, - [] body: rustc_hir::Body<$tcx>, - [] generic_arg: rustc_hir::GenericArg<$tcx>, - [] generic_args: rustc_hir::GenericArgs<$tcx>, - [] generic_bound: rustc_hir::GenericBound<$tcx>, - [] generic_param: rustc_hir::GenericParam<$tcx>, - [] expr: rustc_hir::Expr<$tcx>, - [] expr_field: rustc_hir::ExprField<$tcx>, - [] pat_field: rustc_hir::PatField<$tcx>, - [] fn_decl: rustc_hir::FnDecl<$tcx>, - [] foreign_item: rustc_hir::ForeignItem<$tcx>, + [] block: rustc_hir::Block<'tcx>, + [] bare_fn_ty: rustc_hir::BareFnTy<'tcx>, + [] body: rustc_hir::Body<'tcx>, + [] generic_arg: rustc_hir::GenericArg<'tcx>, + [] generic_args: rustc_hir::GenericArgs<'tcx>, + [] generic_bound: rustc_hir::GenericBound<'tcx>, + [] generic_param: rustc_hir::GenericParam<'tcx>, + [] expr: rustc_hir::Expr<'tcx>, + [] expr_field: rustc_hir::ExprField<'tcx>, + [] pat_field: rustc_hir::PatField<'tcx>, + [] fn_decl: rustc_hir::FnDecl<'tcx>, + [] foreign_item: rustc_hir::ForeignItem<'tcx>, [] foreign_item_ref: rustc_hir::ForeignItemRef, - [] impl_item: rustc_hir::ImplItem<$tcx>, + [] impl_item: rustc_hir::ImplItem<'tcx>, [] impl_item_ref: rustc_hir::ImplItemRef, - [] item: rustc_hir::Item<$tcx>, - [] inline_asm: rustc_hir::InlineAsm<$tcx>, - [] llvm_inline_asm: rustc_hir::LlvmInlineAsm<$tcx>, - [] local: rustc_hir::Local<$tcx>, - [] mod_: rustc_hir::Mod<$tcx>, - [] owner_info: rustc_hir::OwnerInfo<$tcx>, - [] param: rustc_hir::Param<$tcx>, - [] pat: rustc_hir::Pat<$tcx>, - [] path: rustc_hir::Path<$tcx>, - [] path_segment: rustc_hir::PathSegment<$tcx>, - [] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>, - [] qpath: rustc_hir::QPath<$tcx>, - [] stmt: rustc_hir::Stmt<$tcx>, - [] field_def: rustc_hir::FieldDef<$tcx>, - [] trait_item: rustc_hir::TraitItem<$tcx>, + [] item: rustc_hir::Item<'tcx>, + [] inline_asm: rustc_hir::InlineAsm<'tcx>, + [] llvm_inline_asm: rustc_hir::LlvmInlineAsm<'tcx>, + [] local: rustc_hir::Local<'tcx>, + [] mod_: rustc_hir::Mod<'tcx>, + [] owner_info: rustc_hir::OwnerInfo<'tcx>, + [] param: rustc_hir::Param<'tcx>, + [] pat: rustc_hir::Pat<'tcx>, + [] path: rustc_hir::Path<'tcx>, + [] path_segment: rustc_hir::PathSegment<'tcx>, + [] poly_trait_ref: rustc_hir::PolyTraitRef<'tcx>, + [] qpath: rustc_hir::QPath<'tcx>, + [] stmt: rustc_hir::Stmt<'tcx>, + [] field_def: rustc_hir::FieldDef<'tcx>, + [] trait_item: rustc_hir::TraitItem<'tcx>, [] trait_item_ref: rustc_hir::TraitItemRef, - [] ty: rustc_hir::Ty<$tcx>, - [] type_binding: rustc_hir::TypeBinding<$tcx>, - [] variant: rustc_hir::Variant<$tcx>, - [] where_predicate: rustc_hir::WherePredicate<$tcx>, - ], $tcx); + [] ty: rustc_hir::Ty<'tcx>, + [] type_binding: rustc_hir::TypeBinding<'tcx>, + [] variant: rustc_hir::Variant<'tcx>, + [] where_predicate: rustc_hir::WherePredicate<'tcx>, + ]); ) } diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index 2bcc2a4f7cff..530437f50eb1 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -4,30 +4,30 @@ /// listed. These impls will appear in the implement_ty_decoder! macro. #[macro_export] macro_rules! arena_types { - ($macro:path, $tcx:lifetime) => ( + ($macro:path) => ( $macro!([ [] layout: rustc_target::abi::Layout, - [] fn_abi: rustc_target::abi::call::FnAbi<$tcx, rustc_middle::ty::Ty<$tcx>>, + [] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>, // AdtDef are interned and compared by address [] adt_def: rustc_middle::ty::AdtDef, - [] steal_thir: rustc_data_structures::steal::Steal>, - [] steal_mir: rustc_data_structures::steal::Steal>, - [decode] mir: rustc_middle::mir::Body<$tcx>, + [] steal_thir: rustc_data_structures::steal::Steal>, + [] steal_mir: rustc_data_structures::steal::Steal>, + [decode] mir: rustc_middle::mir::Body<'tcx>, [] steal_promoted: rustc_data_structures::steal::Steal< rustc_index::vec::IndexVec< rustc_middle::mir::Promoted, - rustc_middle::mir::Body<$tcx> + rustc_middle::mir::Body<'tcx> > >, [decode] promoted: rustc_index::vec::IndexVec< rustc_middle::mir::Promoted, - rustc_middle::mir::Body<$tcx> + rustc_middle::mir::Body<'tcx> >, - [decode] typeck_results: rustc_middle::ty::TypeckResults<$tcx>, + [decode] typeck_results: rustc_middle::ty::TypeckResults<'tcx>, [decode] borrowck_result: - rustc_middle::mir::BorrowCheckResult<$tcx>, + rustc_middle::mir::BorrowCheckResult<'tcx>, [decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult, [decode] code_region: rustc_middle::mir::coverage::CodeRegion, [] const_allocs: rustc_middle::mir::interpret::Allocation, @@ -78,14 +78,14 @@ macro_rules! arena_types { [] foreign_modules: Vec, [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap, [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation, - [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>, + [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<'tcx>, [] attribute: rustc_ast::Attribute, [] name_set: rustc_data_structures::fx::FxHashSet, [] hir_id_set: rustc_hir::HirIdSet, // Interned types - [] tys: rustc_middle::ty::TyS<$tcx>, - [] predicates: rustc_middle::ty::PredicateInner<$tcx>, + [] tys: rustc_middle::ty::TyS<'tcx>, + [] predicates: rustc_middle::ty::PredicateInner<'tcx>, // Note that this deliberately duplicates items in the `rustc_hir::arena`, // since we need to allocate this type on both the `rustc_hir` arena @@ -97,8 +97,8 @@ macro_rules! arena_types { [decode] used_trait_imports: rustc_data_structures::fx::FxHashSet, [] dep_kind: rustc_middle::dep_graph::DepKindStruct, - ], $tcx); + ]); ) } -arena_types!(rustc_arena::declare_arena, 'tcx); +arena_types!(rustc_arena::declare_arena); diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index 434008ecb1f4..3f2b987b1e63 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -417,17 +417,17 @@ macro_rules! __impl_decoder_methods { macro_rules! impl_arena_allocatable_decoder { ([]$args:tt) => {}; ([decode $(, $attrs:ident)*] - [[$name:ident: $ty:ty], $tcx:lifetime]) => { - impl<$tcx, D: TyDecoder<$tcx>> RefDecodable<$tcx, D> for $ty { + [$name:ident: $ty:ty]) => { + impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for $ty { #[inline] - fn decode(decoder: &mut D) -> Result<&$tcx Self, D::Error> { + fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> { decode_arena_allocable(decoder) } } - impl<$tcx, D: TyDecoder<$tcx>> RefDecodable<$tcx, D> for [$ty] { + impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [$ty] { #[inline] - fn decode(decoder: &mut D) -> Result<&$tcx Self, D::Error> { + fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> { decode_arena_allocable_slice(decoder) } } @@ -438,15 +438,15 @@ macro_rules! impl_arena_allocatable_decoder { } macro_rules! impl_arena_allocatable_decoders { - ([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) => { + ([$($a:tt $name:ident: $ty:ty,)*]) => { $( - impl_arena_allocatable_decoder!($a [[$name: $ty], $tcx]); + impl_arena_allocatable_decoder!($a [$name: $ty]); )* } } -rustc_hir::arena_types!(impl_arena_allocatable_decoders, 'tcx); -arena_types!(impl_arena_allocatable_decoders, 'tcx); +rustc_hir::arena_types!(impl_arena_allocatable_decoders); +arena_types!(impl_arena_allocatable_decoders); #[macro_export] macro_rules! implement_ty_decoder { From f1aeebfe935f0b08f3ecb0f106b0658dc4816e9d Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 4 Nov 2021 20:21:36 +0100 Subject: [PATCH 08/11] add const generics test --- src/test/ui/const-generics/invariant.rs | 33 +++++++++++++++++++++ src/test/ui/const-generics/invariant.stderr | 26 ++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/test/ui/const-generics/invariant.rs create mode 100644 src/test/ui/const-generics/invariant.stderr diff --git a/src/test/ui/const-generics/invariant.rs b/src/test/ui/const-generics/invariant.rs new file mode 100644 index 000000000000..ee191b65c2c7 --- /dev/null +++ b/src/test/ui/const-generics/invariant.rs @@ -0,0 +1,33 @@ +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] +use std::marker::PhantomData; + +trait SadBee { + const ASSOC: usize; +} +// fn(&'static ())` is a supertype of `for<'a> fn(&'a ())` while +// we allow two different impls for these types, leading +// to different const eval results. +impl SadBee for for<'a> fn(&'a ()) { + const ASSOC: usize = 0; +} +impl SadBee for fn(&'static ()) { + //~^ WARNING conflicting implementations of trait + //~| WARNING this was previously accepted + const ASSOC: usize = 100; +} + +struct Foo([u8; ::ASSOC], PhantomData) +where + [(); ::ASSOC]: ; + +fn covariant( + v: &'static Foo fn(&'a ())> +) -> &'static Foo { + v //~ ERROR mismatched types +} + +fn main() { + let y = covariant(&Foo([], PhantomData)); + println!("{:?}", y.0); +} diff --git a/src/test/ui/const-generics/invariant.stderr b/src/test/ui/const-generics/invariant.stderr new file mode 100644 index 000000000000..318c885e6a6b --- /dev/null +++ b/src/test/ui/const-generics/invariant.stderr @@ -0,0 +1,26 @@ +warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())` + --> $DIR/invariant.rs:14:1 + | +LL | impl SadBee for for<'a> fn(&'a ()) { + | ---------------------------------- first implementation here +... +LL | impl SadBee for fn(&'static ()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())` + | + = note: `#[warn(coherence_leak_check)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56105 + = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + +error[E0308]: mismatched types + --> $DIR/invariant.rs:27:5 + | +LL | v + | ^ one type is more general than the other + | + = note: expected reference `&'static Foo` + found reference `&'static Foo fn(&'a ())>` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. From 41d9abd76cd514aca23e3409fe6896a3a7d61d1a Mon Sep 17 00:00:00 2001 From: Caio Date: Thu, 18 Nov 2021 12:09:34 -0300 Subject: [PATCH 09/11] Move some tests to more reasonable directories --- .../ui/{ => array-slice-vec}/byte-literals.rs | 0 .../{ => attributes}/suffixed-literal-meta.rs | 0 .../suffixed-literal-meta.stderr | 0 .../ui/{ => binop}/operator-multidispatch.rs | 0 .../ui/{ => binop}/operator-overloading.rs | 0 src/test/ui/{ => binop}/placement-syntax.rs | 0 .../ui/{ => binop}/placement-syntax.stderr | 0 .../immut-function-arguments.rs | 0 .../immut-function-arguments.stderr | 0 .../kindck-implicit-close-over-mut-var.rs | 0 src/test/ui/{ => cfg}/crt-static-on-works.rs | 0 .../{ => closures}/once-move-out-on-heap.rs | 0 .../{ => codegen}/auxiliary/llvm_pr32379.rs | 0 src/test/ui/{ => codegen}/init-large-type.rs | 0 src/test/ui/{ => codegen}/llvm-pr32379.rs | 0 src/test/ui/{ => coercion}/retslot-cast.rs | 0 .../ui/{ => coercion}/retslot-cast.stderr | 0 .../{ => dropck}/cleanup-arm-conditional.rs | 0 .../edition-keywords-2015-2018.rs | 0 .../edition-keywords-2018-2018.rs | 0 src/test/ui/export.rs | 10 ---- src/test/ui/export.stderr | 40 --------------- src/test/ui/expr-block-slot.rs | 13 ----- .../auxiliary/no-mangle-associated-fn.rs | 0 .../{ => extern}/no-mangle-associated-fn.rs | 0 src/test/ui/{ => fn}/fun-call-variants.rs | 0 .../break-outside-loop.rs | 0 .../break-outside-loop.stderr | 0 .../break-while-condition.rs | 0 .../break-while-condition.stderr | 0 .../thread-local-not-in-prelude.rs | 0 .../absolute-paths-in-nested-use-groups.rs | 0 ...absolute-paths-in-nested-use-groups.stderr | 0 src/test/ui/{ => imports}/reexport-star.rs | 0 .../{ => inference}/newlambdas-ret-infer.rs | 0 .../{ => inference}/newlambdas-ret-infer2.rs | 0 .../ui/{ => inference}/range-type-infer.rs | 0 .../tutorial-suffix-inference-test.rs | 0 .../tutorial-suffix-inference-test.stderr | 0 .../type-infer-generalize-ty-var.rs | 0 src/test/ui/leak-unique-as-tydesc.rs | 9 ---- .../link-cfg-works-transitive-dylib.rs | 0 .../link-cfg-works-transitive-rlib.rs | 0 .../ui/{ => linkage-attr}/link-cfg-works.rs | 0 src/test/ui/{ => lint}/lint-cap.rs | 0 .../liveness-assign-imm-local-after-ret.rs | 0 .../match-on-negative-integer-ranges.rs | 0 src/test/ui/{ => mir}/issue-73914.rs | 0 .../assignment-operator-unimplemented.rs | 0 .../assignment-operator-unimplemented.stderr | 0 .../float-literal-inference-restrictions.rs | 0 ...loat-literal-inference-restrictions.stderr | 0 src/test/ui/newtype-temporary.rs | 12 ----- src/test/ui/{ => nll}/lub-if.nll.stderr | 0 src/test/ui/{ => nll}/lub-if.rs | 0 src/test/ui/{ => nll}/lub-if.stderr | 0 src/test/ui/non-legacy-modes.rs | 22 -------- .../overloaded-calls-nontuple.rs | 0 .../overloaded-calls-nontuple.stderr | 0 ...bute-with-no-generics-in-parameter-list.rs | 0 ...-with-no-generics-in-parameter-list.stderr | 0 .../{ => parser}/dyn-trait-compatibility.rs | 0 .../dyn-trait-compatibility.stderr | 0 .../ui/{ => parser}/operator-associativity.rs | 0 .../ui/{ => pattern}/ignore-all-the-things.rs | 0 .../auxiliary/impl_privacy_xc_2.rs | 0 .../auxiliary/reachable-unnameable-items.rs | 0 .../ui/{ => privacy}/export-tag-variant.rs | 0 .../{ => privacy}/export-tag-variant.stderr | 0 .../ui/{ => privacy}/impl-privacy-xc-2.rs | 0 .../reachable-unnameable-items.rs | 0 src/test/ui/{ => process}/core-run-destroy.rs | 0 src/test/ui/{ => process}/multi-panic.rs | 0 src/test/ui/{ => process}/no-stdio.rs | 0 src/test/ui/{ => process}/try-wait.rs | 0 src/test/ui/pure-sum.rs | 51 ------------------- .../wf-bound-region-in-object-type.rs | 0 .../blind-item-mixed-crate-use-item-foo.rs | 0 .../blind-item-mixed-crate-use-item-foo2.rs | 0 .../blind-item-mixed-crate-use-item.rs | 0 .../blind-item-mixed-use-item.rs | 0 .../{ => resolve}/export-fully-qualified.rs | 0 .../export-fully-qualified.stderr | 0 src/test/ui/{ => resolve}/no-std-1.rs | 0 src/test/ui/{ => resolve}/no-std-2.rs | 0 src/test/ui/{ => resolve}/no-std-3.rs | 0 .../ui/{ => resolve}/pathless-extern-ok.rs | 0 src/test/ui/{ => runtime}/atomic-print.rs | 0 .../{ => runtime}/backtrace-debuginfo-aux.rs | 0 .../ui/{ => runtime}/backtrace-debuginfo.rs | 0 .../{ => runtime}/native-print-no-runtime.rs | 0 .../stability-in-private-module.rs | 0 .../stability-in-private-module.stderr | 0 .../{ => static}/auxiliary/extern-statics.rs | 0 .../safe-extern-statics-mut.mir.stderr | 0 .../{ => static}/safe-extern-statics-mut.rs | 0 .../safe-extern-statics-mut.thir.stderr | 0 .../safe-extern-statics.mir.stderr | 0 .../ui/{ => static}/safe-extern-statics.rs | 0 .../safe-extern-statics.thir.stderr | 0 .../ui/{ => static}/thread-local-in-ctfe.rs | 0 .../{ => static}/thread-local-in-ctfe.stderr | 0 .../ui/{ => stdlib-unit-tests}/matches2021.rs | 0 .../minmax-stability-issue-23687.rs | 0 .../ui/{ => stdlib-unit-tests}/not-sync.rs | 0 .../{ => stdlib-unit-tests}/not-sync.stderr | 0 .../ui/{ => stdlib-unit-tests}/raw-fat-ptr.rs | 0 .../volatile-fat-ptr.rs | 0 .../ui/syntax-trait-polarity-feature-gate.rs | 10 ---- .../syntax-trait-polarity-feature-gate.stderr | 12 ----- src/test/ui/tail-direct.rs | 7 --- .../clone-with-exterior.rs | 0 .../ui/{ => threads-sendsync}/tcp-stress.rs | 0 .../{ => traits}/alignment-gep-tup-like-1.rs | 0 .../ui/{ => traits}/cycle-generic-bound.rs | 0 .../ui/{ => traits}/early-vtbl-resolution.rs | 0 src/test/ui/{ => traits}/map-types.rs | 0 src/test/ui/{ => traits}/map-types.stderr | 0 src/test/ui/{ => traits}/no_send-struct.rs | 0 .../ui/{ => traits}/no_send-struct.stderr | 0 .../try-is-identifier-edition2015.rs | 0 src/test/ui/{ => type}/type-ascription.rs | 0 .../ui/{ => typeck}/no-type-for-node-ice.rs | 0 .../{ => typeck}/no-type-for-node-ice.stderr | 0 .../{ => typeck}/project-cache-issue-37154.rs | 0 src/test/ui/{ => typeck}/ufcs-type-params.rs | 0 src/test/ui/{ => typeck}/unify-return-ty.rs | 0 .../ui/{ => unsized}/maybe-bounds-where.rs | 0 .../{ => unsized}/maybe-bounds-where.stderr | 0 src/test/ui/{ => wasm}/wasm-import-module.rs | 0 .../ui/{ => wasm}/wasm-import-module.stderr | 0 src/tools/tidy/src/ui_tests.rs | 4 +- 132 files changed, 2 insertions(+), 188 deletions(-) rename src/test/ui/{ => array-slice-vec}/byte-literals.rs (100%) rename src/test/ui/{ => attributes}/suffixed-literal-meta.rs (100%) rename src/test/ui/{ => attributes}/suffixed-literal-meta.stderr (100%) rename src/test/ui/{ => binop}/operator-multidispatch.rs (100%) rename src/test/ui/{ => binop}/operator-overloading.rs (100%) rename src/test/ui/{ => binop}/placement-syntax.rs (100%) rename src/test/ui/{ => binop}/placement-syntax.stderr (100%) rename src/test/ui/{ => borrowck}/immut-function-arguments.rs (100%) rename src/test/ui/{ => borrowck}/immut-function-arguments.stderr (100%) rename src/test/ui/{ => borrowck}/kindck-implicit-close-over-mut-var.rs (100%) rename src/test/ui/{ => cfg}/crt-static-on-works.rs (100%) rename src/test/ui/{ => closures}/once-move-out-on-heap.rs (100%) rename src/test/ui/{ => codegen}/auxiliary/llvm_pr32379.rs (100%) rename src/test/ui/{ => codegen}/init-large-type.rs (100%) rename src/test/ui/{ => codegen}/llvm-pr32379.rs (100%) rename src/test/ui/{ => coercion}/retslot-cast.rs (100%) rename src/test/ui/{ => coercion}/retslot-cast.stderr (100%) rename src/test/ui/{ => dropck}/cleanup-arm-conditional.rs (100%) rename src/test/ui/{ => editions}/edition-keywords-2015-2018.rs (100%) rename src/test/ui/{ => editions}/edition-keywords-2018-2018.rs (100%) delete mode 100644 src/test/ui/export.rs delete mode 100644 src/test/ui/export.stderr delete mode 100644 src/test/ui/expr-block-slot.rs rename src/test/ui/{ => extern}/auxiliary/no-mangle-associated-fn.rs (100%) rename src/test/ui/{ => extern}/no-mangle-associated-fn.rs (100%) rename src/test/ui/{ => fn}/fun-call-variants.rs (100%) rename src/test/ui/{ => for-loop-while}/break-outside-loop.rs (100%) rename src/test/ui/{ => for-loop-while}/break-outside-loop.stderr (100%) rename src/test/ui/{ => for-loop-while}/break-while-condition.rs (100%) rename src/test/ui/{ => for-loop-while}/break-while-condition.stderr (100%) rename src/test/ui/{ => hygiene}/thread-local-not-in-prelude.rs (100%) rename src/test/ui/{ => imports}/absolute-paths-in-nested-use-groups.rs (100%) rename src/test/ui/{ => imports}/absolute-paths-in-nested-use-groups.stderr (100%) rename src/test/ui/{ => imports}/reexport-star.rs (100%) rename src/test/ui/{ => inference}/newlambdas-ret-infer.rs (100%) rename src/test/ui/{ => inference}/newlambdas-ret-infer2.rs (100%) rename src/test/ui/{ => inference}/range-type-infer.rs (100%) rename src/test/ui/{ => inference}/tutorial-suffix-inference-test.rs (100%) rename src/test/ui/{ => inference}/tutorial-suffix-inference-test.stderr (100%) rename src/test/ui/{ => inference}/type-infer-generalize-ty-var.rs (100%) delete mode 100644 src/test/ui/leak-unique-as-tydesc.rs rename src/test/ui/{ => linkage-attr}/auxiliary/link-cfg-works-transitive-dylib.rs (100%) rename src/test/ui/{ => linkage-attr}/auxiliary/link-cfg-works-transitive-rlib.rs (100%) rename src/test/ui/{ => linkage-attr}/link-cfg-works.rs (100%) rename src/test/ui/{ => lint}/lint-cap.rs (100%) rename src/test/ui/{ => liveness}/liveness-assign-imm-local-after-ret.rs (100%) rename src/test/ui/{ => match}/match-on-negative-integer-ranges.rs (100%) rename src/test/ui/{ => mir}/issue-73914.rs (100%) rename src/test/ui/{ => mismatched_types}/assignment-operator-unimplemented.rs (100%) rename src/test/ui/{ => mismatched_types}/assignment-operator-unimplemented.stderr (100%) rename src/test/ui/{ => mismatched_types}/float-literal-inference-restrictions.rs (100%) rename src/test/ui/{ => mismatched_types}/float-literal-inference-restrictions.stderr (100%) delete mode 100644 src/test/ui/newtype-temporary.rs rename src/test/ui/{ => nll}/lub-if.nll.stderr (100%) rename src/test/ui/{ => nll}/lub-if.rs (100%) rename src/test/ui/{ => nll}/lub-if.stderr (100%) delete mode 100644 src/test/ui/non-legacy-modes.rs rename src/test/ui/{ => overloaded}/overloaded-calls-nontuple.rs (100%) rename src/test/ui/{ => overloaded}/overloaded-calls-nontuple.stderr (100%) rename src/test/ui/{ => parser}/attribute-with-no-generics-in-parameter-list.rs (100%) rename src/test/ui/{ => parser}/attribute-with-no-generics-in-parameter-list.stderr (100%) rename src/test/ui/{ => parser}/dyn-trait-compatibility.rs (100%) rename src/test/ui/{ => parser}/dyn-trait-compatibility.stderr (100%) rename src/test/ui/{ => parser}/operator-associativity.rs (100%) rename src/test/ui/{ => pattern}/ignore-all-the-things.rs (100%) rename src/test/ui/{ => privacy}/auxiliary/impl_privacy_xc_2.rs (100%) rename src/test/ui/{ => privacy}/auxiliary/reachable-unnameable-items.rs (100%) rename src/test/ui/{ => privacy}/export-tag-variant.rs (100%) rename src/test/ui/{ => privacy}/export-tag-variant.stderr (100%) rename src/test/ui/{ => privacy}/impl-privacy-xc-2.rs (100%) rename src/test/ui/{ => privacy}/reachable-unnameable-items.rs (100%) rename src/test/ui/{ => process}/core-run-destroy.rs (100%) rename src/test/ui/{ => process}/multi-panic.rs (100%) rename src/test/ui/{ => process}/no-stdio.rs (100%) rename src/test/ui/{ => process}/try-wait.rs (100%) delete mode 100644 src/test/ui/pure-sum.rs rename src/test/ui/{ => regions}/wf-bound-region-in-object-type.rs (100%) rename src/test/ui/{ => resolve}/auxiliary/blind-item-mixed-crate-use-item-foo.rs (100%) rename src/test/ui/{ => resolve}/auxiliary/blind-item-mixed-crate-use-item-foo2.rs (100%) rename src/test/ui/{ => resolve}/blind-item-mixed-crate-use-item.rs (100%) rename src/test/ui/{ => resolve}/blind-item-mixed-use-item.rs (100%) rename src/test/ui/{ => resolve}/export-fully-qualified.rs (100%) rename src/test/ui/{ => resolve}/export-fully-qualified.stderr (100%) rename src/test/ui/{ => resolve}/no-std-1.rs (100%) rename src/test/ui/{ => resolve}/no-std-2.rs (100%) rename src/test/ui/{ => resolve}/no-std-3.rs (100%) rename src/test/ui/{ => resolve}/pathless-extern-ok.rs (100%) rename src/test/ui/{ => runtime}/atomic-print.rs (100%) rename src/test/ui/{ => runtime}/backtrace-debuginfo-aux.rs (100%) rename src/test/ui/{ => runtime}/backtrace-debuginfo.rs (100%) rename src/test/ui/{ => runtime}/native-print-no-runtime.rs (100%) rename src/test/ui/{ => stability-attribute}/stability-in-private-module.rs (100%) rename src/test/ui/{ => stability-attribute}/stability-in-private-module.stderr (100%) rename src/test/ui/{ => static}/auxiliary/extern-statics.rs (100%) rename src/test/ui/{ => static}/safe-extern-statics-mut.mir.stderr (100%) rename src/test/ui/{ => static}/safe-extern-statics-mut.rs (100%) rename src/test/ui/{ => static}/safe-extern-statics-mut.thir.stderr (100%) rename src/test/ui/{ => static}/safe-extern-statics.mir.stderr (100%) rename src/test/ui/{ => static}/safe-extern-statics.rs (100%) rename src/test/ui/{ => static}/safe-extern-statics.thir.stderr (100%) rename src/test/ui/{ => static}/thread-local-in-ctfe.rs (100%) rename src/test/ui/{ => static}/thread-local-in-ctfe.stderr (100%) rename src/test/ui/{ => stdlib-unit-tests}/matches2021.rs (100%) rename src/test/ui/{ => stdlib-unit-tests}/minmax-stability-issue-23687.rs (100%) rename src/test/ui/{ => stdlib-unit-tests}/not-sync.rs (100%) rename src/test/ui/{ => stdlib-unit-tests}/not-sync.stderr (100%) rename src/test/ui/{ => stdlib-unit-tests}/raw-fat-ptr.rs (100%) rename src/test/ui/{ => stdlib-unit-tests}/volatile-fat-ptr.rs (100%) delete mode 100644 src/test/ui/syntax-trait-polarity-feature-gate.rs delete mode 100644 src/test/ui/syntax-trait-polarity-feature-gate.stderr delete mode 100644 src/test/ui/tail-direct.rs rename src/test/ui/{ => threads-sendsync}/clone-with-exterior.rs (100%) rename src/test/ui/{ => threads-sendsync}/tcp-stress.rs (100%) rename src/test/ui/{ => traits}/alignment-gep-tup-like-1.rs (100%) rename src/test/ui/{ => traits}/cycle-generic-bound.rs (100%) rename src/test/ui/{ => traits}/early-vtbl-resolution.rs (100%) rename src/test/ui/{ => traits}/map-types.rs (100%) rename src/test/ui/{ => traits}/map-types.stderr (100%) rename src/test/ui/{ => traits}/no_send-struct.rs (100%) rename src/test/ui/{ => traits}/no_send-struct.stderr (100%) rename src/test/ui/{ => try-block}/try-is-identifier-edition2015.rs (100%) rename src/test/ui/{ => type}/type-ascription.rs (100%) rename src/test/ui/{ => typeck}/no-type-for-node-ice.rs (100%) rename src/test/ui/{ => typeck}/no-type-for-node-ice.stderr (100%) rename src/test/ui/{ => typeck}/project-cache-issue-37154.rs (100%) rename src/test/ui/{ => typeck}/ufcs-type-params.rs (100%) rename src/test/ui/{ => typeck}/unify-return-ty.rs (100%) rename src/test/ui/{ => unsized}/maybe-bounds-where.rs (100%) rename src/test/ui/{ => unsized}/maybe-bounds-where.stderr (100%) rename src/test/ui/{ => wasm}/wasm-import-module.rs (100%) rename src/test/ui/{ => wasm}/wasm-import-module.stderr (100%) diff --git a/src/test/ui/byte-literals.rs b/src/test/ui/array-slice-vec/byte-literals.rs similarity index 100% rename from src/test/ui/byte-literals.rs rename to src/test/ui/array-slice-vec/byte-literals.rs diff --git a/src/test/ui/suffixed-literal-meta.rs b/src/test/ui/attributes/suffixed-literal-meta.rs similarity index 100% rename from src/test/ui/suffixed-literal-meta.rs rename to src/test/ui/attributes/suffixed-literal-meta.rs diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/attributes/suffixed-literal-meta.stderr similarity index 100% rename from src/test/ui/suffixed-literal-meta.stderr rename to src/test/ui/attributes/suffixed-literal-meta.stderr diff --git a/src/test/ui/operator-multidispatch.rs b/src/test/ui/binop/operator-multidispatch.rs similarity index 100% rename from src/test/ui/operator-multidispatch.rs rename to src/test/ui/binop/operator-multidispatch.rs diff --git a/src/test/ui/operator-overloading.rs b/src/test/ui/binop/operator-overloading.rs similarity index 100% rename from src/test/ui/operator-overloading.rs rename to src/test/ui/binop/operator-overloading.rs diff --git a/src/test/ui/placement-syntax.rs b/src/test/ui/binop/placement-syntax.rs similarity index 100% rename from src/test/ui/placement-syntax.rs rename to src/test/ui/binop/placement-syntax.rs diff --git a/src/test/ui/placement-syntax.stderr b/src/test/ui/binop/placement-syntax.stderr similarity index 100% rename from src/test/ui/placement-syntax.stderr rename to src/test/ui/binop/placement-syntax.stderr diff --git a/src/test/ui/immut-function-arguments.rs b/src/test/ui/borrowck/immut-function-arguments.rs similarity index 100% rename from src/test/ui/immut-function-arguments.rs rename to src/test/ui/borrowck/immut-function-arguments.rs diff --git a/src/test/ui/immut-function-arguments.stderr b/src/test/ui/borrowck/immut-function-arguments.stderr similarity index 100% rename from src/test/ui/immut-function-arguments.stderr rename to src/test/ui/borrowck/immut-function-arguments.stderr diff --git a/src/test/ui/kindck-implicit-close-over-mut-var.rs b/src/test/ui/borrowck/kindck-implicit-close-over-mut-var.rs similarity index 100% rename from src/test/ui/kindck-implicit-close-over-mut-var.rs rename to src/test/ui/borrowck/kindck-implicit-close-over-mut-var.rs diff --git a/src/test/ui/crt-static-on-works.rs b/src/test/ui/cfg/crt-static-on-works.rs similarity index 100% rename from src/test/ui/crt-static-on-works.rs rename to src/test/ui/cfg/crt-static-on-works.rs diff --git a/src/test/ui/once-move-out-on-heap.rs b/src/test/ui/closures/once-move-out-on-heap.rs similarity index 100% rename from src/test/ui/once-move-out-on-heap.rs rename to src/test/ui/closures/once-move-out-on-heap.rs diff --git a/src/test/ui/auxiliary/llvm_pr32379.rs b/src/test/ui/codegen/auxiliary/llvm_pr32379.rs similarity index 100% rename from src/test/ui/auxiliary/llvm_pr32379.rs rename to src/test/ui/codegen/auxiliary/llvm_pr32379.rs diff --git a/src/test/ui/init-large-type.rs b/src/test/ui/codegen/init-large-type.rs similarity index 100% rename from src/test/ui/init-large-type.rs rename to src/test/ui/codegen/init-large-type.rs diff --git a/src/test/ui/llvm-pr32379.rs b/src/test/ui/codegen/llvm-pr32379.rs similarity index 100% rename from src/test/ui/llvm-pr32379.rs rename to src/test/ui/codegen/llvm-pr32379.rs diff --git a/src/test/ui/retslot-cast.rs b/src/test/ui/coercion/retslot-cast.rs similarity index 100% rename from src/test/ui/retslot-cast.rs rename to src/test/ui/coercion/retslot-cast.rs diff --git a/src/test/ui/retslot-cast.stderr b/src/test/ui/coercion/retslot-cast.stderr similarity index 100% rename from src/test/ui/retslot-cast.stderr rename to src/test/ui/coercion/retslot-cast.stderr diff --git a/src/test/ui/cleanup-arm-conditional.rs b/src/test/ui/dropck/cleanup-arm-conditional.rs similarity index 100% rename from src/test/ui/cleanup-arm-conditional.rs rename to src/test/ui/dropck/cleanup-arm-conditional.rs diff --git a/src/test/ui/edition-keywords-2015-2018.rs b/src/test/ui/editions/edition-keywords-2015-2018.rs similarity index 100% rename from src/test/ui/edition-keywords-2015-2018.rs rename to src/test/ui/editions/edition-keywords-2015-2018.rs diff --git a/src/test/ui/edition-keywords-2018-2018.rs b/src/test/ui/editions/edition-keywords-2018-2018.rs similarity index 100% rename from src/test/ui/edition-keywords-2018-2018.rs rename to src/test/ui/editions/edition-keywords-2018-2018.rs diff --git a/src/test/ui/export.rs b/src/test/ui/export.rs deleted file mode 100644 index 73ceec6803a9..000000000000 --- a/src/test/ui/export.rs +++ /dev/null @@ -1,10 +0,0 @@ -mod foo { - pub fn x(y: isize) { log(debug, y); } - //~^ ERROR cannot find function `log` in this scope - //~| ERROR cannot find value `debug` in this scope - fn z(y: isize) { log(debug, y); } - //~^ ERROR cannot find function `log` in this scope - //~| ERROR cannot find value `debug` in this scope -} - -fn main() { foo::z(10); } //~ ERROR function `z` is private diff --git a/src/test/ui/export.stderr b/src/test/ui/export.stderr deleted file mode 100644 index 23c29b31c6a8..000000000000 --- a/src/test/ui/export.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error[E0425]: cannot find function `log` in this scope - --> $DIR/export.rs:2:26 - | -LL | pub fn x(y: isize) { log(debug, y); } - | ^^^ not found in this scope - -error[E0425]: cannot find value `debug` in this scope - --> $DIR/export.rs:2:30 - | -LL | pub fn x(y: isize) { log(debug, y); } - | ^^^^^ not found in this scope - -error[E0425]: cannot find function `log` in this scope - --> $DIR/export.rs:5:22 - | -LL | fn z(y: isize) { log(debug, y); } - | ^^^ not found in this scope - -error[E0425]: cannot find value `debug` in this scope - --> $DIR/export.rs:5:26 - | -LL | fn z(y: isize) { log(debug, y); } - | ^^^^^ not found in this scope - -error[E0603]: function `z` is private - --> $DIR/export.rs:10:18 - | -LL | fn main() { foo::z(10); } - | ^ private function - | -note: the function `z` is defined here - --> $DIR/export.rs:5:5 - | -LL | fn z(y: isize) { log(debug, y); } - | ^^^^^^^^^^^^^^ - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0425, E0603. -For more information about an error, try `rustc --explain E0425`. diff --git a/src/test/ui/expr-block-slot.rs b/src/test/ui/expr-block-slot.rs deleted file mode 100644 index 54bcbb328b03..000000000000 --- a/src/test/ui/expr-block-slot.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-pass -// Regression test for issue #377 - - -struct A { a: isize } -struct V { v: isize } - -pub fn main() { - let a = { let b = A {a: 3}; b }; - assert_eq!(a.a, 3); - let c = { let d = V {v: 3}; d }; - assert_eq!(c.v, 3); -} diff --git a/src/test/ui/auxiliary/no-mangle-associated-fn.rs b/src/test/ui/extern/auxiliary/no-mangle-associated-fn.rs similarity index 100% rename from src/test/ui/auxiliary/no-mangle-associated-fn.rs rename to src/test/ui/extern/auxiliary/no-mangle-associated-fn.rs diff --git a/src/test/ui/no-mangle-associated-fn.rs b/src/test/ui/extern/no-mangle-associated-fn.rs similarity index 100% rename from src/test/ui/no-mangle-associated-fn.rs rename to src/test/ui/extern/no-mangle-associated-fn.rs diff --git a/src/test/ui/fun-call-variants.rs b/src/test/ui/fn/fun-call-variants.rs similarity index 100% rename from src/test/ui/fun-call-variants.rs rename to src/test/ui/fn/fun-call-variants.rs diff --git a/src/test/ui/break-outside-loop.rs b/src/test/ui/for-loop-while/break-outside-loop.rs similarity index 100% rename from src/test/ui/break-outside-loop.rs rename to src/test/ui/for-loop-while/break-outside-loop.rs diff --git a/src/test/ui/break-outside-loop.stderr b/src/test/ui/for-loop-while/break-outside-loop.stderr similarity index 100% rename from src/test/ui/break-outside-loop.stderr rename to src/test/ui/for-loop-while/break-outside-loop.stderr diff --git a/src/test/ui/break-while-condition.rs b/src/test/ui/for-loop-while/break-while-condition.rs similarity index 100% rename from src/test/ui/break-while-condition.rs rename to src/test/ui/for-loop-while/break-while-condition.rs diff --git a/src/test/ui/break-while-condition.stderr b/src/test/ui/for-loop-while/break-while-condition.stderr similarity index 100% rename from src/test/ui/break-while-condition.stderr rename to src/test/ui/for-loop-while/break-while-condition.stderr diff --git a/src/test/ui/thread-local-not-in-prelude.rs b/src/test/ui/hygiene/thread-local-not-in-prelude.rs similarity index 100% rename from src/test/ui/thread-local-not-in-prelude.rs rename to src/test/ui/hygiene/thread-local-not-in-prelude.rs diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.rs b/src/test/ui/imports/absolute-paths-in-nested-use-groups.rs similarity index 100% rename from src/test/ui/absolute-paths-in-nested-use-groups.rs rename to src/test/ui/imports/absolute-paths-in-nested-use-groups.rs diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.stderr b/src/test/ui/imports/absolute-paths-in-nested-use-groups.stderr similarity index 100% rename from src/test/ui/absolute-paths-in-nested-use-groups.stderr rename to src/test/ui/imports/absolute-paths-in-nested-use-groups.stderr diff --git a/src/test/ui/reexport-star.rs b/src/test/ui/imports/reexport-star.rs similarity index 100% rename from src/test/ui/reexport-star.rs rename to src/test/ui/imports/reexport-star.rs diff --git a/src/test/ui/newlambdas-ret-infer.rs b/src/test/ui/inference/newlambdas-ret-infer.rs similarity index 100% rename from src/test/ui/newlambdas-ret-infer.rs rename to src/test/ui/inference/newlambdas-ret-infer.rs diff --git a/src/test/ui/newlambdas-ret-infer2.rs b/src/test/ui/inference/newlambdas-ret-infer2.rs similarity index 100% rename from src/test/ui/newlambdas-ret-infer2.rs rename to src/test/ui/inference/newlambdas-ret-infer2.rs diff --git a/src/test/ui/range-type-infer.rs b/src/test/ui/inference/range-type-infer.rs similarity index 100% rename from src/test/ui/range-type-infer.rs rename to src/test/ui/inference/range-type-infer.rs diff --git a/src/test/ui/tutorial-suffix-inference-test.rs b/src/test/ui/inference/tutorial-suffix-inference-test.rs similarity index 100% rename from src/test/ui/tutorial-suffix-inference-test.rs rename to src/test/ui/inference/tutorial-suffix-inference-test.rs diff --git a/src/test/ui/tutorial-suffix-inference-test.stderr b/src/test/ui/inference/tutorial-suffix-inference-test.stderr similarity index 100% rename from src/test/ui/tutorial-suffix-inference-test.stderr rename to src/test/ui/inference/tutorial-suffix-inference-test.stderr diff --git a/src/test/ui/type-infer-generalize-ty-var.rs b/src/test/ui/inference/type-infer-generalize-ty-var.rs similarity index 100% rename from src/test/ui/type-infer-generalize-ty-var.rs rename to src/test/ui/inference/type-infer-generalize-ty-var.rs diff --git a/src/test/ui/leak-unique-as-tydesc.rs b/src/test/ui/leak-unique-as-tydesc.rs deleted file mode 100644 index 322f726156d0..000000000000 --- a/src/test/ui/leak-unique-as-tydesc.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -fn leaky(_t: T) { } - -pub fn main() { - let x = Box::new(10); - leaky::>(x); -} diff --git a/src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs b/src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs similarity index 100% rename from src/test/ui/auxiliary/link-cfg-works-transitive-dylib.rs rename to src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs diff --git a/src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs b/src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs similarity index 100% rename from src/test/ui/auxiliary/link-cfg-works-transitive-rlib.rs rename to src/test/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs diff --git a/src/test/ui/link-cfg-works.rs b/src/test/ui/linkage-attr/link-cfg-works.rs similarity index 100% rename from src/test/ui/link-cfg-works.rs rename to src/test/ui/linkage-attr/link-cfg-works.rs diff --git a/src/test/ui/lint-cap.rs b/src/test/ui/lint/lint-cap.rs similarity index 100% rename from src/test/ui/lint-cap.rs rename to src/test/ui/lint/lint-cap.rs diff --git a/src/test/ui/liveness-assign-imm-local-after-ret.rs b/src/test/ui/liveness/liveness-assign-imm-local-after-ret.rs similarity index 100% rename from src/test/ui/liveness-assign-imm-local-after-ret.rs rename to src/test/ui/liveness/liveness-assign-imm-local-after-ret.rs diff --git a/src/test/ui/match-on-negative-integer-ranges.rs b/src/test/ui/match/match-on-negative-integer-ranges.rs similarity index 100% rename from src/test/ui/match-on-negative-integer-ranges.rs rename to src/test/ui/match/match-on-negative-integer-ranges.rs diff --git a/src/test/ui/issue-73914.rs b/src/test/ui/mir/issue-73914.rs similarity index 100% rename from src/test/ui/issue-73914.rs rename to src/test/ui/mir/issue-73914.rs diff --git a/src/test/ui/assignment-operator-unimplemented.rs b/src/test/ui/mismatched_types/assignment-operator-unimplemented.rs similarity index 100% rename from src/test/ui/assignment-operator-unimplemented.rs rename to src/test/ui/mismatched_types/assignment-operator-unimplemented.rs diff --git a/src/test/ui/assignment-operator-unimplemented.stderr b/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr similarity index 100% rename from src/test/ui/assignment-operator-unimplemented.stderr rename to src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr diff --git a/src/test/ui/float-literal-inference-restrictions.rs b/src/test/ui/mismatched_types/float-literal-inference-restrictions.rs similarity index 100% rename from src/test/ui/float-literal-inference-restrictions.rs rename to src/test/ui/mismatched_types/float-literal-inference-restrictions.rs diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/mismatched_types/float-literal-inference-restrictions.stderr similarity index 100% rename from src/test/ui/float-literal-inference-restrictions.stderr rename to src/test/ui/mismatched_types/float-literal-inference-restrictions.stderr diff --git a/src/test/ui/newtype-temporary.rs b/src/test/ui/newtype-temporary.rs deleted file mode 100644 index 8ee75b2fef11..000000000000 --- a/src/test/ui/newtype-temporary.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass - -#[derive(PartialEq, Debug)] -struct Foo(usize); - -fn foo() -> Foo { - Foo(42) -} - -pub fn main() { - assert_eq!(foo(), Foo(42)); -} diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/nll/lub-if.nll.stderr similarity index 100% rename from src/test/ui/lub-if.nll.stderr rename to src/test/ui/nll/lub-if.nll.stderr diff --git a/src/test/ui/lub-if.rs b/src/test/ui/nll/lub-if.rs similarity index 100% rename from src/test/ui/lub-if.rs rename to src/test/ui/nll/lub-if.rs diff --git a/src/test/ui/lub-if.stderr b/src/test/ui/nll/lub-if.stderr similarity index 100% rename from src/test/ui/lub-if.stderr rename to src/test/ui/nll/lub-if.stderr diff --git a/src/test/ui/non-legacy-modes.rs b/src/test/ui/non-legacy-modes.rs deleted file mode 100644 index 38c83e00a6ad..000000000000 --- a/src/test/ui/non-legacy-modes.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass - -struct X { - repr: isize -} - -fn apply(x: T, f: F) where F: FnOnce(T) { - f(x); -} - -fn check_int(x: isize) { - assert_eq!(x, 22); -} - -fn check_struct(x: X) { - check_int(x.repr); -} - -pub fn main() { - apply(22, check_int); - apply(X {repr: 22}, check_struct); -} diff --git a/src/test/ui/overloaded-calls-nontuple.rs b/src/test/ui/overloaded/overloaded-calls-nontuple.rs similarity index 100% rename from src/test/ui/overloaded-calls-nontuple.rs rename to src/test/ui/overloaded/overloaded-calls-nontuple.rs diff --git a/src/test/ui/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded/overloaded-calls-nontuple.stderr similarity index 100% rename from src/test/ui/overloaded-calls-nontuple.stderr rename to src/test/ui/overloaded/overloaded-calls-nontuple.stderr diff --git a/src/test/ui/attribute-with-no-generics-in-parameter-list.rs b/src/test/ui/parser/attribute-with-no-generics-in-parameter-list.rs similarity index 100% rename from src/test/ui/attribute-with-no-generics-in-parameter-list.rs rename to src/test/ui/parser/attribute-with-no-generics-in-parameter-list.rs diff --git a/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr b/src/test/ui/parser/attribute-with-no-generics-in-parameter-list.stderr similarity index 100% rename from src/test/ui/attribute-with-no-generics-in-parameter-list.stderr rename to src/test/ui/parser/attribute-with-no-generics-in-parameter-list.stderr diff --git a/src/test/ui/dyn-trait-compatibility.rs b/src/test/ui/parser/dyn-trait-compatibility.rs similarity index 100% rename from src/test/ui/dyn-trait-compatibility.rs rename to src/test/ui/parser/dyn-trait-compatibility.rs diff --git a/src/test/ui/dyn-trait-compatibility.stderr b/src/test/ui/parser/dyn-trait-compatibility.stderr similarity index 100% rename from src/test/ui/dyn-trait-compatibility.stderr rename to src/test/ui/parser/dyn-trait-compatibility.stderr diff --git a/src/test/ui/operator-associativity.rs b/src/test/ui/parser/operator-associativity.rs similarity index 100% rename from src/test/ui/operator-associativity.rs rename to src/test/ui/parser/operator-associativity.rs diff --git a/src/test/ui/ignore-all-the-things.rs b/src/test/ui/pattern/ignore-all-the-things.rs similarity index 100% rename from src/test/ui/ignore-all-the-things.rs rename to src/test/ui/pattern/ignore-all-the-things.rs diff --git a/src/test/ui/auxiliary/impl_privacy_xc_2.rs b/src/test/ui/privacy/auxiliary/impl_privacy_xc_2.rs similarity index 100% rename from src/test/ui/auxiliary/impl_privacy_xc_2.rs rename to src/test/ui/privacy/auxiliary/impl_privacy_xc_2.rs diff --git a/src/test/ui/auxiliary/reachable-unnameable-items.rs b/src/test/ui/privacy/auxiliary/reachable-unnameable-items.rs similarity index 100% rename from src/test/ui/auxiliary/reachable-unnameable-items.rs rename to src/test/ui/privacy/auxiliary/reachable-unnameable-items.rs diff --git a/src/test/ui/export-tag-variant.rs b/src/test/ui/privacy/export-tag-variant.rs similarity index 100% rename from src/test/ui/export-tag-variant.rs rename to src/test/ui/privacy/export-tag-variant.rs diff --git a/src/test/ui/export-tag-variant.stderr b/src/test/ui/privacy/export-tag-variant.stderr similarity index 100% rename from src/test/ui/export-tag-variant.stderr rename to src/test/ui/privacy/export-tag-variant.stderr diff --git a/src/test/ui/impl-privacy-xc-2.rs b/src/test/ui/privacy/impl-privacy-xc-2.rs similarity index 100% rename from src/test/ui/impl-privacy-xc-2.rs rename to src/test/ui/privacy/impl-privacy-xc-2.rs diff --git a/src/test/ui/reachable-unnameable-items.rs b/src/test/ui/privacy/reachable-unnameable-items.rs similarity index 100% rename from src/test/ui/reachable-unnameable-items.rs rename to src/test/ui/privacy/reachable-unnameable-items.rs diff --git a/src/test/ui/core-run-destroy.rs b/src/test/ui/process/core-run-destroy.rs similarity index 100% rename from src/test/ui/core-run-destroy.rs rename to src/test/ui/process/core-run-destroy.rs diff --git a/src/test/ui/multi-panic.rs b/src/test/ui/process/multi-panic.rs similarity index 100% rename from src/test/ui/multi-panic.rs rename to src/test/ui/process/multi-panic.rs diff --git a/src/test/ui/no-stdio.rs b/src/test/ui/process/no-stdio.rs similarity index 100% rename from src/test/ui/no-stdio.rs rename to src/test/ui/process/no-stdio.rs diff --git a/src/test/ui/try-wait.rs b/src/test/ui/process/try-wait.rs similarity index 100% rename from src/test/ui/try-wait.rs rename to src/test/ui/process/try-wait.rs diff --git a/src/test/ui/pure-sum.rs b/src/test/ui/pure-sum.rs deleted file mode 100644 index 2f2ece75ebee..000000000000 --- a/src/test/ui/pure-sum.rs +++ /dev/null @@ -1,51 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// Check that functions can modify local state. - -// pretty-expanded FIXME #23616 - -fn sums_to(v: Vec , sum: isize) -> bool { - let mut i = 0; - let mut sum0 = 0; - while i < v.len() { - sum0 += v[i]; - i += 1; - } - return sum0 == sum; -} - -fn sums_to_using_uniq(v: Vec , sum: isize) -> bool { - let mut i = 0; - let mut sum0: Box<_> = 0.into(); - while i < v.len() { - *sum0 += v[i]; - i += 1; - } - return *sum0 == sum; -} - -fn sums_to_using_rec(v: Vec , sum: isize) -> bool { - let mut i = 0; - let mut sum0 = F {f: 0}; - while i < v.len() { - sum0.f += v[i]; - i += 1; - } - return sum0.f == sum; -} - -struct F { f: T } - -fn sums_to_using_uniq_rec(v: Vec , sum: isize) -> bool { - let mut i = 0; - let mut sum0 = F::> {f: 0.into() }; - while i < v.len() { - *sum0.f += v[i]; - i += 1; - } - return *sum0.f == sum; -} - -pub fn main() { -} diff --git a/src/test/ui/wf-bound-region-in-object-type.rs b/src/test/ui/regions/wf-bound-region-in-object-type.rs similarity index 100% rename from src/test/ui/wf-bound-region-in-object-type.rs rename to src/test/ui/regions/wf-bound-region-in-object-type.rs diff --git a/src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo.rs b/src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo.rs similarity index 100% rename from src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo.rs rename to src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo.rs diff --git a/src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo2.rs b/src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo2.rs similarity index 100% rename from src/test/ui/auxiliary/blind-item-mixed-crate-use-item-foo2.rs rename to src/test/ui/resolve/auxiliary/blind-item-mixed-crate-use-item-foo2.rs diff --git a/src/test/ui/blind-item-mixed-crate-use-item.rs b/src/test/ui/resolve/blind-item-mixed-crate-use-item.rs similarity index 100% rename from src/test/ui/blind-item-mixed-crate-use-item.rs rename to src/test/ui/resolve/blind-item-mixed-crate-use-item.rs diff --git a/src/test/ui/blind-item-mixed-use-item.rs b/src/test/ui/resolve/blind-item-mixed-use-item.rs similarity index 100% rename from src/test/ui/blind-item-mixed-use-item.rs rename to src/test/ui/resolve/blind-item-mixed-use-item.rs diff --git a/src/test/ui/export-fully-qualified.rs b/src/test/ui/resolve/export-fully-qualified.rs similarity index 100% rename from src/test/ui/export-fully-qualified.rs rename to src/test/ui/resolve/export-fully-qualified.rs diff --git a/src/test/ui/export-fully-qualified.stderr b/src/test/ui/resolve/export-fully-qualified.stderr similarity index 100% rename from src/test/ui/export-fully-qualified.stderr rename to src/test/ui/resolve/export-fully-qualified.stderr diff --git a/src/test/ui/no-std-1.rs b/src/test/ui/resolve/no-std-1.rs similarity index 100% rename from src/test/ui/no-std-1.rs rename to src/test/ui/resolve/no-std-1.rs diff --git a/src/test/ui/no-std-2.rs b/src/test/ui/resolve/no-std-2.rs similarity index 100% rename from src/test/ui/no-std-2.rs rename to src/test/ui/resolve/no-std-2.rs diff --git a/src/test/ui/no-std-3.rs b/src/test/ui/resolve/no-std-3.rs similarity index 100% rename from src/test/ui/no-std-3.rs rename to src/test/ui/resolve/no-std-3.rs diff --git a/src/test/ui/pathless-extern-ok.rs b/src/test/ui/resolve/pathless-extern-ok.rs similarity index 100% rename from src/test/ui/pathless-extern-ok.rs rename to src/test/ui/resolve/pathless-extern-ok.rs diff --git a/src/test/ui/atomic-print.rs b/src/test/ui/runtime/atomic-print.rs similarity index 100% rename from src/test/ui/atomic-print.rs rename to src/test/ui/runtime/atomic-print.rs diff --git a/src/test/ui/backtrace-debuginfo-aux.rs b/src/test/ui/runtime/backtrace-debuginfo-aux.rs similarity index 100% rename from src/test/ui/backtrace-debuginfo-aux.rs rename to src/test/ui/runtime/backtrace-debuginfo-aux.rs diff --git a/src/test/ui/backtrace-debuginfo.rs b/src/test/ui/runtime/backtrace-debuginfo.rs similarity index 100% rename from src/test/ui/backtrace-debuginfo.rs rename to src/test/ui/runtime/backtrace-debuginfo.rs diff --git a/src/test/ui/native-print-no-runtime.rs b/src/test/ui/runtime/native-print-no-runtime.rs similarity index 100% rename from src/test/ui/native-print-no-runtime.rs rename to src/test/ui/runtime/native-print-no-runtime.rs diff --git a/src/test/ui/stability-in-private-module.rs b/src/test/ui/stability-attribute/stability-in-private-module.rs similarity index 100% rename from src/test/ui/stability-in-private-module.rs rename to src/test/ui/stability-attribute/stability-in-private-module.rs diff --git a/src/test/ui/stability-in-private-module.stderr b/src/test/ui/stability-attribute/stability-in-private-module.stderr similarity index 100% rename from src/test/ui/stability-in-private-module.stderr rename to src/test/ui/stability-attribute/stability-in-private-module.stderr diff --git a/src/test/ui/auxiliary/extern-statics.rs b/src/test/ui/static/auxiliary/extern-statics.rs similarity index 100% rename from src/test/ui/auxiliary/extern-statics.rs rename to src/test/ui/static/auxiliary/extern-statics.rs diff --git a/src/test/ui/safe-extern-statics-mut.mir.stderr b/src/test/ui/static/safe-extern-statics-mut.mir.stderr similarity index 100% rename from src/test/ui/safe-extern-statics-mut.mir.stderr rename to src/test/ui/static/safe-extern-statics-mut.mir.stderr diff --git a/src/test/ui/safe-extern-statics-mut.rs b/src/test/ui/static/safe-extern-statics-mut.rs similarity index 100% rename from src/test/ui/safe-extern-statics-mut.rs rename to src/test/ui/static/safe-extern-statics-mut.rs diff --git a/src/test/ui/safe-extern-statics-mut.thir.stderr b/src/test/ui/static/safe-extern-statics-mut.thir.stderr similarity index 100% rename from src/test/ui/safe-extern-statics-mut.thir.stderr rename to src/test/ui/static/safe-extern-statics-mut.thir.stderr diff --git a/src/test/ui/safe-extern-statics.mir.stderr b/src/test/ui/static/safe-extern-statics.mir.stderr similarity index 100% rename from src/test/ui/safe-extern-statics.mir.stderr rename to src/test/ui/static/safe-extern-statics.mir.stderr diff --git a/src/test/ui/safe-extern-statics.rs b/src/test/ui/static/safe-extern-statics.rs similarity index 100% rename from src/test/ui/safe-extern-statics.rs rename to src/test/ui/static/safe-extern-statics.rs diff --git a/src/test/ui/safe-extern-statics.thir.stderr b/src/test/ui/static/safe-extern-statics.thir.stderr similarity index 100% rename from src/test/ui/safe-extern-statics.thir.stderr rename to src/test/ui/static/safe-extern-statics.thir.stderr diff --git a/src/test/ui/thread-local-in-ctfe.rs b/src/test/ui/static/thread-local-in-ctfe.rs similarity index 100% rename from src/test/ui/thread-local-in-ctfe.rs rename to src/test/ui/static/thread-local-in-ctfe.rs diff --git a/src/test/ui/thread-local-in-ctfe.stderr b/src/test/ui/static/thread-local-in-ctfe.stderr similarity index 100% rename from src/test/ui/thread-local-in-ctfe.stderr rename to src/test/ui/static/thread-local-in-ctfe.stderr diff --git a/src/test/ui/matches2021.rs b/src/test/ui/stdlib-unit-tests/matches2021.rs similarity index 100% rename from src/test/ui/matches2021.rs rename to src/test/ui/stdlib-unit-tests/matches2021.rs diff --git a/src/test/ui/minmax-stability-issue-23687.rs b/src/test/ui/stdlib-unit-tests/minmax-stability-issue-23687.rs similarity index 100% rename from src/test/ui/minmax-stability-issue-23687.rs rename to src/test/ui/stdlib-unit-tests/minmax-stability-issue-23687.rs diff --git a/src/test/ui/not-sync.rs b/src/test/ui/stdlib-unit-tests/not-sync.rs similarity index 100% rename from src/test/ui/not-sync.rs rename to src/test/ui/stdlib-unit-tests/not-sync.rs diff --git a/src/test/ui/not-sync.stderr b/src/test/ui/stdlib-unit-tests/not-sync.stderr similarity index 100% rename from src/test/ui/not-sync.stderr rename to src/test/ui/stdlib-unit-tests/not-sync.stderr diff --git a/src/test/ui/raw-fat-ptr.rs b/src/test/ui/stdlib-unit-tests/raw-fat-ptr.rs similarity index 100% rename from src/test/ui/raw-fat-ptr.rs rename to src/test/ui/stdlib-unit-tests/raw-fat-ptr.rs diff --git a/src/test/ui/volatile-fat-ptr.rs b/src/test/ui/stdlib-unit-tests/volatile-fat-ptr.rs similarity index 100% rename from src/test/ui/volatile-fat-ptr.rs rename to src/test/ui/stdlib-unit-tests/volatile-fat-ptr.rs diff --git a/src/test/ui/syntax-trait-polarity-feature-gate.rs b/src/test/ui/syntax-trait-polarity-feature-gate.rs deleted file mode 100644 index 4a3b24383abc..000000000000 --- a/src/test/ui/syntax-trait-polarity-feature-gate.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::marker::Send; - -struct TestType; - -trait TestTrait {} - -impl !Send for TestType {} -//~^ ERROR negative trait bounds - -fn main() {} diff --git a/src/test/ui/syntax-trait-polarity-feature-gate.stderr b/src/test/ui/syntax-trait-polarity-feature-gate.stderr deleted file mode 100644 index 3562deecbd52..000000000000 --- a/src/test/ui/syntax-trait-polarity-feature-gate.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now - --> $DIR/syntax-trait-polarity-feature-gate.rs:7:6 - | -LL | impl !Send for TestType {} - | ^^^^^ - | - = note: see issue #68318 for more information - = help: add `#![feature(negative_impls)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/tail-direct.rs b/src/test/ui/tail-direct.rs deleted file mode 100644 index c67c5b7a555c..000000000000 --- a/src/test/ui/tail-direct.rs +++ /dev/null @@ -1,7 +0,0 @@ -// run-pass - -pub fn main() { assert!((even(42))); assert!((odd(45))); } - -fn even(n: isize) -> bool { if n == 0 { return true; } else { return odd(n - 1); } } - -fn odd(n: isize) -> bool { if n == 0 { return false; } else { return even(n - 1); } } diff --git a/src/test/ui/clone-with-exterior.rs b/src/test/ui/threads-sendsync/clone-with-exterior.rs similarity index 100% rename from src/test/ui/clone-with-exterior.rs rename to src/test/ui/threads-sendsync/clone-with-exterior.rs diff --git a/src/test/ui/tcp-stress.rs b/src/test/ui/threads-sendsync/tcp-stress.rs similarity index 100% rename from src/test/ui/tcp-stress.rs rename to src/test/ui/threads-sendsync/tcp-stress.rs diff --git a/src/test/ui/alignment-gep-tup-like-1.rs b/src/test/ui/traits/alignment-gep-tup-like-1.rs similarity index 100% rename from src/test/ui/alignment-gep-tup-like-1.rs rename to src/test/ui/traits/alignment-gep-tup-like-1.rs diff --git a/src/test/ui/cycle-generic-bound.rs b/src/test/ui/traits/cycle-generic-bound.rs similarity index 100% rename from src/test/ui/cycle-generic-bound.rs rename to src/test/ui/traits/cycle-generic-bound.rs diff --git a/src/test/ui/early-vtbl-resolution.rs b/src/test/ui/traits/early-vtbl-resolution.rs similarity index 100% rename from src/test/ui/early-vtbl-resolution.rs rename to src/test/ui/traits/early-vtbl-resolution.rs diff --git a/src/test/ui/map-types.rs b/src/test/ui/traits/map-types.rs similarity index 100% rename from src/test/ui/map-types.rs rename to src/test/ui/traits/map-types.rs diff --git a/src/test/ui/map-types.stderr b/src/test/ui/traits/map-types.stderr similarity index 100% rename from src/test/ui/map-types.stderr rename to src/test/ui/traits/map-types.stderr diff --git a/src/test/ui/no_send-struct.rs b/src/test/ui/traits/no_send-struct.rs similarity index 100% rename from src/test/ui/no_send-struct.rs rename to src/test/ui/traits/no_send-struct.rs diff --git a/src/test/ui/no_send-struct.stderr b/src/test/ui/traits/no_send-struct.stderr similarity index 100% rename from src/test/ui/no_send-struct.stderr rename to src/test/ui/traits/no_send-struct.stderr diff --git a/src/test/ui/try-is-identifier-edition2015.rs b/src/test/ui/try-block/try-is-identifier-edition2015.rs similarity index 100% rename from src/test/ui/try-is-identifier-edition2015.rs rename to src/test/ui/try-block/try-is-identifier-edition2015.rs diff --git a/src/test/ui/type-ascription.rs b/src/test/ui/type/type-ascription.rs similarity index 100% rename from src/test/ui/type-ascription.rs rename to src/test/ui/type/type-ascription.rs diff --git a/src/test/ui/no-type-for-node-ice.rs b/src/test/ui/typeck/no-type-for-node-ice.rs similarity index 100% rename from src/test/ui/no-type-for-node-ice.rs rename to src/test/ui/typeck/no-type-for-node-ice.rs diff --git a/src/test/ui/no-type-for-node-ice.stderr b/src/test/ui/typeck/no-type-for-node-ice.stderr similarity index 100% rename from src/test/ui/no-type-for-node-ice.stderr rename to src/test/ui/typeck/no-type-for-node-ice.stderr diff --git a/src/test/ui/project-cache-issue-37154.rs b/src/test/ui/typeck/project-cache-issue-37154.rs similarity index 100% rename from src/test/ui/project-cache-issue-37154.rs rename to src/test/ui/typeck/project-cache-issue-37154.rs diff --git a/src/test/ui/ufcs-type-params.rs b/src/test/ui/typeck/ufcs-type-params.rs similarity index 100% rename from src/test/ui/ufcs-type-params.rs rename to src/test/ui/typeck/ufcs-type-params.rs diff --git a/src/test/ui/unify-return-ty.rs b/src/test/ui/typeck/unify-return-ty.rs similarity index 100% rename from src/test/ui/unify-return-ty.rs rename to src/test/ui/typeck/unify-return-ty.rs diff --git a/src/test/ui/maybe-bounds-where.rs b/src/test/ui/unsized/maybe-bounds-where.rs similarity index 100% rename from src/test/ui/maybe-bounds-where.rs rename to src/test/ui/unsized/maybe-bounds-where.rs diff --git a/src/test/ui/maybe-bounds-where.stderr b/src/test/ui/unsized/maybe-bounds-where.stderr similarity index 100% rename from src/test/ui/maybe-bounds-where.stderr rename to src/test/ui/unsized/maybe-bounds-where.stderr diff --git a/src/test/ui/wasm-import-module.rs b/src/test/ui/wasm/wasm-import-module.rs similarity index 100% rename from src/test/ui/wasm-import-module.rs rename to src/test/ui/wasm/wasm-import-module.rs diff --git a/src/test/ui/wasm-import-module.stderr b/src/test/ui/wasm/wasm-import-module.stderr similarity index 100% rename from src/test/ui/wasm-import-module.stderr rename to src/test/ui/wasm/wasm-import-module.stderr diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 681b2486d07c..248d4f1583f8 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -7,9 +7,9 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 1102; +const ROOT_ENTRY_LIMIT: usize = 983; const ISSUES_ENTRY_LIMIT: usize = 2310; -const PARSER_LIMIT: usize = 1005; +const PARSER_LIMIT: usize = 1010; fn check_entries(path: &Path, bad: &mut bool) { let dirs = walkdir::WalkDir::new(&path.join("test/ui")) From 8ace1929886d0bd8a0f7a56e291b002fe006d59a Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 18 Nov 2021 18:44:14 +0100 Subject: [PATCH 10/11] bless nll --- .../ui/const-generics/invariant.nll.stderr | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/ui/const-generics/invariant.nll.stderr diff --git a/src/test/ui/const-generics/invariant.nll.stderr b/src/test/ui/const-generics/invariant.nll.stderr new file mode 100644 index 000000000000..ce0fad104713 --- /dev/null +++ b/src/test/ui/const-generics/invariant.nll.stderr @@ -0,0 +1,26 @@ +warning: conflicting implementations of trait `SadBee` for type `for<'a> fn(&'a ())` + --> $DIR/invariant.rs:14:1 + | +LL | impl SadBee for for<'a> fn(&'a ()) { + | ---------------------------------- first implementation here +... +LL | impl SadBee for fn(&'static ()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())` + | + = note: `#[warn(coherence_leak_check)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56105 + = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + +error[E0308]: mismatched types + --> $DIR/invariant.rs:27:5 + | +LL | v + | ^ one type is more general than the other + | + = note: expected reference `&Foo` + found reference `&Foo fn(&'a ())>` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. From 0a89598dbdf830ed16204a240e7b4f95c26f7ab4 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 16 Nov 2021 09:49:15 +1100 Subject: [PATCH 11/11] Add some comments. Also use `Default::default()` in one `TypedArena::default()`, for consistency with `DroplessArena::default()`. --- compiler/rustc_arena/src/lib.rs | 15 ++++++++++++--- compiler/rustc_hir/src/arena.rs | 2 +- compiler/rustc_middle/src/arena.rs | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 39def2a6f1f1..6f9ecb9cd21e 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -111,7 +111,7 @@ impl Default for TypedArena { // alloc() will trigger a grow(). ptr: Cell::new(ptr::null_mut()), end: Cell::new(ptr::null_mut()), - chunks: RefCell::new(vec![]), + chunks: Default::default(), _own: PhantomData, } } @@ -325,13 +325,17 @@ unsafe impl<#[may_dangle] T> Drop for TypedArena { unsafe impl Send for TypedArena {} +/// An arena that can hold objects of multiple different types that impl `Copy` +/// and/or satisfy `!mem::needs_drop`. pub struct DroplessArena { /// A pointer to the start of the free space. start: Cell<*mut u8>, /// A pointer to the end of free space. /// - /// The allocation proceeds from the end of the chunk towards the start. + /// The allocation proceeds downwards from the end of the chunk towards the + /// start. (This is slightly simpler and faster than allocating upwards, + /// see .) /// When this pointer crosses the start pointer, a new chunk is allocated. end: Cell<*mut u8>, @@ -516,6 +520,10 @@ impl DroplessArena { } } +// Declare an `Arena` containing one dropless arena and many typed arenas (the +// types of the typed arenas are specified by the arguments). The dropless +// arena will be used for any types that impl `Copy`, and also for any of the +// specified types that satisfy `!mem::needs_drop`. #[rustc_macro_transparency = "semitransparent"] pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { #[derive(Default)] @@ -532,6 +540,7 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { ) -> &'a mut [Self]; } + // Any type that impls `Copy` can be arena-allocated in the `DroplessArena`. impl<'tcx, T: Copy> ArenaAllocatable<'tcx, ()> for T { #[inline] fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self { @@ -544,7 +553,6 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { ) -> &'a mut [Self] { arena.dropless.alloc_from_iter(iter) } - } $( impl<'tcx> ArenaAllocatable<'tcx, $ty> for $ty { @@ -577,6 +585,7 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) { value.allocate_on(self) } + // Any type that impls `Copy` can have slices be arena-allocated in the `DroplessArena`. #[inline] pub fn alloc_slice(&self, value: &[T]) -> &mut [T] { if value.is_empty() { diff --git a/compiler/rustc_hir/src/arena.rs b/compiler/rustc_hir/src/arena.rs index 175845fb9e58..f19ca497d8bf 100644 --- a/compiler/rustc_hir/src/arena.rs +++ b/compiler/rustc_hir/src/arena.rs @@ -1,4 +1,4 @@ -/// This declares a list of types which can be allocated by `Arena`. +/// This higher-order macro declares a list of types which can be allocated by `Arena`. /// /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]`, /// where `T` is the type listed. These impls will appear in the implement_ty_decoder! macro. diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index 530437f50eb1..ee2e190e7cd4 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -1,4 +1,4 @@ -/// This declares a list of types which can be allocated by `Arena`. +/// This higher-order macro declares a list of types which can be allocated by `Arena`. /// /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type /// listed. These impls will appear in the implement_ty_decoder! macro.