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<P<_>> = 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/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<Span> = Default::default();
                     let (span, sugg) = if span.is_empty() {
+                        let mut binder_idents: FxIndexSet<Ident> = 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<T> + 'b` to `for<'a, 'b> T: Trait<T> + 'b`
+                        // T: for<'a> Trait<T> + 'b
+                        //    ^^^^^^^  remove existing inner binder `for<'a>`
+                        // for<'a, 'b> T: Trait<T> + '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::<Vec<_>>()
+                            } 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<ast::WhereBoundPredicate> {
-    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/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())
 }
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 3f4fceccab068..96fb8e27e6d21 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -234,7 +234,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/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/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
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::<static_priv_by_default::m>();
    |                                   ^ 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::<static_priv_by_default::n>();
    |                                   ^ 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::<static_priv_by_default::foo::d>();
    |                                   ^^^  - 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::<static_priv_by_default::foo::e>();
    |                                   ^^^  - 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/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<T>
+  where T: for<'a> Trait1<T> + 'b { } //~ ERROR use of undeclared lifetime name `'b`
+
+trait Trait2<T>
+where
+    T: B<'b> + for<'a> A<'a>, //~ ERROR use of undeclared lifetime name `'b`
+{
+}
+
+trait Trait3<T>
+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<T>
+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<T> + '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<T> + 'b { }
+LL +   where for<'b, 'a> T: Trait1<T> + '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`.
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/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
+
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/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<T: OtherTrait>(x: T) { unimplemented!() }
+//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface
+
+pub fn private_in_generic() -> std::num::Saturating<OtherType> { 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<T: OtherTrait>(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<OtherType> { 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
+}
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<MyOwned> = vec![MyOwned];
    |                                 ^^^^^^^^^^^^^ allocation not allowed in statics
@@ -20,7 +20,7 @@ LL | static STATIC11: Vec<MyOwned> = 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::<impl [MyOwned]>::into_vec::<std::alloc::Global>` in statics
-  --> $DIR/check-static-values-constraints.rs:81:33
+  --> $DIR/check-values-constraints.rs:81:33
    |
 LL | static STATIC11: Vec<MyOwned> = vec![MyOwned];
    |                                 ^^^^^^^^^^^^^
@@ -30,7 +30,7 @@ LL | static STATIC11: Vec<MyOwned> = 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 `<str as ToString>::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::<impl [MyOwned]>::into_vec::<std::alloc::Global>` 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::<impl [MyOwned]>::into_vec::<std::alloc::Global>` 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::<impl [MyOwned]>::into_vec::<std::alloc::Global>` 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::<impl [MyOwned]>::into_vec::<std::alloc::Global>` 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<isize> = vec![3];
    |                               ^^^^^^^ allocation not allowed in statics
@@ -123,7 +123,7 @@ LL | static STATIC19: Vec<isize> = 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::<impl [isize]>::into_vec::<std::alloc::Global>` in statics
-  --> $DIR/check-static-values-constraints.rs:111:31
+  --> $DIR/check-values-constraints.rs:111:31
    |
 LL | static STATIC19: Vec<isize> = vec![3];
    |                               ^^^^^^^
@@ -133,7 +133,7 @@ LL | static STATIC19: Vec<isize> = 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<isize> = vec![3];
    |                                ^^^^^^^ allocation not allowed in statics
@@ -141,7 +141,7 @@ LL |         static x: Vec<isize> = 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::<impl [isize]>::into_vec::<std::alloc::Global>` in statics
-  --> $DIR/check-static-values-constraints.rs:117:32
+  --> $DIR/check-values-constraints.rs:117:32
    |
 LL |         static x: Vec<isize> = vec![3];
    |                                ^^^^^^^
@@ -151,7 +151,7 @@ LL |         static x: Vec<isize> = 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<isize>`, 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