From 06b23b74ccb18798b1bfa3f602a4a42995d13d6b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 17 Mar 2024 15:46:40 -0700 Subject: [PATCH 1/6] Add some tests for public-private dependencies. --- tests/ui/privacy/pub-priv-dep/auxiliary/b.rs | 4 ++ tests/ui/privacy/pub-priv-dep/auxiliary/c.rs | 4 ++ .../auxiliary/diamond_priv_dep.rs | 9 +++ .../pub-priv-dep/auxiliary/diamond_pub_dep.rs | 9 +++ tests/ui/privacy/pub-priv-dep/auxiliary/pm.rs | 22 ++++++ .../pub-priv-dep/auxiliary/priv_dep.rs | 9 +++ .../pub-priv-dep/auxiliary/reexport.rs | 5 ++ .../privacy/pub-priv-dep/auxiliary/shared.rs | 1 + tests/ui/privacy/pub-priv-dep/diamond_deps.rs | 48 +++++++++++++ .../privacy/pub-priv-dep/diamond_deps.stderr | 14 ++++ tests/ui/privacy/pub-priv-dep/pub-priv1.rs | 67 ++++++++++++++++++- .../ui/privacy/pub-priv-dep/pub-priv1.stderr | 62 +++++++++++++++-- .../pub-priv-dep/reexport_from_priv.rs | 15 +++++ .../pub-priv-dep/shared_both_private.rs | 32 +++++++++ .../pub-priv-dep/shared_direct_private.rs | 39 +++++++++++ .../privacy/pub-priv-dep/shared_indirect.rs | 29 ++++++++ 16 files changed, 360 insertions(+), 9 deletions(-) create mode 100644 tests/ui/privacy/pub-priv-dep/auxiliary/b.rs create mode 100644 tests/ui/privacy/pub-priv-dep/auxiliary/c.rs create mode 100644 tests/ui/privacy/pub-priv-dep/auxiliary/diamond_priv_dep.rs create mode 100644 tests/ui/privacy/pub-priv-dep/auxiliary/diamond_pub_dep.rs create mode 100644 tests/ui/privacy/pub-priv-dep/auxiliary/pm.rs create mode 100644 tests/ui/privacy/pub-priv-dep/auxiliary/reexport.rs create mode 100644 tests/ui/privacy/pub-priv-dep/auxiliary/shared.rs create mode 100644 tests/ui/privacy/pub-priv-dep/diamond_deps.rs create mode 100644 tests/ui/privacy/pub-priv-dep/diamond_deps.stderr create mode 100644 tests/ui/privacy/pub-priv-dep/reexport_from_priv.rs create mode 100644 tests/ui/privacy/pub-priv-dep/shared_both_private.rs create mode 100644 tests/ui/privacy/pub-priv-dep/shared_direct_private.rs create mode 100644 tests/ui/privacy/pub-priv-dep/shared_indirect.rs diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/b.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/b.rs new file mode 100644 index 0000000000000..3acc49270288f --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/b.rs @@ -0,0 +1,4 @@ +//@ aux-crate:priv:c=c.rs +//@ compile-flags: -Zunstable-options + +extern crate c; diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/c.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/c.rs new file mode 100644 index 0000000000000..5f6b289eb1414 --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/c.rs @@ -0,0 +1,4 @@ +//@ aux-crate:shared=shared.rs + +// This is public. +extern crate shared; diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/diamond_priv_dep.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/diamond_priv_dep.rs new file mode 100644 index 0000000000000..ed76815a6ac8e --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/diamond_priv_dep.rs @@ -0,0 +1,9 @@ +//@ aux-crate:shared=shared.rs + +extern crate shared; + +pub use shared::Shared; + +pub struct SharedInType { + pub f: Shared +} diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/diamond_pub_dep.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/diamond_pub_dep.rs new file mode 100644 index 0000000000000..ed76815a6ac8e --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/diamond_pub_dep.rs @@ -0,0 +1,9 @@ +//@ aux-crate:shared=shared.rs + +extern crate shared; + +pub use shared::Shared; + +pub struct SharedInType { + pub f: Shared +} diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/pm.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/pm.rs new file mode 100644 index 0000000000000..9e2aa898afe8d --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/pm.rs @@ -0,0 +1,22 @@ +//@ force-host +//@ no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro] +pub fn fn_like(input: TokenStream) -> TokenStream { + "".parse().unwrap() +} + +#[proc_macro_derive(PmDerive)] +pub fn pm_derive(item: TokenStream) -> TokenStream { + "".parse().unwrap() +} + +#[proc_macro_attribute] +pub fn pm_attr(attr: TokenStream, item: TokenStream) -> TokenStream { + "".parse().unwrap() +} diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/priv_dep.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/priv_dep.rs index e7afeb84fb4f4..4eeecdc056972 100644 --- a/tests/ui/privacy/pub-priv-dep/auxiliary/priv_dep.rs +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/priv_dep.rs @@ -1,2 +1,11 @@ pub struct OtherType; pub trait OtherTrait {} + +#[macro_export] +macro_rules! m { + () => {}; +} + +pub enum E { + V1 +} diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/reexport.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/reexport.rs new file mode 100644 index 0000000000000..0655e3ae2cfdb --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/reexport.rs @@ -0,0 +1,5 @@ +//@ aux-crate:shared=shared.rs + +extern crate shared; + +pub use shared::Shared; diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/shared.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/shared.rs new file mode 100644 index 0000000000000..efc4daa7befb8 --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/shared.rs @@ -0,0 +1 @@ +pub struct Shared; diff --git a/tests/ui/privacy/pub-priv-dep/diamond_deps.rs b/tests/ui/privacy/pub-priv-dep/diamond_deps.rs new file mode 100644 index 0000000000000..0e1f6f36bc8cc --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/diamond_deps.rs @@ -0,0 +1,48 @@ +//@ aux-crate:priv:diamond_priv_dep=diamond_priv_dep.rs +//@ aux-crate:diamond_pub_dep=diamond_pub_dep.rs +//@ compile-flags: -Zunstable-options + +// A diamond dependency: +// +// diamond_reepxort +// /\ +// (public) / \ (PRIVATE) +// / \ +// diamond_pub_dep diamond_priv_dep +// \ / +// (public) \ / (public) +// \/ +// shared +// +// Where the pub and private crates reexport something from the shared crate. +// +// Checks the behavior when the same shared item appears in the public API, +// depending on whether it comes from the public side or the private side. +// +// NOTE: compiletest does not support deduplicating shared dependencies. +// However, it should work well enough for this test, the only downside is +// that diamond_shared gets built twice. + +#![crate_type = "lib"] +#![deny(exported_private_dependencies)] + +extern crate diamond_priv_dep; +extern crate diamond_pub_dep; + +// FIXME: This should trigger. +pub fn leaks_priv() -> diamond_priv_dep::Shared { + diamond_priv_dep::Shared +} + +pub fn leaks_pub() -> diamond_pub_dep::Shared { + diamond_pub_dep::Shared +} + +pub struct PrivInStruct { + pub f: diamond_priv_dep::SharedInType +//~^ ERROR type `diamond_priv_dep::SharedInType` from private dependency 'diamond_priv_dep' in public interface +} + +pub struct PubInStruct { + pub f: diamond_pub_dep::SharedInType +} diff --git a/tests/ui/privacy/pub-priv-dep/diamond_deps.stderr b/tests/ui/privacy/pub-priv-dep/diamond_deps.stderr new file mode 100644 index 0000000000000..8a6d35a747b63 --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/diamond_deps.stderr @@ -0,0 +1,14 @@ +error: type `diamond_priv_dep::SharedInType` from private dependency 'diamond_priv_dep' in public interface + --> $DIR/diamond_deps.rs:42:5 + | +LL | pub f: diamond_priv_dep::SharedInType + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/diamond_deps.rs:27:9 + | +LL | #![deny(exported_private_dependencies)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/privacy/pub-priv-dep/pub-priv1.rs b/tests/ui/privacy/pub-priv-dep/pub-priv1.rs index f26dbb47ba5e9..112eaf528be27 100644 --- a/tests/ui/privacy/pub-priv-dep/pub-priv1.rs +++ b/tests/ui/privacy/pub-priv-dep/pub-priv1.rs @@ -1,12 +1,20 @@ //@ aux-crate:priv:priv_dep=priv_dep.rs //@ aux-build:pub_dep.rs +//@ aux-crate:priv:pm=pm.rs //@ compile-flags: -Zunstable-options + +// Basic behavior check of exported_private_dependencies from either a public +// dependency or a private one. + #![deny(exported_private_dependencies)] // This crate is a private dependency -extern crate priv_dep; +// FIXME: This should trigger. +pub extern crate priv_dep; // This crate is a public dependency extern crate pub_dep; +// This crate is a private dependency +extern crate pm; use priv_dep::{OtherTrait, OtherType}; use pub_dep::PubType; @@ -25,7 +33,10 @@ pub struct PublicType { } impl PublicType { - pub fn pub_fn(param: OtherType) {} + pub fn pub_fn_param(param: OtherType) {} + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + + pub fn pub_fn_return() -> OtherType { OtherType } //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface fn priv_fn(param: OtherType) {} @@ -36,9 +47,61 @@ pub trait MyPubTrait { } //~^^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface +pub trait WithSuperTrait: OtherTrait {} +//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface + +pub trait PubLocalTraitWithAssoc { + type X; +} + +pub struct PrivateAssoc; +impl PubLocalTraitWithAssoc for PrivateAssoc { + type X = OtherType; +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface +} + +pub fn in_bounds(x: T) { unimplemented!() } +//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface + +pub fn private_in_generic() -> std::num::Saturating { unimplemented!() } +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + +pub static STATIC: OtherType = OtherType; +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + +pub const CONST: OtherType = OtherType; +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + +pub type Alias = OtherType; +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + +pub struct PublicWithPrivateImpl; + +// FIXME: This should trigger. +// See https://github.com/rust-lang/rust/issues/71043 +impl OtherTrait for PublicWithPrivateImpl {} + +pub trait PubTraitOnPrivate {} + +// FIXME: This should trigger. +// See https://github.com/rust-lang/rust/issues/71043 +impl PubTraitOnPrivate for OtherType {} + pub struct AllowedPrivType { #[allow(exported_private_dependencies)] pub allowed: OtherType, } +// FIXME: This should trigger. +pub use priv_dep::m; +// FIXME: This should trigger. +pub use pm::fn_like; +// FIXME: This should trigger. +pub use pm::PmDerive; +// FIXME: This should trigger. +pub use pm::pm_attr; + +// FIXME: This should trigger. +pub use priv_dep::E::V1; + fn main() {} diff --git a/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr b/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr index e62a440d8f568..53d461a5774a0 100644 --- a/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr +++ b/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr @@ -1,26 +1,74 @@ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:21:5 + --> $DIR/pub-priv1.rs:29:5 | LL | pub field: OtherType, | ^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/pub-priv1.rs:4:9 + --> $DIR/pub-priv1.rs:9:9 | LL | #![deny(exported_private_dependencies)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:28:5 + --> $DIR/pub-priv1.rs:36:5 | -LL | pub fn pub_fn(param: OtherType) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | pub fn pub_fn_param(param: OtherType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:39:5 + | +LL | pub fn pub_fn_return() -> OtherType { OtherType } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: trait `OtherTrait` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:35:5 + --> $DIR/pub-priv1.rs:46:5 | LL | type Foo: OtherTrait; | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: trait `OtherTrait` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:50:1 + | +LL | pub trait WithSuperTrait: OtherTrait {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:59:5 + | +LL | type X = OtherType; + | ^^^^^^ + +error: trait `OtherTrait` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:63:1 + | +LL | pub fn in_bounds(x: T) { unimplemented!() } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:66:1 + | +LL | pub fn private_in_generic() -> std::num::Saturating { unimplemented!() } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:69:1 + | +LL | pub static STATIC: OtherType = OtherType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:72:1 + | +LL | pub const CONST: OtherType = OtherType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:75:1 + | +LL | pub type Alias = OtherType; + | ^^^^^^^^^^^^^^ + +error: aborting due to 11 previous errors diff --git a/tests/ui/privacy/pub-priv-dep/reexport_from_priv.rs b/tests/ui/privacy/pub-priv-dep/reexport_from_priv.rs new file mode 100644 index 0000000000000..3c6e9825e7288 --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/reexport_from_priv.rs @@ -0,0 +1,15 @@ +//@ aux-crate:priv:reexport=reexport.rs +//@ compile-flags: -Zunstable-options +//@ check-pass + +// Checks the behavior of a reexported item from a private dependency. + +#![crate_type = "lib"] +#![deny(exported_private_dependencies)] + +extern crate reexport; + +// FIXME: This should trigger. +pub fn leaks_priv() -> reexport::Shared { + reexport::Shared +} diff --git a/tests/ui/privacy/pub-priv-dep/shared_both_private.rs b/tests/ui/privacy/pub-priv-dep/shared_both_private.rs new file mode 100644 index 0000000000000..20a4b85c01e8d --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/shared_both_private.rs @@ -0,0 +1,32 @@ +//@ aux-crate:priv:shared=shared.rs +//@ aux-crate:reexport=reexport.rs +//@ compile-flags: -Zunstable-options +//@ check-pass + +// A shared dependency, where a private dependency reexports a public dependency. +// +// shared_both_private +// /\ +// (PRIVATE) / | (PRIVATE) +// / | +// reexport | +// \ | +// (public) \ / +// \/ +// shared + +#![crate_type = "lib"] +#![deny(exported_private_dependencies)] + +extern crate shared; +extern crate reexport; + +// FIXME: This should trigger. +pub fn leaks_priv() -> shared::Shared { + shared::Shared +} + +// FIXME: This should trigger. +pub fn leaks_priv_reexport() -> reexport::Shared { + reexport::Shared +} diff --git a/tests/ui/privacy/pub-priv-dep/shared_direct_private.rs b/tests/ui/privacy/pub-priv-dep/shared_direct_private.rs new file mode 100644 index 0000000000000..b329a7acb5834 --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/shared_direct_private.rs @@ -0,0 +1,39 @@ +//@ aux-crate:priv:shared=shared.rs +//@ aux-crate:reexport=reexport.rs +//@ compile-flags: -Zunstable-options +//@ check-pass + +// A shared dependency, where the public side reexports the same item as a +// direct private dependency. +// +// shared_direct_private +// /\ +// (public) / | (PRIVATE) +// / | +// reexport | +// \ | +// (public) \ / +// \/ +// shared +// + +#![crate_type = "lib"] +#![deny(exported_private_dependencies)] + +extern crate shared; +extern crate reexport; + +// FIXME: Should this trigger? +// +// One could make an argument that I said I want "reexport" to be public, and +// since "reexport" says "shared_direct_private" is public, then it should +// transitively be public for me. However, as written, this is explicitly +// referring to a dependency that is marked "private", which I think is +// confusing. +pub fn leaks_priv() -> shared::Shared { + shared::Shared +} + +pub fn leaks_pub() -> reexport::Shared { + reexport::Shared +} diff --git a/tests/ui/privacy/pub-priv-dep/shared_indirect.rs b/tests/ui/privacy/pub-priv-dep/shared_indirect.rs new file mode 100644 index 0000000000000..3097389032185 --- /dev/null +++ b/tests/ui/privacy/pub-priv-dep/shared_indirect.rs @@ -0,0 +1,29 @@ +//@ aux-crate:priv:shared=shared.rs +//@ aux-crate:priv:b=b.rs +//@ compile-flags: -Zunstable-options +//@ check-pass + +// A shared dependency, where it is only indirectly public. +// +// shared_indirect +// /\ +// (PRIVATE) / | (PRIVATE) +// / | +// b | | +// (PRIVATE) | | +// c | | +// \ | +// (public) \ / +// \/ +// shared + +#![crate_type = "lib"] +#![deny(exported_private_dependencies)] + +extern crate shared; +extern crate b; + +// FIXME: This should trigger. +pub fn leaks_priv() -> shared::Shared { + shared::Shared +} From 4ebbb5f048797598e22916532b94517285492f03 Mon Sep 17 00:00:00 2001 From: surechen Date: Wed, 27 Mar 2024 11:30:12 +0800 Subject: [PATCH 2/6] Fix incorrect suggestion for undeclared hrtb lifetimes in where clauses. fixes #122714 --- .../rustc_resolve/src/late/diagnostics.rs | 101 +++++++++++++++--- ...ric-higher-ranked-lifetime-issue-122714.rs | 28 +++++ ...higher-ranked-lifetime-issue-122714.stderr | 92 ++++++++++++++++ 3 files changed, 207 insertions(+), 14 deletions(-) create mode 100644 tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.rs create mode 100644 tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.stderr diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 1958fdf1cbc46..980f43b08064b 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -17,6 +17,7 @@ use rustc_ast::{ }; use rustc_ast_pretty::pprust::where_bound_predicate_to_string; use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::fx::FxIndexSet; use rustc_errors::{ codes::*, pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan, SuggestionStyle, @@ -31,7 +32,7 @@ use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::edition::Edition; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{kw, sym, Ident, Symbol}; -use rustc_span::Span; +use rustc_span::{Span, DUMMY_SP}; use rustc_middle::ty; @@ -2714,8 +2715,17 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { self.suggest_introducing_lifetime( &mut err, Some(lifetime_ref.ident.name.as_str()), - |err, _, span, message, suggestion| { - err.span_suggestion(span, message, suggestion, Applicability::MaybeIncorrect); + |err, _, span, message, suggestion, span_suggs| { + err.multipart_suggestion_with_style( + message, + std::iter::once((span, suggestion)).chain(span_suggs.clone()).collect(), + Applicability::MaybeIncorrect, + if span_suggs.is_empty() { + SuggestionStyle::ShowCode + } else { + SuggestionStyle::ShowAlways + }, + ); true }, ); @@ -2726,13 +2736,20 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { &self, err: &mut Diag<'_>, name: Option<&str>, - suggest: impl Fn(&mut Diag<'_>, bool, Span, Cow<'static, str>, String) -> bool, + suggest: impl Fn( + &mut Diag<'_>, + bool, + Span, + Cow<'static, str>, + String, + Vec<(Span, String)>, + ) -> bool, ) { let mut suggest_note = true; for rib in self.lifetime_ribs.iter().rev() { let mut should_continue = true; match rib.kind { - LifetimeRibKind::Generics { binder: _, span, kind } => { + LifetimeRibKind::Generics { binder, span, kind } => { // Avoid suggesting placing lifetime parameters on constant items unless the relevant // feature is enabled. Suggest the parent item as a possible location if applicable. if let LifetimeBinderKind::ConstItem = kind @@ -2761,11 +2778,53 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { | LifetimeBinderKind::PolyTrait | LifetimeBinderKind::WhereBound ); + + let mut rm_inner_binders: FxIndexSet = Default::default(); let (span, sugg) = if span.is_empty() { + let mut binder_idents: FxIndexSet = Default::default(); + binder_idents.insert(Ident::from_str(name.unwrap_or("'a"))); + + // We need to special case binders in the following situation: + // Change `T: for<'a> Trait + 'b` to `for<'a, 'b> T: Trait + 'b` + // T: for<'a> Trait + 'b + // ^^^^^^^ remove existing inner binder `for<'a>` + // for<'a, 'b> T: Trait + 'b + // ^^^^^^^^^^^ suggest outer binder `for<'a, 'b>` + if let LifetimeBinderKind::WhereBound = kind + && let Some(ast::WherePredicate::BoundPredicate( + ast::WhereBoundPredicate { bounded_ty, bounds, .. }, + )) = self.diag_metadata.current_where_predicate + && bounded_ty.id == binder + { + for bound in bounds { + if let ast::GenericBound::Trait(poly_trait_ref, _) = bound + && let span = poly_trait_ref + .span + .with_hi(poly_trait_ref.trait_ref.path.span.lo()) + && !span.is_empty() + { + rm_inner_binders.insert(span); + poly_trait_ref.bound_generic_params.iter().for_each(|v| { + binder_idents.insert(v.ident); + }); + } + } + } + + let binders_sugg = binder_idents.into_iter().enumerate().fold( + "".to_string(), + |mut binders, (i, x)| { + if i != 0 { + binders += ", "; + } + binders += x.as_str(); + binders + }, + ); let sugg = format!( "{}<{}>{}", if higher_ranked { "for" } else { "" }, - name.unwrap_or("'a"), + binders_sugg, if higher_ranked { " " } else { "" }, ); (span, sugg) @@ -2780,13 +2839,28 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { let sugg = format!("{}, ", name.unwrap_or("'a")); (span, sugg) }; + if higher_ranked { let message = Cow::from(format!( "consider making the {} lifetime-generic with a new `{}` lifetime", kind.descr(), name.unwrap_or("'a"), )); - should_continue = suggest(err, true, span, message, sugg); + should_continue = suggest( + err, + true, + span, + message, + sugg, + if !rm_inner_binders.is_empty() { + rm_inner_binders + .into_iter() + .map(|v| (v, "".to_string())) + .collect::>() + } else { + vec![] + }, + ); err.note_once( "for more information on higher-ranked polymorphism, visit \ https://doc.rust-lang.org/nomicon/hrtb.html", @@ -2794,10 +2868,10 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } else if let Some(name) = name { let message = Cow::from(format!("consider introducing lifetime `{name}` here")); - should_continue = suggest(err, false, span, message, sugg); + should_continue = suggest(err, false, span, message, sugg, vec![]); } else { let message = Cow::from("consider introducing a named lifetime parameter"); - should_continue = suggest(err, false, span, message, sugg); + should_continue = suggest(err, false, span, message, sugg, vec![]); } } LifetimeRibKind::Item | LifetimeRibKind::ConstParamTy => break, @@ -3033,11 +3107,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { self.suggest_introducing_lifetime( err, None, - |err, higher_ranked, span, message, intro_sugg| { + |err, higher_ranked, span, message, intro_sugg, _| { err.multipart_suggestion_verbose( message, std::iter::once((span, intro_sugg)) - .chain(spans_suggs.iter().cloned()) + .chain(spans_suggs.clone()) .collect(), Applicability::MaybeIncorrect, ); @@ -3161,11 +3235,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { self.suggest_introducing_lifetime( err, None, - |err, higher_ranked, span, message, intro_sugg| { + |err, higher_ranked, span, message, intro_sugg, _| { err.multipart_suggestion_verbose( message, std::iter::once((span, intro_sugg)) - .chain(spans_suggs.iter().cloned()) + .chain(spans_suggs.clone()) .collect(), Applicability::MaybeIncorrect, ); @@ -3309,7 +3383,6 @@ fn mk_where_bound_predicate( poly_trait_ref: &ast::PolyTraitRef, ty: &Ty, ) -> Option { - use rustc_span::DUMMY_SP; let modified_segments = { let mut segments = path.segments.clone(); let [preceding @ .., second_last, last] = segments.as_mut_slice() else { diff --git a/tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.rs b/tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.rs new file mode 100644 index 0000000000000..b2ac332b4f08e --- /dev/null +++ b/tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.rs @@ -0,0 +1,28 @@ +#![allow(dead_code)] + +trait Trait1 + where T: for<'a> Trait1 + 'b { } //~ ERROR use of undeclared lifetime name `'b` + +trait Trait2 +where + T: B<'b> + for<'a> A<'a>, //~ ERROR use of undeclared lifetime name `'b` +{ +} + +trait Trait3 +where + T: B<'b> + for<'a> A<'a> + 'c {} + //~^ ERROR use of undeclared lifetime name `'b` + //~| ERROR use of undeclared lifetime name `'c` + +trait Trait4 +where + T: for<'a> A<'a> + 'x + for<'b> B<'b>, //~ ERROR use of undeclared lifetime name `'x` +{ +} + +trait A<'a> {} +trait B<'a> {} + + +fn main() {} diff --git a/tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.stderr b/tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.stderr new file mode 100644 index 0000000000000..40f0769964f00 --- /dev/null +++ b/tests/ui/generics/generic-higher-ranked-lifetime-issue-122714.stderr @@ -0,0 +1,92 @@ +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:4:32 + | +LL | where T: for<'a> Trait1 + 'b { } + | ^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the bound lifetime-generic with a new `'b` lifetime + | +LL - where T: for<'a> Trait1 + 'b { } +LL + where for<'b, 'a> T: Trait1 + 'b { } + | +help: consider introducing lifetime `'b` here + | +LL | trait Trait1<'b, T> + | +++ + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:8:10 + | +LL | T: B<'b> + for<'a> A<'a>, + | ^^ undeclared lifetime + | +help: consider making the bound lifetime-generic with a new `'b` lifetime + | +LL | T: for<'b> B<'b> + for<'a> A<'a>, + | +++++++ +help: consider making the bound lifetime-generic with a new `'b` lifetime + | +LL - T: B<'b> + for<'a> A<'a>, +LL + for<'b, 'a> T: B<'b> + A<'a>, + | +help: consider introducing lifetime `'b` here + | +LL | trait Trait2<'b, T> + | +++ + +error[E0261]: use of undeclared lifetime name `'b` + --> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:14:10 + | +LL | T: B<'b> + for<'a> A<'a> + 'c {} + | ^^ undeclared lifetime + | +help: consider making the bound lifetime-generic with a new `'b` lifetime + | +LL | T: for<'b> B<'b> + for<'a> A<'a> + 'c {} + | +++++++ +help: consider making the bound lifetime-generic with a new `'b` lifetime + | +LL - T: B<'b> + for<'a> A<'a> + 'c {} +LL + for<'b, 'a> T: B<'b> + A<'a> + 'c {} + | +help: consider introducing lifetime `'b` here + | +LL | trait Trait3<'b, T> + | +++ + +error[E0261]: use of undeclared lifetime name `'c` + --> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:14:32 + | +LL | T: B<'b> + for<'a> A<'a> + 'c {} + | ^^ undeclared lifetime + | +help: consider making the bound lifetime-generic with a new `'c` lifetime + | +LL - T: B<'b> + for<'a> A<'a> + 'c {} +LL + for<'c, 'a> T: B<'b> + A<'a> + 'c {} + | +help: consider introducing lifetime `'c` here + | +LL | trait Trait3<'c, T> + | +++ + +error[E0261]: use of undeclared lifetime name `'x` + --> $DIR/generic-higher-ranked-lifetime-issue-122714.rs:20:24 + | +LL | T: for<'a> A<'a> + 'x + for<'b> B<'b>, + | ^^ undeclared lifetime + | +help: consider making the bound lifetime-generic with a new `'x` lifetime + | +LL - T: for<'a> A<'a> + 'x + for<'b> B<'b>, +LL + for<'x, 'a, 'b> T: A<'a> + 'x + B<'b>, + | +help: consider introducing lifetime `'x` here + | +LL | trait Trait4<'x, T> + | +++ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0261`. From 972633f53034d7d8d60f4c11b680b3f8f2aff337 Mon Sep 17 00:00:00 2001 From: ardi Date: Sun, 19 May 2024 15:42:12 +0200 Subject: [PATCH 3/6] Fix parsing of erroneously placed semicolons --- compiler/rustc_parse/src/parser/item.rs | 12 +++++++++--- .../fn-no-semicolon-issue-124935-semi-after-item.rs | 6 ++++++ ...-no-semicolon-issue-124935-semi-after-item.stderr | 8 ++++++++ tests/ui/parser/issues/issue-49040.rs | 2 +- tests/ui/parser/issues/issue-49040.stderr | 6 +++--- .../missing-main-issue-124935-semi-after-item.rs | 5 +++++ .../missing-main-issue-124935-semi-after-item.stderr | 10 ++++++++++ 7 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.rs create mode 100644 tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.stderr create mode 100644 tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.rs create mode 100644 tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.stderr diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index a46c104b6d9ca..f43ddadc2ea02 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -58,9 +58,15 @@ impl<'a> Parser<'a> { let attrs = self.parse_inner_attributes()?; let post_attr_lo = self.token.span; - let mut items = ThinVec::new(); - while let Some(item) = self.parse_item(ForceCollect::No)? { - self.maybe_consume_incorrect_semicolon(Some(&item)); + let mut items: ThinVec> = ThinVec::new(); + + // There shouldn't be any stray semicolons before or after items. + // `parse_item` consumes the appropriate semicolons so any leftover is an error. + loop { + while self.maybe_consume_incorrect_semicolon(items.last().map(|x| &**x)) {} // Eat all bad semicolons + let Some(item) = self.parse_item(ForceCollect::No)? else { + break; + }; items.push(item); } diff --git a/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.rs b/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.rs new file mode 100644 index 0000000000000..3c0059ba3e3e3 --- /dev/null +++ b/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.rs @@ -0,0 +1,6 @@ +// Regression test for issue #124935 +// Tests that we do not erroneously emit an error about +// missing main function when the mod starts with a `;` + +; //~ ERROR expected item, found `;` +fn main() { } diff --git a/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.stderr b/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.stderr new file mode 100644 index 0000000000000..9776677589f5b --- /dev/null +++ b/tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.stderr @@ -0,0 +1,8 @@ +error: expected item, found `;` + --> $DIR/fn-no-semicolon-issue-124935-semi-after-item.rs:5:1 + | +LL | ; + | ^ help: remove this semicolon + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issues/issue-49040.rs b/tests/ui/parser/issues/issue-49040.rs index b7a541dd6642a..68e7cc9f80ebe 100644 --- a/tests/ui/parser/issues/issue-49040.rs +++ b/tests/ui/parser/issues/issue-49040.rs @@ -1,3 +1,3 @@ #![allow(unused_variables)]; //~ ERROR expected item, found `;` -//~^ ERROR `main` function fn foo() {} +//~^ ERROR `main` function diff --git a/tests/ui/parser/issues/issue-49040.stderr b/tests/ui/parser/issues/issue-49040.stderr index 8af7838c79138..11ef5e1aadfd8 100644 --- a/tests/ui/parser/issues/issue-49040.stderr +++ b/tests/ui/parser/issues/issue-49040.stderr @@ -5,10 +5,10 @@ LL | #![allow(unused_variables)]; | ^ help: remove this semicolon error[E0601]: `main` function not found in crate `issue_49040` - --> $DIR/issue-49040.rs:1:29 + --> $DIR/issue-49040.rs:2:12 | -LL | #![allow(unused_variables)]; - | ^ consider adding a `main` function to `$DIR/issue-49040.rs` +LL | fn foo() {} + | ^ consider adding a `main` function to `$DIR/issue-49040.rs` error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.rs b/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.rs new file mode 100644 index 0000000000000..3fbac5fae232f --- /dev/null +++ b/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.rs @@ -0,0 +1,5 @@ +// Regression test for issue #124935 +// Tests that we still emit an error after an item. + +fn main() { } +; //~ ERROR expected item, found `;` diff --git a/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.stderr b/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.stderr new file mode 100644 index 0000000000000..2d7f540443d29 --- /dev/null +++ b/tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.stderr @@ -0,0 +1,10 @@ +error: expected item, found `;` + --> $DIR/missing-main-issue-124935-semi-after-item.rs:5:1 + | +LL | ; + | ^ help: remove this semicolon + | + = help: function declarations are not followed by a semicolon + +error: aborting due to 1 previous error + From d89500843caf666998619bbc0c88d5857726963d Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sun, 19 May 2024 16:11:46 -0700 Subject: [PATCH 4/6] Move 100 entries from tests/ui into subdirs - Move super-fast-paren-parsing test into ui/parser - Move stmt_expr_attrs test into ui/feature-gates - Move macro tests into ui/macros - Move global_asm tests into ui/asm - Move env tests into ui/process - Move xcrate tests into ui/cross-crate - Move unop tests into ui/unop - Move backtrace tests into ui/backtrace - Move check-static tests into ui/statics - Move expr tests into ui/expr - Move optimization fuel tests into ui/fuel - Move ffi attribute tests into ui/ffi-attrs - Move suggestion tests into ui/suggestions - Move main tests into ui/fn-main - Move lint tests into ui/lint - Move repr tests into ui/repr - Move intrinsics tests into ui/intrinsics - Move tool lint tests into ui/tool-attributes - Move return tests into ui/return - Move pattern tests into ui/patttern - Move range tests into ui/range - Move foreign-fn tests into ui/foreign - Move orphan-check tests into ui/coherence - Move inference tests into ui/inference - Reduce ROOT_ENTRY_LIMIT --- src/tools/tidy/src/ui_tests.rs | 2 +- tests/ui/{ => asm}/empty_global_asm.rs | 0 tests/ui/{ => asm}/simple_global_asm.rs | 0 .../apple-no-dsymutil.rs} | 0 .../auxiliary/dylib-dep-helper-aux.rs | 0 .../auxiliary/dylib-dep-helper.rs | 0 .../auxiliary/line-tables-only-helper.rs | 0 tests/ui/{ => backtrace}/backtrace.rs | 0 .../dylib-dep.rs} | 0 .../line-tables-only.rs} | 0 tests/ui/{ => backtrace}/std-backtrace.rs | 0 .../auxiliary/orphan-check-diagnostics.rs | 0 .../orphan-check-diagnostics.rs | 0 .../orphan-check-diagnostics.stderr | 0 ...ignificant.rs => address-insignificant.rs} | 0 ...efaults.rs => associated-type-defaults.rs} | 0 .../auxiliary/static_priv_by_default.rs | 0 .../auxiliary/xcrate_unit_struct.rs | 0 ..._return.rs => generic_fn_nested_return.rs} | 0 .../private-by-default.rs} | 0 .../private-by-default.stderr} | 20 +++++------ ...tatic-addresses.rs => static-addresses.rs} | 0 ...etime-param.rs => trait-lifetime-param.rs} | 0 .../unit-struct-2.rs} | 0 .../unit-struct.rs} | 0 .../unit-struct.stderr} | 4 +-- .../ui/{expr-block-fn.rs => expr/block-fn.rs} | 0 .../block-generic.rs} | 0 tests/ui/{expr-block.rs => expr/block.rs} | 0 tests/ui/{expr-copy.rs => expr/copy.rs} | 0 .../if-generic.rs} | 0 .../if-panic-all.rs} | 0 tests/ui/{expr-scope.rs => expr/scope.rs} | 0 .../stmt_expr_attrs_no_feature.rs | 0 .../stmt_expr_attrs_no_feature.stderr | 0 tests/ui/{ => ffi-attrs}/ffi_const.rs | 0 tests/ui/{ => ffi-attrs}/ffi_const.stderr | 0 tests/ui/{ => ffi-attrs}/ffi_const2.rs | 0 tests/ui/{ => ffi-attrs}/ffi_const2.stderr | 0 tests/ui/{ => ffi-attrs}/ffi_pure.rs | 0 tests/ui/{ => ffi-attrs}/ffi_pure.stderr | 0 .../wrong-location.rs} | 0 .../wrong-location.stderr} | 8 ++--- .../wrong-type.rs} | 0 .../wrong-type.stderr} | 2 +- .../foreign-fn-return-lifetime.rs | 0 .../foreign-fn-return-lifetime.stderr | 0 tests/ui/{ => fuel}/optimization-fuel-0.rs | 0 .../ui/{ => fuel}/optimization-fuel-0.stderr | 0 tests/ui/{ => fuel}/optimization-fuel-1.rs | 0 .../ui/{ => fuel}/optimization-fuel-1.stderr | 0 tests/ui/{print-fuel => fuel}/print-fuel.rs | 0 .../ui/{print-fuel => fuel}/print-fuel.stderr | 0 .../ui/{ => inference}/infer-fn-tail-expr.rs | 0 .../lambda-infer-unresolved.rs | 0 .../order-dependent-cast-inference.rs | 0 .../order-dependent-cast-inference.stderr | 0 .../always-extern.rs} | 0 .../always-extern.stderr} | 8 ++--- tests/ui/{ => intrinsics}/reify-intrinsic.rs | 0 .../{ => intrinsics}/reify-intrinsic.stderr | 0 .../group-denied-lint-allowed.rs} | 0 .../group-forbid-always-trumps-cli.rs} | 0 .../group-forbid-always-trumps-cli.stderr} | 2 +- .../unknown-lints-at-crate-level.rs} | 0 tests/ui/{ => macros}/compile_error_macro.rs | 0 .../{ => macros}/compile_error_macro.stderr | 0 .../module-macro_use-arguments.rs | 0 .../module-macro_use-arguments.stderr | 0 .../{ => macros}/no-patterns-in-args-macro.rs | 0 .../no-patterns-in-args-macro.stderr | 0 .../{ => parser}/super-fast-paren-parsing.rs | 5 +-- .../{ => pattern}/by-move-pattern-binding.rs | 0 .../by-move-pattern-binding.stderr | 0 tests/ui/{ => pattern}/fn-in-pat.rs | 0 tests/ui/{ => pattern}/fn-in-pat.stderr | 0 tests/ui/{ => pattern}/inc-range-pat.rs | 0 .../ui/{ => pattern}/no-patterns-in-args-2.rs | 0 .../no-patterns-in-args-2.stderr | 0 tests/ui/{ => pattern}/no-patterns-in-args.rs | 0 .../{ => pattern}/no-patterns-in-args.stderr | 0 .../env-args-reverse-iterator.rs | 0 tests/ui/{ => process}/env-funky-keys.rs | 0 tests/ui/{ => process}/env-null-vars.rs | 0 tests/ui/{ => process}/env-vars.rs | 0 tests/ui/{ => process}/exec-env.rs | 0 tests/ui/{ => process}/inherit-env.rs | 0 tests/ui/{ => range}/impossible_range.fixed | 0 tests/ui/{ => range}/impossible_range.rs | 0 tests/ui/{ => range}/impossible_range.stderr | 0 tests/ui/{ => range}/range_inclusive.rs | 0 tests/ui/{ => repr}/conflicting-repr-hints.rs | 0 .../{ => repr}/conflicting-repr-hints.stderr | 0 tests/ui/{ => return}/ret-bang.rs | 0 tests/ui/{ => return}/ret-non-nil.rs | 0 tests/ui/{ => return}/ret-non-nil.stderr | 0 .../{ => return}/return-disjoint-regions.rs | 0 .../return-disjoint-regions.stderr | 0 tests/ui/{ => return}/return-nil.rs | 0 .../check_static_recursion_foreign_helper.rs | 0 .../check-immutable-mut-slices.rs} | 0 .../check-immutable-mut-slices.stderr} | 2 +- .../check-recursion-foreign.rs} | 0 .../check-values-constraints.rs} | 0 .../check-values-constraints.stderr} | 34 +++++++++---------- .../dont-suggest-private-trait-method.rs | 0 .../dont-suggest-private-trait-method.stderr | 0 .../{ => suggestions}/suggest-null-ptr.fixed | 0 .../ui/{ => suggestions}/suggest-null-ptr.rs | 0 .../{ => suggestions}/suggest-null-ptr.stderr | 0 .../trait-impl-bound-suggestions.fixed | 0 .../trait-impl-bound-suggestions.rs | 0 .../trait-impl-bound-suggestions.stderr | 0 .../{ => tool-attributes}/tool_lints-fail.rs | 0 .../tool_lints-fail.stderr | 0 .../{ => tool-attributes}/tool_lints-rpass.rs | 0 tests/ui/{ => tool-attributes}/tool_lints.rs | 0 .../{ => tool-attributes}/tool_lints.stderr | 0 .../tool_lints_2018_preview.rs | 0 .../unknown-lint-tool-name.rs | 0 .../unknown-lint-tool-name.stderr | 0 .../unknown-tool-name.rs | 0 .../unknown-tool-name.stderr | 0 tests/ui/{ => unop}/unop-move-semantics.rs | 0 .../ui/{ => unop}/unop-move-semantics.stderr | 0 tests/ui/{ => unop}/unop-neg-bool.rs | 0 tests/ui/{ => unop}/unop-neg-bool.stderr | 0 127 files changed, 42 insertions(+), 45 deletions(-) rename tests/ui/{ => asm}/empty_global_asm.rs (100%) rename tests/ui/{ => asm}/simple_global_asm.rs (100%) rename tests/ui/{backtrace-apple-no-dsymutil.rs => backtrace/apple-no-dsymutil.rs} (100%) rename tests/ui/{debuginfo => backtrace}/auxiliary/dylib-dep-helper-aux.rs (100%) rename tests/ui/{debuginfo => backtrace}/auxiliary/dylib-dep-helper.rs (100%) rename tests/ui/{debuginfo => backtrace}/auxiliary/line-tables-only-helper.rs (100%) rename tests/ui/{ => backtrace}/backtrace.rs (100%) rename tests/ui/{debuginfo/backtrace-dylib-dep.rs => backtrace/dylib-dep.rs} (100%) rename tests/ui/{debuginfo/backtrace-line-tables-only.rs => backtrace/line-tables-only.rs} (100%) rename tests/ui/{ => backtrace}/std-backtrace.rs (100%) rename tests/ui/{ => coherence}/auxiliary/orphan-check-diagnostics.rs (100%) rename tests/ui/{ => coherence}/orphan-check-diagnostics.rs (100%) rename tests/ui/{ => coherence}/orphan-check-diagnostics.stderr (100%) rename tests/ui/cross-crate/{xcrate-address-insignificant.rs => address-insignificant.rs} (100%) rename tests/ui/cross-crate/{xcrate-associated-type-defaults.rs => associated-type-defaults.rs} (100%) rename tests/ui/{xcrate => cross-crate}/auxiliary/static_priv_by_default.rs (100%) rename tests/ui/{xcrate => cross-crate}/auxiliary/xcrate_unit_struct.rs (100%) rename tests/ui/cross-crate/{xcrate_generic_fn_nested_return.rs => generic_fn_nested_return.rs} (100%) rename tests/ui/{xcrate/xcrate-private-by-default.rs => cross-crate/private-by-default.rs} (100%) rename tests/ui/{xcrate/xcrate-private-by-default.stderr => cross-crate/private-by-default.stderr} (88%) rename tests/ui/cross-crate/{xcrate-static-addresses.rs => static-addresses.rs} (100%) rename tests/ui/cross-crate/{xcrate-trait-lifetime-param.rs => trait-lifetime-param.rs} (100%) rename tests/ui/{xcrate/xcrate-unit-struct-2.rs => cross-crate/unit-struct-2.rs} (100%) rename tests/ui/{xcrate/xcrate-unit-struct.rs => cross-crate/unit-struct.rs} (100%) rename tests/ui/{xcrate/xcrate-unit-struct.stderr => cross-crate/unit-struct.stderr} (92%) rename tests/ui/{expr-block-fn.rs => expr/block-fn.rs} (100%) rename tests/ui/{expr-block-generic.rs => expr/block-generic.rs} (100%) rename tests/ui/{expr-block.rs => expr/block.rs} (100%) rename tests/ui/{expr-copy.rs => expr/copy.rs} (100%) rename tests/ui/{expr-if-generic.rs => expr/if-generic.rs} (100%) rename tests/ui/{expr-if-panic-all.rs => expr/if-panic-all.rs} (100%) rename tests/ui/{expr-scope.rs => expr/scope.rs} (100%) rename tests/ui/{ => feature-gates}/stmt_expr_attrs_no_feature.rs (100%) rename tests/ui/{ => feature-gates}/stmt_expr_attrs_no_feature.stderr (100%) rename tests/ui/{ => ffi-attrs}/ffi_const.rs (100%) rename tests/ui/{ => ffi-attrs}/ffi_const.stderr (100%) rename tests/ui/{ => ffi-attrs}/ffi_const2.rs (100%) rename tests/ui/{ => ffi-attrs}/ffi_const2.stderr (100%) rename tests/ui/{ => ffi-attrs}/ffi_pure.rs (100%) rename tests/ui/{ => ffi-attrs}/ffi_pure.stderr (100%) rename tests/ui/{main-wrong-location.rs => fn-main/wrong-location.rs} (100%) rename tests/ui/{main-wrong-location.stderr => fn-main/wrong-location.stderr} (70%) rename tests/ui/{main-wrong-type.rs => fn-main/wrong-type.rs} (100%) rename tests/ui/{main-wrong-type.stderr => fn-main/wrong-type.stderr} (90%) rename tests/ui/{ => foreign}/foreign-fn-return-lifetime.rs (100%) rename tests/ui/{ => foreign}/foreign-fn-return-lifetime.stderr (100%) rename tests/ui/{ => fuel}/optimization-fuel-0.rs (100%) rename tests/ui/{ => fuel}/optimization-fuel-0.stderr (100%) rename tests/ui/{ => fuel}/optimization-fuel-1.rs (100%) rename tests/ui/{ => fuel}/optimization-fuel-1.stderr (100%) rename tests/ui/{print-fuel => fuel}/print-fuel.rs (100%) rename tests/ui/{print-fuel => fuel}/print-fuel.stderr (100%) rename tests/ui/{ => inference}/infer-fn-tail-expr.rs (100%) rename tests/ui/{ => inference}/lambda-infer-unresolved.rs (100%) rename tests/ui/{ => inference}/order-dependent-cast-inference.rs (100%) rename tests/ui/{ => inference}/order-dependent-cast-inference.stderr (100%) rename tests/ui/{intrinsics-always-extern.rs => intrinsics/always-extern.rs} (100%) rename tests/ui/{intrinsics-always-extern.stderr => intrinsics/always-extern.stderr} (83%) rename tests/ui/{ => intrinsics}/reify-intrinsic.rs (100%) rename tests/ui/{ => intrinsics}/reify-intrinsic.stderr (100%) rename tests/ui/{lint-group-denied-lint-allowed.rs => lint/group-denied-lint-allowed.rs} (100%) rename tests/ui/{lint-group-forbid-always-trumps-cli.rs => lint/group-forbid-always-trumps-cli.rs} (100%) rename tests/ui/{lint-group-forbid-always-trumps-cli.stderr => lint/group-forbid-always-trumps-cli.stderr} (84%) rename tests/ui/{lint-unknown-lints-at-crate-level.rs => lint/unknown-lints-at-crate-level.rs} (100%) rename tests/ui/{ => macros}/compile_error_macro.rs (100%) rename tests/ui/{ => macros}/compile_error_macro.stderr (100%) rename tests/ui/{ => macros}/module-macro_use-arguments.rs (100%) rename tests/ui/{ => macros}/module-macro_use-arguments.stderr (100%) rename tests/ui/{ => macros}/no-patterns-in-args-macro.rs (100%) rename tests/ui/{ => macros}/no-patterns-in-args-macro.stderr (100%) rename tests/ui/{ => parser}/super-fast-paren-parsing.rs (82%) rename tests/ui/{ => pattern}/by-move-pattern-binding.rs (100%) rename tests/ui/{ => pattern}/by-move-pattern-binding.stderr (100%) rename tests/ui/{ => pattern}/fn-in-pat.rs (100%) rename tests/ui/{ => pattern}/fn-in-pat.stderr (100%) rename tests/ui/{ => pattern}/inc-range-pat.rs (100%) rename tests/ui/{ => pattern}/no-patterns-in-args-2.rs (100%) rename tests/ui/{ => pattern}/no-patterns-in-args-2.stderr (100%) rename tests/ui/{ => pattern}/no-patterns-in-args.rs (100%) rename tests/ui/{ => pattern}/no-patterns-in-args.stderr (100%) rename tests/ui/{ => process}/env-args-reverse-iterator.rs (100%) rename tests/ui/{ => process}/env-funky-keys.rs (100%) rename tests/ui/{ => process}/env-null-vars.rs (100%) rename tests/ui/{ => process}/env-vars.rs (100%) rename tests/ui/{ => process}/exec-env.rs (100%) rename tests/ui/{ => process}/inherit-env.rs (100%) rename tests/ui/{ => range}/impossible_range.fixed (100%) rename tests/ui/{ => range}/impossible_range.rs (100%) rename tests/ui/{ => range}/impossible_range.stderr (100%) rename tests/ui/{ => range}/range_inclusive.rs (100%) rename tests/ui/{ => repr}/conflicting-repr-hints.rs (100%) rename tests/ui/{ => repr}/conflicting-repr-hints.stderr (100%) rename tests/ui/{ => return}/ret-bang.rs (100%) rename tests/ui/{ => return}/ret-non-nil.rs (100%) rename tests/ui/{ => return}/ret-non-nil.stderr (100%) rename tests/ui/{ => return}/return-disjoint-regions.rs (100%) rename tests/ui/{ => return}/return-disjoint-regions.stderr (100%) rename tests/ui/{ => return}/return-nil.rs (100%) rename tests/ui/{ => statics}/auxiliary/check_static_recursion_foreign_helper.rs (100%) rename tests/ui/{check-static-immutable-mut-slices.rs => statics/check-immutable-mut-slices.rs} (100%) rename tests/ui/{check-static-immutable-mut-slices.stderr => statics/check-immutable-mut-slices.stderr} (84%) rename tests/ui/{check-static-recursion-foreign.rs => statics/check-recursion-foreign.rs} (100%) rename tests/ui/{check-static-values-constraints.rs => statics/check-values-constraints.rs} (100%) rename tests/ui/{check-static-values-constraints.stderr => statics/check-values-constraints.stderr} (88%) rename tests/ui/{ => suggestions}/dont-suggest-private-trait-method.rs (100%) rename tests/ui/{ => suggestions}/dont-suggest-private-trait-method.stderr (100%) rename tests/ui/{ => suggestions}/suggest-null-ptr.fixed (100%) rename tests/ui/{ => suggestions}/suggest-null-ptr.rs (100%) rename tests/ui/{ => suggestions}/suggest-null-ptr.stderr (100%) rename tests/ui/{ => suggestions}/trait-impl-bound-suggestions.fixed (100%) rename tests/ui/{ => suggestions}/trait-impl-bound-suggestions.rs (100%) rename tests/ui/{ => suggestions}/trait-impl-bound-suggestions.stderr (100%) rename tests/ui/{ => tool-attributes}/tool_lints-fail.rs (100%) rename tests/ui/{ => tool-attributes}/tool_lints-fail.stderr (100%) rename tests/ui/{ => tool-attributes}/tool_lints-rpass.rs (100%) rename tests/ui/{ => tool-attributes}/tool_lints.rs (100%) rename tests/ui/{ => tool-attributes}/tool_lints.stderr (100%) rename tests/ui/{ => tool-attributes}/tool_lints_2018_preview.rs (100%) rename tests/ui/{ => tool-attributes}/unknown-lint-tool-name.rs (100%) rename tests/ui/{ => tool-attributes}/unknown-lint-tool-name.stderr (100%) rename tests/ui/{ => tool-attributes}/unknown-tool-name.rs (100%) rename tests/ui/{ => tool-attributes}/unknown-tool-name.stderr (100%) rename tests/ui/{ => unop}/unop-move-semantics.rs (100%) rename tests/ui/{ => unop}/unop-move-semantics.stderr (100%) rename tests/ui/{ => unop}/unop-neg-bool.rs (100%) rename tests/ui/{ => unop}/unop-neg-bool.stderr (100%) diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 6e92dab1abc11..e1c6c9a2dacd1 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -16,7 +16,7 @@ const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. const ISSUES_ENTRY_LIMIT: usize = 1676; -const ROOT_ENTRY_LIMIT: usize = 859; +const ROOT_ENTRY_LIMIT: usize = 757; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ "rs", // test source files diff --git a/tests/ui/empty_global_asm.rs b/tests/ui/asm/empty_global_asm.rs similarity index 100% rename from tests/ui/empty_global_asm.rs rename to tests/ui/asm/empty_global_asm.rs diff --git a/tests/ui/simple_global_asm.rs b/tests/ui/asm/simple_global_asm.rs similarity index 100% rename from tests/ui/simple_global_asm.rs rename to tests/ui/asm/simple_global_asm.rs diff --git a/tests/ui/backtrace-apple-no-dsymutil.rs b/tests/ui/backtrace/apple-no-dsymutil.rs similarity index 100% rename from tests/ui/backtrace-apple-no-dsymutil.rs rename to tests/ui/backtrace/apple-no-dsymutil.rs diff --git a/tests/ui/debuginfo/auxiliary/dylib-dep-helper-aux.rs b/tests/ui/backtrace/auxiliary/dylib-dep-helper-aux.rs similarity index 100% rename from tests/ui/debuginfo/auxiliary/dylib-dep-helper-aux.rs rename to tests/ui/backtrace/auxiliary/dylib-dep-helper-aux.rs diff --git a/tests/ui/debuginfo/auxiliary/dylib-dep-helper.rs b/tests/ui/backtrace/auxiliary/dylib-dep-helper.rs similarity index 100% rename from tests/ui/debuginfo/auxiliary/dylib-dep-helper.rs rename to tests/ui/backtrace/auxiliary/dylib-dep-helper.rs diff --git a/tests/ui/debuginfo/auxiliary/line-tables-only-helper.rs b/tests/ui/backtrace/auxiliary/line-tables-only-helper.rs similarity index 100% rename from tests/ui/debuginfo/auxiliary/line-tables-only-helper.rs rename to tests/ui/backtrace/auxiliary/line-tables-only-helper.rs diff --git a/tests/ui/backtrace.rs b/tests/ui/backtrace/backtrace.rs similarity index 100% rename from tests/ui/backtrace.rs rename to tests/ui/backtrace/backtrace.rs diff --git a/tests/ui/debuginfo/backtrace-dylib-dep.rs b/tests/ui/backtrace/dylib-dep.rs similarity index 100% rename from tests/ui/debuginfo/backtrace-dylib-dep.rs rename to tests/ui/backtrace/dylib-dep.rs diff --git a/tests/ui/debuginfo/backtrace-line-tables-only.rs b/tests/ui/backtrace/line-tables-only.rs similarity index 100% rename from tests/ui/debuginfo/backtrace-line-tables-only.rs rename to tests/ui/backtrace/line-tables-only.rs diff --git a/tests/ui/std-backtrace.rs b/tests/ui/backtrace/std-backtrace.rs similarity index 100% rename from tests/ui/std-backtrace.rs rename to tests/ui/backtrace/std-backtrace.rs diff --git a/tests/ui/auxiliary/orphan-check-diagnostics.rs b/tests/ui/coherence/auxiliary/orphan-check-diagnostics.rs similarity index 100% rename from tests/ui/auxiliary/orphan-check-diagnostics.rs rename to tests/ui/coherence/auxiliary/orphan-check-diagnostics.rs diff --git a/tests/ui/orphan-check-diagnostics.rs b/tests/ui/coherence/orphan-check-diagnostics.rs similarity index 100% rename from tests/ui/orphan-check-diagnostics.rs rename to tests/ui/coherence/orphan-check-diagnostics.rs diff --git a/tests/ui/orphan-check-diagnostics.stderr b/tests/ui/coherence/orphan-check-diagnostics.stderr similarity index 100% rename from tests/ui/orphan-check-diagnostics.stderr rename to tests/ui/coherence/orphan-check-diagnostics.stderr diff --git a/tests/ui/cross-crate/xcrate-address-insignificant.rs b/tests/ui/cross-crate/address-insignificant.rs similarity index 100% rename from tests/ui/cross-crate/xcrate-address-insignificant.rs rename to tests/ui/cross-crate/address-insignificant.rs diff --git a/tests/ui/cross-crate/xcrate-associated-type-defaults.rs b/tests/ui/cross-crate/associated-type-defaults.rs similarity index 100% rename from tests/ui/cross-crate/xcrate-associated-type-defaults.rs rename to tests/ui/cross-crate/associated-type-defaults.rs diff --git a/tests/ui/xcrate/auxiliary/static_priv_by_default.rs b/tests/ui/cross-crate/auxiliary/static_priv_by_default.rs similarity index 100% rename from tests/ui/xcrate/auxiliary/static_priv_by_default.rs rename to tests/ui/cross-crate/auxiliary/static_priv_by_default.rs diff --git a/tests/ui/xcrate/auxiliary/xcrate_unit_struct.rs b/tests/ui/cross-crate/auxiliary/xcrate_unit_struct.rs similarity index 100% rename from tests/ui/xcrate/auxiliary/xcrate_unit_struct.rs rename to tests/ui/cross-crate/auxiliary/xcrate_unit_struct.rs diff --git a/tests/ui/cross-crate/xcrate_generic_fn_nested_return.rs b/tests/ui/cross-crate/generic_fn_nested_return.rs similarity index 100% rename from tests/ui/cross-crate/xcrate_generic_fn_nested_return.rs rename to tests/ui/cross-crate/generic_fn_nested_return.rs diff --git a/tests/ui/xcrate/xcrate-private-by-default.rs b/tests/ui/cross-crate/private-by-default.rs similarity index 100% rename from tests/ui/xcrate/xcrate-private-by-default.rs rename to tests/ui/cross-crate/private-by-default.rs diff --git a/tests/ui/xcrate/xcrate-private-by-default.stderr b/tests/ui/cross-crate/private-by-default.stderr similarity index 88% rename from tests/ui/xcrate/xcrate-private-by-default.stderr rename to tests/ui/cross-crate/private-by-default.stderr index 25bbbf5f62aa2..398c9088aae21 100644 --- a/tests/ui/xcrate/xcrate-private-by-default.stderr +++ b/tests/ui/cross-crate/private-by-default.stderr @@ -1,5 +1,5 @@ error[E0603]: static `j` is private - --> $DIR/xcrate-private-by-default.rs:23:29 + --> $DIR/private-by-default.rs:23:29 | LL | static_priv_by_default::j; | ^ private static @@ -11,7 +11,7 @@ LL | static j: isize = 0; | ^^^^^^^^^^^^^^^ error[E0603]: function `k` is private - --> $DIR/xcrate-private-by-default.rs:25:29 + --> $DIR/private-by-default.rs:25:29 | LL | static_priv_by_default::k; | ^ private function @@ -23,7 +23,7 @@ LL | fn k() {} | ^^^^^^ error[E0603]: unit struct `l` is private - --> $DIR/xcrate-private-by-default.rs:27:29 + --> $DIR/private-by-default.rs:27:29 | LL | static_priv_by_default::l; | ^ private unit struct @@ -35,7 +35,7 @@ LL | struct l; | ^^^^^^^^ error[E0603]: enum `m` is private - --> $DIR/xcrate-private-by-default.rs:29:35 + --> $DIR/private-by-default.rs:29:35 | LL | foo::(); | ^ private enum @@ -47,7 +47,7 @@ LL | enum m {} | ^^^^^^ error[E0603]: type alias `n` is private - --> $DIR/xcrate-private-by-default.rs:31:35 + --> $DIR/private-by-default.rs:31:35 | LL | foo::(); | ^ private type alias @@ -59,7 +59,7 @@ LL | type n = isize; | ^^^^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:35:29 + --> $DIR/private-by-default.rs:35:29 | LL | static_priv_by_default::foo::a; | ^^^ - static `a` is not publicly re-exported @@ -73,7 +73,7 @@ LL | mod foo { | ^^^^^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:37:29 + --> $DIR/private-by-default.rs:37:29 | LL | static_priv_by_default::foo::b; | ^^^ - function `b` is not publicly re-exported @@ -87,7 +87,7 @@ LL | mod foo { | ^^^^^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:39:29 + --> $DIR/private-by-default.rs:39:29 | LL | static_priv_by_default::foo::c; | ^^^ - unit struct `c` is not publicly re-exported @@ -101,7 +101,7 @@ LL | mod foo { | ^^^^^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:41:35 + --> $DIR/private-by-default.rs:41:35 | LL | foo::(); | ^^^ - enum `d` is not publicly re-exported @@ -115,7 +115,7 @@ LL | mod foo { | ^^^^^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:43:35 + --> $DIR/private-by-default.rs:43:35 | LL | foo::(); | ^^^ - type alias `e` is not publicly re-exported diff --git a/tests/ui/cross-crate/xcrate-static-addresses.rs b/tests/ui/cross-crate/static-addresses.rs similarity index 100% rename from tests/ui/cross-crate/xcrate-static-addresses.rs rename to tests/ui/cross-crate/static-addresses.rs diff --git a/tests/ui/cross-crate/xcrate-trait-lifetime-param.rs b/tests/ui/cross-crate/trait-lifetime-param.rs similarity index 100% rename from tests/ui/cross-crate/xcrate-trait-lifetime-param.rs rename to tests/ui/cross-crate/trait-lifetime-param.rs diff --git a/tests/ui/xcrate/xcrate-unit-struct-2.rs b/tests/ui/cross-crate/unit-struct-2.rs similarity index 100% rename from tests/ui/xcrate/xcrate-unit-struct-2.rs rename to tests/ui/cross-crate/unit-struct-2.rs diff --git a/tests/ui/xcrate/xcrate-unit-struct.rs b/tests/ui/cross-crate/unit-struct.rs similarity index 100% rename from tests/ui/xcrate/xcrate-unit-struct.rs rename to tests/ui/cross-crate/unit-struct.rs diff --git a/tests/ui/xcrate/xcrate-unit-struct.stderr b/tests/ui/cross-crate/unit-struct.stderr similarity index 92% rename from tests/ui/xcrate/xcrate-unit-struct.stderr rename to tests/ui/cross-crate/unit-struct.stderr index 7365170b69ea2..a7e3e4685a997 100644 --- a/tests/ui/xcrate/xcrate-unit-struct.stderr +++ b/tests/ui/cross-crate/unit-struct.stderr @@ -1,5 +1,5 @@ error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithFields` - --> $DIR/xcrate-unit-struct.rs:9:13 + --> $DIR/unit-struct.rs:9:13 | LL | let _ = xcrate_unit_struct::StructWithFields; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `xcrate_unit_struct::StructWithFields { foo: val }` @@ -10,7 +10,7 @@ LL | pub struct StructWithFields { | --------------------------- `xcrate_unit_struct::StructWithFields` defined here error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithPrivFields` - --> $DIR/xcrate-unit-struct.rs:11:13 + --> $DIR/unit-struct.rs:11:13 | LL | let _ = xcrate_unit_struct::StructWithPrivFields; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/expr-block-fn.rs b/tests/ui/expr/block-fn.rs similarity index 100% rename from tests/ui/expr-block-fn.rs rename to tests/ui/expr/block-fn.rs diff --git a/tests/ui/expr-block-generic.rs b/tests/ui/expr/block-generic.rs similarity index 100% rename from tests/ui/expr-block-generic.rs rename to tests/ui/expr/block-generic.rs diff --git a/tests/ui/expr-block.rs b/tests/ui/expr/block.rs similarity index 100% rename from tests/ui/expr-block.rs rename to tests/ui/expr/block.rs diff --git a/tests/ui/expr-copy.rs b/tests/ui/expr/copy.rs similarity index 100% rename from tests/ui/expr-copy.rs rename to tests/ui/expr/copy.rs diff --git a/tests/ui/expr-if-generic.rs b/tests/ui/expr/if-generic.rs similarity index 100% rename from tests/ui/expr-if-generic.rs rename to tests/ui/expr/if-generic.rs diff --git a/tests/ui/expr-if-panic-all.rs b/tests/ui/expr/if-panic-all.rs similarity index 100% rename from tests/ui/expr-if-panic-all.rs rename to tests/ui/expr/if-panic-all.rs diff --git a/tests/ui/expr-scope.rs b/tests/ui/expr/scope.rs similarity index 100% rename from tests/ui/expr-scope.rs rename to tests/ui/expr/scope.rs diff --git a/tests/ui/stmt_expr_attrs_no_feature.rs b/tests/ui/feature-gates/stmt_expr_attrs_no_feature.rs similarity index 100% rename from tests/ui/stmt_expr_attrs_no_feature.rs rename to tests/ui/feature-gates/stmt_expr_attrs_no_feature.rs diff --git a/tests/ui/stmt_expr_attrs_no_feature.stderr b/tests/ui/feature-gates/stmt_expr_attrs_no_feature.stderr similarity index 100% rename from tests/ui/stmt_expr_attrs_no_feature.stderr rename to tests/ui/feature-gates/stmt_expr_attrs_no_feature.stderr diff --git a/tests/ui/ffi_const.rs b/tests/ui/ffi-attrs/ffi_const.rs similarity index 100% rename from tests/ui/ffi_const.rs rename to tests/ui/ffi-attrs/ffi_const.rs diff --git a/tests/ui/ffi_const.stderr b/tests/ui/ffi-attrs/ffi_const.stderr similarity index 100% rename from tests/ui/ffi_const.stderr rename to tests/ui/ffi-attrs/ffi_const.stderr diff --git a/tests/ui/ffi_const2.rs b/tests/ui/ffi-attrs/ffi_const2.rs similarity index 100% rename from tests/ui/ffi_const2.rs rename to tests/ui/ffi-attrs/ffi_const2.rs diff --git a/tests/ui/ffi_const2.stderr b/tests/ui/ffi-attrs/ffi_const2.stderr similarity index 100% rename from tests/ui/ffi_const2.stderr rename to tests/ui/ffi-attrs/ffi_const2.stderr diff --git a/tests/ui/ffi_pure.rs b/tests/ui/ffi-attrs/ffi_pure.rs similarity index 100% rename from tests/ui/ffi_pure.rs rename to tests/ui/ffi-attrs/ffi_pure.rs diff --git a/tests/ui/ffi_pure.stderr b/tests/ui/ffi-attrs/ffi_pure.stderr similarity index 100% rename from tests/ui/ffi_pure.stderr rename to tests/ui/ffi-attrs/ffi_pure.stderr diff --git a/tests/ui/main-wrong-location.rs b/tests/ui/fn-main/wrong-location.rs similarity index 100% rename from tests/ui/main-wrong-location.rs rename to tests/ui/fn-main/wrong-location.rs diff --git a/tests/ui/main-wrong-location.stderr b/tests/ui/fn-main/wrong-location.stderr similarity index 70% rename from tests/ui/main-wrong-location.stderr rename to tests/ui/fn-main/wrong-location.stderr index 9486a94056283..c47092bc47e92 100644 --- a/tests/ui/main-wrong-location.stderr +++ b/tests/ui/fn-main/wrong-location.stderr @@ -1,11 +1,11 @@ -error[E0601]: `main` function not found in crate `main_wrong_location` - --> $DIR/main-wrong-location.rs:5:2 +error[E0601]: `main` function not found in crate `wrong_location` + --> $DIR/wrong-location.rs:5:2 | LL | } - | ^ the main function must be defined at the crate level (in `$DIR/main-wrong-location.rs`) + | ^ the main function must be defined at the crate level (in `$DIR/wrong-location.rs`) | note: here is a function named `main` - --> $DIR/main-wrong-location.rs:4:5 + --> $DIR/wrong-location.rs:4:5 | LL | fn main() { } | ^^^^^^^^^ diff --git a/tests/ui/main-wrong-type.rs b/tests/ui/fn-main/wrong-type.rs similarity index 100% rename from tests/ui/main-wrong-type.rs rename to tests/ui/fn-main/wrong-type.rs diff --git a/tests/ui/main-wrong-type.stderr b/tests/ui/fn-main/wrong-type.stderr similarity index 90% rename from tests/ui/main-wrong-type.stderr rename to tests/ui/fn-main/wrong-type.stderr index d07fc09064f2b..2b0096431dbac 100644 --- a/tests/ui/main-wrong-type.stderr +++ b/tests/ui/fn-main/wrong-type.stderr @@ -1,5 +1,5 @@ error[E0580]: `main` function has wrong type - --> $DIR/main-wrong-type.rs:6:1 + --> $DIR/wrong-type.rs:6:1 | LL | fn main(foo: S) { | ^^^^^^^^^^^^^^^ incorrect number of function parameters diff --git a/tests/ui/foreign-fn-return-lifetime.rs b/tests/ui/foreign/foreign-fn-return-lifetime.rs similarity index 100% rename from tests/ui/foreign-fn-return-lifetime.rs rename to tests/ui/foreign/foreign-fn-return-lifetime.rs diff --git a/tests/ui/foreign-fn-return-lifetime.stderr b/tests/ui/foreign/foreign-fn-return-lifetime.stderr similarity index 100% rename from tests/ui/foreign-fn-return-lifetime.stderr rename to tests/ui/foreign/foreign-fn-return-lifetime.stderr diff --git a/tests/ui/optimization-fuel-0.rs b/tests/ui/fuel/optimization-fuel-0.rs similarity index 100% rename from tests/ui/optimization-fuel-0.rs rename to tests/ui/fuel/optimization-fuel-0.rs diff --git a/tests/ui/optimization-fuel-0.stderr b/tests/ui/fuel/optimization-fuel-0.stderr similarity index 100% rename from tests/ui/optimization-fuel-0.stderr rename to tests/ui/fuel/optimization-fuel-0.stderr diff --git a/tests/ui/optimization-fuel-1.rs b/tests/ui/fuel/optimization-fuel-1.rs similarity index 100% rename from tests/ui/optimization-fuel-1.rs rename to tests/ui/fuel/optimization-fuel-1.rs diff --git a/tests/ui/optimization-fuel-1.stderr b/tests/ui/fuel/optimization-fuel-1.stderr similarity index 100% rename from tests/ui/optimization-fuel-1.stderr rename to tests/ui/fuel/optimization-fuel-1.stderr diff --git a/tests/ui/print-fuel/print-fuel.rs b/tests/ui/fuel/print-fuel.rs similarity index 100% rename from tests/ui/print-fuel/print-fuel.rs rename to tests/ui/fuel/print-fuel.rs diff --git a/tests/ui/print-fuel/print-fuel.stderr b/tests/ui/fuel/print-fuel.stderr similarity index 100% rename from tests/ui/print-fuel/print-fuel.stderr rename to tests/ui/fuel/print-fuel.stderr diff --git a/tests/ui/infer-fn-tail-expr.rs b/tests/ui/inference/infer-fn-tail-expr.rs similarity index 100% rename from tests/ui/infer-fn-tail-expr.rs rename to tests/ui/inference/infer-fn-tail-expr.rs diff --git a/tests/ui/lambda-infer-unresolved.rs b/tests/ui/inference/lambda-infer-unresolved.rs similarity index 100% rename from tests/ui/lambda-infer-unresolved.rs rename to tests/ui/inference/lambda-infer-unresolved.rs diff --git a/tests/ui/order-dependent-cast-inference.rs b/tests/ui/inference/order-dependent-cast-inference.rs similarity index 100% rename from tests/ui/order-dependent-cast-inference.rs rename to tests/ui/inference/order-dependent-cast-inference.rs diff --git a/tests/ui/order-dependent-cast-inference.stderr b/tests/ui/inference/order-dependent-cast-inference.stderr similarity index 100% rename from tests/ui/order-dependent-cast-inference.stderr rename to tests/ui/inference/order-dependent-cast-inference.stderr diff --git a/tests/ui/intrinsics-always-extern.rs b/tests/ui/intrinsics/always-extern.rs similarity index 100% rename from tests/ui/intrinsics-always-extern.rs rename to tests/ui/intrinsics/always-extern.rs diff --git a/tests/ui/intrinsics-always-extern.stderr b/tests/ui/intrinsics/always-extern.stderr similarity index 83% rename from tests/ui/intrinsics-always-extern.stderr rename to tests/ui/intrinsics/always-extern.stderr index 1f7bb5a3b0de2..44b889c6faac6 100644 --- a/tests/ui/intrinsics-always-extern.stderr +++ b/tests/ui/intrinsics/always-extern.stderr @@ -1,11 +1,11 @@ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/intrinsics-always-extern.rs:4:32 + --> $DIR/always-extern.rs:4:32 | LL | extern "rust-intrinsic" fn foo(&self); | ^^^ error[E0093]: unrecognized intrinsic function: `hello` - --> $DIR/intrinsics-always-extern.rs:12:28 + --> $DIR/always-extern.rs:12:28 | LL | extern "rust-intrinsic" fn hello() { | ^^^^^ unrecognized intrinsic @@ -13,7 +13,7 @@ LL | extern "rust-intrinsic" fn hello() { = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/intrinsics-always-extern.rs:8:43 + --> $DIR/always-extern.rs:8:43 | LL | extern "rust-intrinsic" fn foo(&self) { | ___________________________________________^ @@ -21,7 +21,7 @@ LL | | } | |_____^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/intrinsics-always-extern.rs:12:36 + --> $DIR/always-extern.rs:12:36 | LL | extern "rust-intrinsic" fn hello() { | ____________________________________^ diff --git a/tests/ui/reify-intrinsic.rs b/tests/ui/intrinsics/reify-intrinsic.rs similarity index 100% rename from tests/ui/reify-intrinsic.rs rename to tests/ui/intrinsics/reify-intrinsic.rs diff --git a/tests/ui/reify-intrinsic.stderr b/tests/ui/intrinsics/reify-intrinsic.stderr similarity index 100% rename from tests/ui/reify-intrinsic.stderr rename to tests/ui/intrinsics/reify-intrinsic.stderr diff --git a/tests/ui/lint-group-denied-lint-allowed.rs b/tests/ui/lint/group-denied-lint-allowed.rs similarity index 100% rename from tests/ui/lint-group-denied-lint-allowed.rs rename to tests/ui/lint/group-denied-lint-allowed.rs diff --git a/tests/ui/lint-group-forbid-always-trumps-cli.rs b/tests/ui/lint/group-forbid-always-trumps-cli.rs similarity index 100% rename from tests/ui/lint-group-forbid-always-trumps-cli.rs rename to tests/ui/lint/group-forbid-always-trumps-cli.rs diff --git a/tests/ui/lint-group-forbid-always-trumps-cli.stderr b/tests/ui/lint/group-forbid-always-trumps-cli.stderr similarity index 84% rename from tests/ui/lint-group-forbid-always-trumps-cli.stderr rename to tests/ui/lint/group-forbid-always-trumps-cli.stderr index 04a0f56c1633a..21674ebae9cec 100644 --- a/tests/ui/lint-group-forbid-always-trumps-cli.stderr +++ b/tests/ui/lint/group-forbid-always-trumps-cli.stderr @@ -1,5 +1,5 @@ error: unused variable: `x` - --> $DIR/lint-group-forbid-always-trumps-cli.rs:4:9 + --> $DIR/group-forbid-always-trumps-cli.rs:4:9 | LL | let x = 1; | ^ help: if this is intentional, prefix it with an underscore: `_x` diff --git a/tests/ui/lint-unknown-lints-at-crate-level.rs b/tests/ui/lint/unknown-lints-at-crate-level.rs similarity index 100% rename from tests/ui/lint-unknown-lints-at-crate-level.rs rename to tests/ui/lint/unknown-lints-at-crate-level.rs diff --git a/tests/ui/compile_error_macro.rs b/tests/ui/macros/compile_error_macro.rs similarity index 100% rename from tests/ui/compile_error_macro.rs rename to tests/ui/macros/compile_error_macro.rs diff --git a/tests/ui/compile_error_macro.stderr b/tests/ui/macros/compile_error_macro.stderr similarity index 100% rename from tests/ui/compile_error_macro.stderr rename to tests/ui/macros/compile_error_macro.stderr diff --git a/tests/ui/module-macro_use-arguments.rs b/tests/ui/macros/module-macro_use-arguments.rs similarity index 100% rename from tests/ui/module-macro_use-arguments.rs rename to tests/ui/macros/module-macro_use-arguments.rs diff --git a/tests/ui/module-macro_use-arguments.stderr b/tests/ui/macros/module-macro_use-arguments.stderr similarity index 100% rename from tests/ui/module-macro_use-arguments.stderr rename to tests/ui/macros/module-macro_use-arguments.stderr diff --git a/tests/ui/no-patterns-in-args-macro.rs b/tests/ui/macros/no-patterns-in-args-macro.rs similarity index 100% rename from tests/ui/no-patterns-in-args-macro.rs rename to tests/ui/macros/no-patterns-in-args-macro.rs diff --git a/tests/ui/no-patterns-in-args-macro.stderr b/tests/ui/macros/no-patterns-in-args-macro.stderr similarity index 100% rename from tests/ui/no-patterns-in-args-macro.stderr rename to tests/ui/macros/no-patterns-in-args-macro.stderr diff --git a/tests/ui/super-fast-paren-parsing.rs b/tests/ui/parser/super-fast-paren-parsing.rs similarity index 82% rename from tests/ui/super-fast-paren-parsing.rs rename to tests/ui/parser/super-fast-paren-parsing.rs index ce7283eee0349..5b7cd6fe47d52 100644 --- a/tests/ui/super-fast-paren-parsing.rs +++ b/tests/ui/parser/super-fast-paren-parsing.rs @@ -3,10 +3,7 @@ #![allow(unused_parens)] #![allow(non_upper_case_globals)] #![allow(dead_code)] -//@ exec-env:RUST_MIN_STACK=16000000 -//@ rustc-env:RUST_MIN_STACK=16000000 -// -// Big stack is needed for pretty printing, a little sad... +#![cfg_attr(rustfmt, rustfmt::skip)] static a: isize = ((((((((((((((((((((((((((((((((((((((((((((((((((( diff --git a/tests/ui/by-move-pattern-binding.rs b/tests/ui/pattern/by-move-pattern-binding.rs similarity index 100% rename from tests/ui/by-move-pattern-binding.rs rename to tests/ui/pattern/by-move-pattern-binding.rs diff --git a/tests/ui/by-move-pattern-binding.stderr b/tests/ui/pattern/by-move-pattern-binding.stderr similarity index 100% rename from tests/ui/by-move-pattern-binding.stderr rename to tests/ui/pattern/by-move-pattern-binding.stderr diff --git a/tests/ui/fn-in-pat.rs b/tests/ui/pattern/fn-in-pat.rs similarity index 100% rename from tests/ui/fn-in-pat.rs rename to tests/ui/pattern/fn-in-pat.rs diff --git a/tests/ui/fn-in-pat.stderr b/tests/ui/pattern/fn-in-pat.stderr similarity index 100% rename from tests/ui/fn-in-pat.stderr rename to tests/ui/pattern/fn-in-pat.stderr diff --git a/tests/ui/inc-range-pat.rs b/tests/ui/pattern/inc-range-pat.rs similarity index 100% rename from tests/ui/inc-range-pat.rs rename to tests/ui/pattern/inc-range-pat.rs diff --git a/tests/ui/no-patterns-in-args-2.rs b/tests/ui/pattern/no-patterns-in-args-2.rs similarity index 100% rename from tests/ui/no-patterns-in-args-2.rs rename to tests/ui/pattern/no-patterns-in-args-2.rs diff --git a/tests/ui/no-patterns-in-args-2.stderr b/tests/ui/pattern/no-patterns-in-args-2.stderr similarity index 100% rename from tests/ui/no-patterns-in-args-2.stderr rename to tests/ui/pattern/no-patterns-in-args-2.stderr diff --git a/tests/ui/no-patterns-in-args.rs b/tests/ui/pattern/no-patterns-in-args.rs similarity index 100% rename from tests/ui/no-patterns-in-args.rs rename to tests/ui/pattern/no-patterns-in-args.rs diff --git a/tests/ui/no-patterns-in-args.stderr b/tests/ui/pattern/no-patterns-in-args.stderr similarity index 100% rename from tests/ui/no-patterns-in-args.stderr rename to tests/ui/pattern/no-patterns-in-args.stderr diff --git a/tests/ui/env-args-reverse-iterator.rs b/tests/ui/process/env-args-reverse-iterator.rs similarity index 100% rename from tests/ui/env-args-reverse-iterator.rs rename to tests/ui/process/env-args-reverse-iterator.rs diff --git a/tests/ui/env-funky-keys.rs b/tests/ui/process/env-funky-keys.rs similarity index 100% rename from tests/ui/env-funky-keys.rs rename to tests/ui/process/env-funky-keys.rs diff --git a/tests/ui/env-null-vars.rs b/tests/ui/process/env-null-vars.rs similarity index 100% rename from tests/ui/env-null-vars.rs rename to tests/ui/process/env-null-vars.rs diff --git a/tests/ui/env-vars.rs b/tests/ui/process/env-vars.rs similarity index 100% rename from tests/ui/env-vars.rs rename to tests/ui/process/env-vars.rs diff --git a/tests/ui/exec-env.rs b/tests/ui/process/exec-env.rs similarity index 100% rename from tests/ui/exec-env.rs rename to tests/ui/process/exec-env.rs diff --git a/tests/ui/inherit-env.rs b/tests/ui/process/inherit-env.rs similarity index 100% rename from tests/ui/inherit-env.rs rename to tests/ui/process/inherit-env.rs diff --git a/tests/ui/impossible_range.fixed b/tests/ui/range/impossible_range.fixed similarity index 100% rename from tests/ui/impossible_range.fixed rename to tests/ui/range/impossible_range.fixed diff --git a/tests/ui/impossible_range.rs b/tests/ui/range/impossible_range.rs similarity index 100% rename from tests/ui/impossible_range.rs rename to tests/ui/range/impossible_range.rs diff --git a/tests/ui/impossible_range.stderr b/tests/ui/range/impossible_range.stderr similarity index 100% rename from tests/ui/impossible_range.stderr rename to tests/ui/range/impossible_range.stderr diff --git a/tests/ui/range_inclusive.rs b/tests/ui/range/range_inclusive.rs similarity index 100% rename from tests/ui/range_inclusive.rs rename to tests/ui/range/range_inclusive.rs diff --git a/tests/ui/conflicting-repr-hints.rs b/tests/ui/repr/conflicting-repr-hints.rs similarity index 100% rename from tests/ui/conflicting-repr-hints.rs rename to tests/ui/repr/conflicting-repr-hints.rs diff --git a/tests/ui/conflicting-repr-hints.stderr b/tests/ui/repr/conflicting-repr-hints.stderr similarity index 100% rename from tests/ui/conflicting-repr-hints.stderr rename to tests/ui/repr/conflicting-repr-hints.stderr diff --git a/tests/ui/ret-bang.rs b/tests/ui/return/ret-bang.rs similarity index 100% rename from tests/ui/ret-bang.rs rename to tests/ui/return/ret-bang.rs diff --git a/tests/ui/ret-non-nil.rs b/tests/ui/return/ret-non-nil.rs similarity index 100% rename from tests/ui/ret-non-nil.rs rename to tests/ui/return/ret-non-nil.rs diff --git a/tests/ui/ret-non-nil.stderr b/tests/ui/return/ret-non-nil.stderr similarity index 100% rename from tests/ui/ret-non-nil.stderr rename to tests/ui/return/ret-non-nil.stderr diff --git a/tests/ui/return-disjoint-regions.rs b/tests/ui/return/return-disjoint-regions.rs similarity index 100% rename from tests/ui/return-disjoint-regions.rs rename to tests/ui/return/return-disjoint-regions.rs diff --git a/tests/ui/return-disjoint-regions.stderr b/tests/ui/return/return-disjoint-regions.stderr similarity index 100% rename from tests/ui/return-disjoint-regions.stderr rename to tests/ui/return/return-disjoint-regions.stderr diff --git a/tests/ui/return-nil.rs b/tests/ui/return/return-nil.rs similarity index 100% rename from tests/ui/return-nil.rs rename to tests/ui/return/return-nil.rs diff --git a/tests/ui/auxiliary/check_static_recursion_foreign_helper.rs b/tests/ui/statics/auxiliary/check_static_recursion_foreign_helper.rs similarity index 100% rename from tests/ui/auxiliary/check_static_recursion_foreign_helper.rs rename to tests/ui/statics/auxiliary/check_static_recursion_foreign_helper.rs diff --git a/tests/ui/check-static-immutable-mut-slices.rs b/tests/ui/statics/check-immutable-mut-slices.rs similarity index 100% rename from tests/ui/check-static-immutable-mut-slices.rs rename to tests/ui/statics/check-immutable-mut-slices.rs diff --git a/tests/ui/check-static-immutable-mut-slices.stderr b/tests/ui/statics/check-immutable-mut-slices.stderr similarity index 84% rename from tests/ui/check-static-immutable-mut-slices.stderr rename to tests/ui/statics/check-immutable-mut-slices.stderr index 402f9032b640d..5cb35a7c21eb6 100644 --- a/tests/ui/check-static-immutable-mut-slices.stderr +++ b/tests/ui/statics/check-immutable-mut-slices.stderr @@ -1,5 +1,5 @@ error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/check-static-immutable-mut-slices.rs:3:37 + --> $DIR/check-immutable-mut-slices.rs:3:37 | LL | static TEST: &'static mut [isize] = &mut []; | ^^^^^^^ diff --git a/tests/ui/check-static-recursion-foreign.rs b/tests/ui/statics/check-recursion-foreign.rs similarity index 100% rename from tests/ui/check-static-recursion-foreign.rs rename to tests/ui/statics/check-recursion-foreign.rs diff --git a/tests/ui/check-static-values-constraints.rs b/tests/ui/statics/check-values-constraints.rs similarity index 100% rename from tests/ui/check-static-values-constraints.rs rename to tests/ui/statics/check-values-constraints.rs diff --git a/tests/ui/check-static-values-constraints.stderr b/tests/ui/statics/check-values-constraints.stderr similarity index 88% rename from tests/ui/check-static-values-constraints.stderr rename to tests/ui/statics/check-values-constraints.stderr index fe5f2a34272dd..45a699f575fbd 100644 --- a/tests/ui/check-static-values-constraints.stderr +++ b/tests/ui/statics/check-values-constraints.stderr @@ -1,5 +1,5 @@ error[E0493]: destructor of `SafeStruct` cannot be evaluated at compile-time - --> $DIR/check-static-values-constraints.rs:64:7 + --> $DIR/check-values-constraints.rs:64:7 | LL | ..SafeStruct { | _______^ @@ -12,7 +12,7 @@ LL | }; | - value is dropped here error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:81:33 + --> $DIR/check-values-constraints.rs:81:33 | LL | static STATIC11: Vec = vec![MyOwned]; | ^^^^^^^^^^^^^ allocation not allowed in statics @@ -20,7 +20,7 @@ LL | static STATIC11: Vec = vec![MyOwned]; = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics - --> $DIR/check-static-values-constraints.rs:81:33 + --> $DIR/check-values-constraints.rs:81:33 | LL | static STATIC11: Vec = vec![MyOwned]; | ^^^^^^^^^^^^^ @@ -30,7 +30,7 @@ LL | static STATIC11: Vec = vec![MyOwned]; = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `::to_string` in statics - --> $DIR/check-static-values-constraints.rs:92:38 + --> $DIR/check-values-constraints.rs:92:38 | LL | field2: SafeEnum::Variant4("str".to_string()), | ^^^^^^^^^^^ @@ -43,7 +43,7 @@ LL + #![feature(const_trait_impl)] | error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:96:5 + --> $DIR/check-values-constraints.rs:96:5 | LL | vec![MyOwned], | ^^^^^^^^^^^^^ allocation not allowed in statics @@ -51,7 +51,7 @@ LL | vec![MyOwned], = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics - --> $DIR/check-static-values-constraints.rs:96:5 + --> $DIR/check-values-constraints.rs:96:5 | LL | vec![MyOwned], | ^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL | vec![MyOwned], = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:98:5 + --> $DIR/check-values-constraints.rs:98:5 | LL | vec![MyOwned], | ^^^^^^^^^^^^^ allocation not allowed in statics @@ -69,7 +69,7 @@ LL | vec![MyOwned], = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics - --> $DIR/check-static-values-constraints.rs:98:5 + --> $DIR/check-values-constraints.rs:98:5 | LL | vec![MyOwned], | ^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | vec![MyOwned], = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:103:6 + --> $DIR/check-values-constraints.rs:103:6 | LL | &vec![MyOwned], | ^^^^^^^^^^^^^ allocation not allowed in statics @@ -87,7 +87,7 @@ LL | &vec![MyOwned], = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics - --> $DIR/check-static-values-constraints.rs:103:6 + --> $DIR/check-values-constraints.rs:103:6 | LL | &vec![MyOwned], | ^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL | &vec![MyOwned], = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:105:6 + --> $DIR/check-values-constraints.rs:105:6 | LL | &vec![MyOwned], | ^^^^^^^^^^^^^ allocation not allowed in statics @@ -105,7 +105,7 @@ LL | &vec![MyOwned], = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics - --> $DIR/check-static-values-constraints.rs:105:6 + --> $DIR/check-values-constraints.rs:105:6 | LL | &vec![MyOwned], | ^^^^^^^^^^^^^ @@ -115,7 +115,7 @@ LL | &vec![MyOwned], = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:111:31 + --> $DIR/check-values-constraints.rs:111:31 | LL | static STATIC19: Vec = vec![3]; | ^^^^^^^ allocation not allowed in statics @@ -123,7 +123,7 @@ LL | static STATIC19: Vec = vec![3]; = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics - --> $DIR/check-static-values-constraints.rs:111:31 + --> $DIR/check-values-constraints.rs:111:31 | LL | static STATIC19: Vec = vec![3]; | ^^^^^^^ @@ -133,7 +133,7 @@ LL | static STATIC19: Vec = vec![3]; = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:117:32 + --> $DIR/check-values-constraints.rs:117:32 | LL | static x: Vec = vec![3]; | ^^^^^^^ allocation not allowed in statics @@ -141,7 +141,7 @@ LL | static x: Vec = vec![3]; = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0015]: cannot call non-const fn `slice::::into_vec::` in statics - --> $DIR/check-static-values-constraints.rs:117:32 + --> $DIR/check-values-constraints.rs:117:32 | LL | static x: Vec = vec![3]; | ^^^^^^^ @@ -151,7 +151,7 @@ LL | static x: Vec = vec![3]; = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0507]: cannot move out of static item `x` - --> $DIR/check-static-values-constraints.rs:119:9 + --> $DIR/check-values-constraints.rs:119:9 | LL | x | ^ move occurs because `x` has type `Vec`, which does not implement the `Copy` trait diff --git a/tests/ui/dont-suggest-private-trait-method.rs b/tests/ui/suggestions/dont-suggest-private-trait-method.rs similarity index 100% rename from tests/ui/dont-suggest-private-trait-method.rs rename to tests/ui/suggestions/dont-suggest-private-trait-method.rs diff --git a/tests/ui/dont-suggest-private-trait-method.stderr b/tests/ui/suggestions/dont-suggest-private-trait-method.stderr similarity index 100% rename from tests/ui/dont-suggest-private-trait-method.stderr rename to tests/ui/suggestions/dont-suggest-private-trait-method.stderr diff --git a/tests/ui/suggest-null-ptr.fixed b/tests/ui/suggestions/suggest-null-ptr.fixed similarity index 100% rename from tests/ui/suggest-null-ptr.fixed rename to tests/ui/suggestions/suggest-null-ptr.fixed diff --git a/tests/ui/suggest-null-ptr.rs b/tests/ui/suggestions/suggest-null-ptr.rs similarity index 100% rename from tests/ui/suggest-null-ptr.rs rename to tests/ui/suggestions/suggest-null-ptr.rs diff --git a/tests/ui/suggest-null-ptr.stderr b/tests/ui/suggestions/suggest-null-ptr.stderr similarity index 100% rename from tests/ui/suggest-null-ptr.stderr rename to tests/ui/suggestions/suggest-null-ptr.stderr diff --git a/tests/ui/trait-impl-bound-suggestions.fixed b/tests/ui/suggestions/trait-impl-bound-suggestions.fixed similarity index 100% rename from tests/ui/trait-impl-bound-suggestions.fixed rename to tests/ui/suggestions/trait-impl-bound-suggestions.fixed diff --git a/tests/ui/trait-impl-bound-suggestions.rs b/tests/ui/suggestions/trait-impl-bound-suggestions.rs similarity index 100% rename from tests/ui/trait-impl-bound-suggestions.rs rename to tests/ui/suggestions/trait-impl-bound-suggestions.rs diff --git a/tests/ui/trait-impl-bound-suggestions.stderr b/tests/ui/suggestions/trait-impl-bound-suggestions.stderr similarity index 100% rename from tests/ui/trait-impl-bound-suggestions.stderr rename to tests/ui/suggestions/trait-impl-bound-suggestions.stderr diff --git a/tests/ui/tool_lints-fail.rs b/tests/ui/tool-attributes/tool_lints-fail.rs similarity index 100% rename from tests/ui/tool_lints-fail.rs rename to tests/ui/tool-attributes/tool_lints-fail.rs diff --git a/tests/ui/tool_lints-fail.stderr b/tests/ui/tool-attributes/tool_lints-fail.stderr similarity index 100% rename from tests/ui/tool_lints-fail.stderr rename to tests/ui/tool-attributes/tool_lints-fail.stderr diff --git a/tests/ui/tool_lints-rpass.rs b/tests/ui/tool-attributes/tool_lints-rpass.rs similarity index 100% rename from tests/ui/tool_lints-rpass.rs rename to tests/ui/tool-attributes/tool_lints-rpass.rs diff --git a/tests/ui/tool_lints.rs b/tests/ui/tool-attributes/tool_lints.rs similarity index 100% rename from tests/ui/tool_lints.rs rename to tests/ui/tool-attributes/tool_lints.rs diff --git a/tests/ui/tool_lints.stderr b/tests/ui/tool-attributes/tool_lints.stderr similarity index 100% rename from tests/ui/tool_lints.stderr rename to tests/ui/tool-attributes/tool_lints.stderr diff --git a/tests/ui/tool_lints_2018_preview.rs b/tests/ui/tool-attributes/tool_lints_2018_preview.rs similarity index 100% rename from tests/ui/tool_lints_2018_preview.rs rename to tests/ui/tool-attributes/tool_lints_2018_preview.rs diff --git a/tests/ui/unknown-lint-tool-name.rs b/tests/ui/tool-attributes/unknown-lint-tool-name.rs similarity index 100% rename from tests/ui/unknown-lint-tool-name.rs rename to tests/ui/tool-attributes/unknown-lint-tool-name.rs diff --git a/tests/ui/unknown-lint-tool-name.stderr b/tests/ui/tool-attributes/unknown-lint-tool-name.stderr similarity index 100% rename from tests/ui/unknown-lint-tool-name.stderr rename to tests/ui/tool-attributes/unknown-lint-tool-name.stderr diff --git a/tests/ui/unknown-tool-name.rs b/tests/ui/tool-attributes/unknown-tool-name.rs similarity index 100% rename from tests/ui/unknown-tool-name.rs rename to tests/ui/tool-attributes/unknown-tool-name.rs diff --git a/tests/ui/unknown-tool-name.stderr b/tests/ui/tool-attributes/unknown-tool-name.stderr similarity index 100% rename from tests/ui/unknown-tool-name.stderr rename to tests/ui/tool-attributes/unknown-tool-name.stderr diff --git a/tests/ui/unop-move-semantics.rs b/tests/ui/unop/unop-move-semantics.rs similarity index 100% rename from tests/ui/unop-move-semantics.rs rename to tests/ui/unop/unop-move-semantics.rs diff --git a/tests/ui/unop-move-semantics.stderr b/tests/ui/unop/unop-move-semantics.stderr similarity index 100% rename from tests/ui/unop-move-semantics.stderr rename to tests/ui/unop/unop-move-semantics.stderr diff --git a/tests/ui/unop-neg-bool.rs b/tests/ui/unop/unop-neg-bool.rs similarity index 100% rename from tests/ui/unop-neg-bool.rs rename to tests/ui/unop/unop-neg-bool.rs diff --git a/tests/ui/unop-neg-bool.stderr b/tests/ui/unop/unop-neg-bool.stderr similarity index 100% rename from tests/ui/unop-neg-bool.stderr rename to tests/ui/unop/unop-neg-bool.stderr From f8c992f8b481acd31cdb4c8b892696c2dd81b26e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 21 May 2024 11:26:57 +0200 Subject: [PATCH 5/6] Migrate `run-make/rustdoc-scrape-examples-multiple` to `rmake.rs` --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../rustdoc-scrape-examples-multiple/Makefile | 5 ----- .../rustdoc-scrape-examples-multiple/rmake.rs | 6 ++++++ .../scrape.mk | 21 ------------------- 4 files changed, 6 insertions(+), 27 deletions(-) delete mode 100644 tests/run-make/rustdoc-scrape-examples-multiple/Makefile create mode 100644 tests/run-make/rustdoc-scrape-examples-multiple/rmake.rs delete mode 100644 tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 9b879f33778fd..001cfff143ecc 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -235,7 +235,6 @@ run-make/rmeta-preferred/Makefile run-make/rustc-macro-dep-files/Makefile run-make/rustdoc-io-error/Makefile run-make/rustdoc-scrape-examples-macros/Makefile -run-make/rustdoc-scrape-examples-multiple/Makefile run-make/rustdoc-verify-output-files/Makefile run-make/rustdoc-with-output-option/Makefile run-make/rustdoc-with-short-out-dir-option/Makefile diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/Makefile b/tests/run-make/rustdoc-scrape-examples-multiple/Makefile deleted file mode 100644 index 453a7d4bc8b81..0000000000000 --- a/tests/run-make/rustdoc-scrape-examples-multiple/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -deps := ex ex2 - -include ./scrape.mk - -all: scrape diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/rmake.rs b/tests/run-make/rustdoc-scrape-examples-multiple/rmake.rs new file mode 100644 index 0000000000000..e9c54fa392237 --- /dev/null +++ b/tests/run-make/rustdoc-scrape-examples-multiple/rmake.rs @@ -0,0 +1,6 @@ +#[path = "../rustdoc-scrape-examples-remap/scrape.rs"] +mod scrape; + +fn main() { + scrape::scrape(&[]); +} diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk b/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk deleted file mode 100644 index 57220bc6635c7..0000000000000 --- a/tests/run-make/rustdoc-scrape-examples-multiple/scrape.mk +++ /dev/null @@ -1,21 +0,0 @@ -include ../tools.mk - -OUTPUT_DIR := "$(TMPDIR)/rustdoc" - -$(TMPDIR)/%.calls: $(TMPDIR)/libfoobar.rmeta - $(RUSTDOC) examples/$*.rs --crate-name $* --crate-type bin --output $(OUTPUT_DIR) \ - --extern foobar=$(TMPDIR)/libfoobar.rmeta \ - -Z unstable-options \ - --scrape-examples-output-path $@ \ - --scrape-examples-target-crate foobar \ - $(extra_flags) - -$(TMPDIR)/lib%.rmeta: src/lib.rs - $(RUSTC) src/lib.rs --crate-name $* --crate-type lib --emit=metadata - -scrape: $(foreach d,$(deps),$(TMPDIR)/$(d).calls) - $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \ - -Z unstable-options \ - $(foreach d,$(deps),--with-examples $(TMPDIR)/$(d).calls) - - $(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs From 51cf3815cec9640787b91b407c7b39fff60ff32c Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Tue, 21 May 2024 11:24:19 -0400 Subject: [PATCH 6/6] Don't do cc detection for synthetic targets --- src/bootstrap/src/core/build_steps/synthetic_targets.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/synthetic_targets.rs b/src/bootstrap/src/core/build_steps/synthetic_targets.rs index 89d50b5ffffa4..281a9b093b90b 100644 --- a/src/bootstrap/src/core/build_steps/synthetic_targets.rs +++ b/src/bootstrap/src/core/build_steps/synthetic_targets.rs @@ -80,8 +80,5 @@ fn create_synthetic_target( customize(spec_map); std::fs::write(&path, serde_json::to_vec_pretty(&spec).unwrap()).unwrap(); - let target = TargetSelection::create_synthetic(&name, path.to_str().unwrap()); - crate::utils::cc_detect::find_target(builder, target); - - target + TargetSelection::create_synthetic(&name, path.to_str().unwrap()) }