about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-04 06:23:38 +0000
committerbors <bors@rust-lang.org>2025-05-04 06:23:38 +0000
commit622ac043764d5d4ffff8de8cf86a1cc938a8a71b (patch)
tree3120789b5b2fda7c455b7f0805ea00e399618d25
parent1bea580f364c65bd5f7380a1056e150df7b8a1a6 (diff)
parent1239f499e871401742b717a8e26fb7e5712d957e (diff)
downloadrust-622ac043764d5d4ffff8de8cf86a1cc938a8a71b.tar.gz
rust-622ac043764d5d4ffff8de8cf86a1cc938a8a71b.zip
Auto merge of #140633 - Zalathar:rollup-iay94wa, r=Zalathar
Rollup of 7 pull requests

Successful merges:

 - #139675 (Add the AVX10 target features)
 - #140286 (Check if format argument is identifier to avoid error err-emit)
 - #140456 (Fix test simd/extract-insert-dyn on s390x)
 - #140551 (Move some tests out of tests/ui)
 - #140588 (Adjust some ui tests re. target-dependent errors)
 - #140617 (Report the `unsafe_attr_outside_unsafe` lint at the closest node)
 - #140626 (allow `#[rustfmt::skip]` in combination with `#[naked]`)

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--compiler/rustc_ast_passes/src/ast_validation.rs9
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs3
-rw-r--r--compiler/rustc_expand/src/config.rs7
-rw-r--r--compiler/rustc_expand/src/expand.rs6
-rw-r--r--compiler/rustc_feature/src/unstable.rs2
-rw-r--r--compiler/rustc_parse/src/validate_attr.rs16
-rw-r--r--compiler/rustc_parse_format/src/lib.rs29
-rw-r--r--compiler/rustc_passes/src/check_attr.rs4
-rw-r--r--compiler/rustc_span/src/symbol.rs1
-rw-r--r--compiler/rustc_target/src/target_features.rs20
-rw-r--r--src/tools/tidy/src/issues.txt10
-rw-r--r--tests/codegen/simd/extract-insert-dyn.rs16
-rw-r--r--tests/ui/asm/naked-functions.rs6
-rw-r--r--tests/ui/attributes/no_link/auxiliary/empty-crate-1.rs (renamed from tests/ui/auxiliary/issue-13560-1.rs)2
-rw-r--r--tests/ui/attributes/no_link/auxiliary/empty-crate-2.rs (renamed from tests/ui/auxiliary/issue-13560-2.rs)0
-rw-r--r--tests/ui/attributes/no_link/auxiliary/no_link-crate.rs6
-rw-r--r--tests/ui/attributes/no_link/multiple-crates-and-no_link.rs17
-rw-r--r--tests/ui/attributes/no_link/no-link-unknown-crate.rs19
-rw-r--r--tests/ui/attributes/no_link/no-link-unknown-crate.stderr (renamed from tests/ui/no-link-unknown-crate.stderr)2
-rw-r--r--tests/ui/auxiliary/inner_static.rs51
-rw-r--r--tests/ui/auxiliary/issue-13560-3.rs6
-rw-r--r--tests/ui/cfg/cfg_false_no_std-2.rs9
-rw-r--r--tests/ui/check-cfg/and-more-diagnostic.rs2
-rw-r--r--tests/ui/check-cfg/target_feature.stderr2
-rw-r--r--tests/ui/cross-crate/auxiliary/inline-cross-crate.rs (renamed from tests/ui/auxiliary/issue-18502.rs)0
-rw-r--r--tests/ui/cross-crate/auxiliary/llvm-miscompile-MarkValue-MaybeLive.rs (renamed from tests/ui/auxiliary/issue-76387.rs)0
-rw-r--r--tests/ui/cross-crate/inline-cross-crate.rs12
-rw-r--r--tests/ui/cross-crate/llvm-miscompile-MarkValue-MaybeLive.rs22
-rw-r--r--tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs8
-rw-r--r--tests/ui/feature-gates/feature-gate-avx10_target_feature.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-avx10_target_feature.stderr13
-rw-r--r--tests/ui/impl-privacy-xc-1.rs10
-rw-r--r--tests/ui/inner-static.rs14
-rw-r--r--tests/ui/issue-13560.rs13
-rw-r--r--tests/ui/issue-18502.rs8
-rw-r--r--tests/ui/issue-24106.rs8
-rw-r--r--tests/ui/issue-76387-llvm-miscompile.rs21
-rw-r--r--tests/ui/macros/auxiliary/fancy-panic.rs (renamed from tests/ui/auxiliary/fancy-panic.rs)0
-rw-r--r--tests/ui/macros/non-fmt-panic.fixed (renamed from tests/ui/non-fmt-panic.fixed)6
-rw-r--r--tests/ui/macros/non-fmt-panic.rs (renamed from tests/ui/non-fmt-panic.rs)6
-rw-r--r--tests/ui/macros/non-fmt-panic.stderr (renamed from tests/ui/non-fmt-panic.stderr)70
-rw-r--r--tests/ui/no-link-unknown-crate.rs4
-rw-r--r--tests/ui/panic-runtime/two-panic-runtimes.rs14
-rw-r--r--tests/ui/panic-runtime/want-abort-got-unwind.rs12
-rw-r--r--tests/ui/panic-runtime/want-abort-got-unwind2.rs16
-rw-r--r--tests/ui/parser/issues/invalid-parse-format-issue-139104.rs13
-rw-r--r--tests/ui/parser/issues/invalid-parse-format-issue-139104.stderr92
-rw-r--r--tests/ui/pattern/auxiliary/cross-crate-enum-pattern.rs (renamed from tests/ui/auxiliary/issue-24106.rs)0
-rw-r--r--tests/ui/pattern/cross-crate-enum-pattern.rs13
-rw-r--r--tests/ui/privacy/auxiliary/impl-privacy-cross-crate-1.rs (renamed from tests/ui/auxiliary/impl_privacy_xc_1.rs)0
-rw-r--r--tests/ui/privacy/auxiliary/impl-privacy-cross-crate-2.rs (renamed from tests/ui/privacy/auxiliary/impl_privacy_xc_2.rs)0
-rw-r--r--tests/ui/privacy/impl-privacy-cross-crate-1.rs10
-rw-r--r--tests/ui/privacy/impl-privacy-cross-crate-2.rs10
-rw-r--r--tests/ui/privacy/impl-privacy-xc-2.rs10
-rw-r--r--tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-allow.rs16
-rw-r--r--tests/ui/statics/auxiliary/inner_static.rs67
-rw-r--r--tests/ui/statics/inner-static.rs30
57 files changed, 543 insertions, 226 deletions
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs
index 1feb3e9bf9b..9b64bcc6df4 100644
--- a/compiler/rustc_ast_passes/src/ast_validation.rs
+++ b/compiler/rustc_ast_passes/src/ast_validation.rs
@@ -82,6 +82,8 @@ struct AstValidator<'a> {
     /// Used to ban explicit safety on foreign items when the extern block is not marked as unsafe.
     extern_mod_safety: Option<Safety>,
 
+    lint_node_id: NodeId,
+
     lint_buffer: &'a mut LintBuffer,
 }
 
@@ -826,7 +828,7 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara
 
 impl<'a> Visitor<'a> for AstValidator<'a> {
     fn visit_attribute(&mut self, attr: &Attribute) {
-        validate_attr::check_attr(&self.sess.psess, attr);
+        validate_attr::check_attr(&self.sess.psess, attr, self.lint_node_id);
     }
 
     fn visit_ty(&mut self, ty: &'a Ty) {
@@ -839,6 +841,8 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
             self.has_proc_macro_decls = true;
         }
 
+        let previous_lint_node_id = mem::replace(&mut self.lint_node_id, item.id);
+
         if let Some(ident) = item.kind.ident()
             && attr::contains_name(&item.attrs, sym::no_mangle)
         {
@@ -1128,6 +1132,8 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
             }
             _ => visit::walk_item(self, item),
         }
+
+        self.lint_node_id = previous_lint_node_id;
     }
 
     fn visit_foreign_item(&mut self, fi: &'a ForeignItem) {
@@ -1694,6 +1700,7 @@ pub fn check_crate(
         outer_impl_trait_span: None,
         disallow_tilde_const: Some(TildeConstReason::Item),
         extern_mod_safety: None,
+        lint_node_id: CRATE_NODE_ID,
         lint_buffer: lints,
     };
     visit::walk_crate(&mut validator, krate);
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 507cbf20d89..264510285a5 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -301,6 +301,9 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
             None
         }
         ("x86", "movrs") if get_version().0 < 20 => None,
+        ("x86", "avx10.1") => Some(LLVMFeature::new("avx10.1-512")),
+        ("x86", "avx10.2") if get_version().0 < 20 => None,
+        ("x86", "avx10.2") if get_version().0 >= 20 => Some(LLVMFeature::new("avx10.2-512")),
         (_, s) => Some(LLVMFeature::new(s)),
     }
 }
diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs
index 2df3281568b..02af26b0156 100644
--- a/compiler/rustc_expand/src/config.rs
+++ b/compiler/rustc_expand/src/config.rs
@@ -274,7 +274,12 @@ impl<'a> StripUnconfigured<'a> {
     /// is in the original source file. Gives a compiler error if the syntax of
     /// the attribute is incorrect.
     pub(crate) fn expand_cfg_attr(&self, cfg_attr: &Attribute, recursive: bool) -> Vec<Attribute> {
-        validate_attr::check_attribute_safety(&self.sess.psess, AttributeSafety::Normal, &cfg_attr);
+        validate_attr::check_attribute_safety(
+            &self.sess.psess,
+            AttributeSafety::Normal,
+            &cfg_attr,
+            ast::CRATE_NODE_ID,
+        );
 
         // A trace attribute left in AST in place of the original `cfg_attr` attribute.
         // It can later be used by lints or other diagnostics.
diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs
index 1f430b0018f..d4853d1357f 100644
--- a/compiler/rustc_expand/src/expand.rs
+++ b/compiler/rustc_expand/src/expand.rs
@@ -1983,7 +1983,11 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
         let mut span: Option<Span> = None;
         while let Some(attr) = attrs.next() {
             rustc_ast_passes::feature_gate::check_attribute(attr, self.cx.sess, features);
-            validate_attr::check_attr(&self.cx.sess.psess, attr);
+            validate_attr::check_attr(
+                &self.cx.sess.psess,
+                attr,
+                self.cx.current_expansion.lint_node_id,
+            );
 
             let current_span = if let Some(sp) = span { sp.to(attr.span) } else { attr.span };
             span = Some(current_span);
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index 75e09cacb1f..1a011dfff3f 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -393,6 +393,8 @@ declare_features! (
     (unstable, async_for_loop, "1.77.0", Some(118898)),
     /// Allows `async` trait bound modifier.
     (unstable, async_trait_bounds, "1.85.0", Some(62290)),
+    /// Allows using Intel AVX10 target features and intrinsics
+    (unstable, avx10_target_feature, "CURRENT_RUSTC_VERSION", Some(138843)),
     /// Allows using C-variadics.
     (unstable, c_variadic, "1.34.0", Some(44930)),
     /// Allows the use of `#[cfg(contract_checks)` to check if contract checks are enabled.
diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs
index 6a1c2af48ed..aa29b24fe91 100644
--- a/compiler/rustc_parse/src/validate_attr.rs
+++ b/compiler/rustc_parse/src/validate_attr.rs
@@ -3,7 +3,8 @@
 use rustc_ast::token::Delimiter;
 use rustc_ast::tokenstream::DelimSpan;
 use rustc_ast::{
-    self as ast, AttrArgs, Attribute, DelimArgs, MetaItem, MetaItemInner, MetaItemKind, Safety,
+    self as ast, AttrArgs, Attribute, DelimArgs, MetaItem, MetaItemInner, MetaItemKind, NodeId,
+    Safety,
 };
 use rustc_errors::{Applicability, FatalError, PResult};
 use rustc_feature::{AttributeSafety, AttributeTemplate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute};
@@ -15,7 +16,7 @@ use rustc_span::{Span, Symbol, sym};
 
 use crate::{errors, parse_in};
 
-pub fn check_attr(psess: &ParseSess, attr: &Attribute) {
+pub fn check_attr(psess: &ParseSess, attr: &Attribute, id: NodeId) {
     if attr.is_doc_comment() || attr.has_name(sym::cfg_trace) || attr.has_name(sym::cfg_attr_trace)
     {
         return;
@@ -26,7 +27,7 @@ pub fn check_attr(psess: &ParseSess, attr: &Attribute) {
 
     // All non-builtin attributes are considered safe
     let safety = attr_info.map(|x| x.safety).unwrap_or(AttributeSafety::Normal);
-    check_attribute_safety(psess, safety, attr);
+    check_attribute_safety(psess, safety, attr, id);
 
     // Check input tokens for built-in and key-value attributes.
     match attr_info {
@@ -154,7 +155,12 @@ fn is_attr_template_compatible(template: &AttributeTemplate, meta: &ast::MetaIte
     }
 }
 
-pub fn check_attribute_safety(psess: &ParseSess, safety: AttributeSafety, attr: &Attribute) {
+pub fn check_attribute_safety(
+    psess: &ParseSess,
+    safety: AttributeSafety,
+    attr: &Attribute,
+    id: NodeId,
+) {
     let attr_item = attr.get_normal_item();
 
     if let AttributeSafety::Unsafe { unsafe_since } = safety {
@@ -185,7 +191,7 @@ pub fn check_attribute_safety(psess: &ParseSess, safety: AttributeSafety, attr:
                 psess.buffer_lint(
                     UNSAFE_ATTR_OUTSIDE_UNSAFE,
                     path_span,
-                    ast::CRATE_NODE_ID,
+                    id,
                     BuiltinLintDiag::UnsafeAttrOutsideUnsafe {
                         attribute_name_span: path_span,
                         sugg_spans: (diag_span.shrink_to_lo(), diag_span.shrink_to_hi()),
diff --git a/compiler/rustc_parse_format/src/lib.rs b/compiler/rustc_parse_format/src/lib.rs
index c59e6cb5c33..999e7159274 100644
--- a/compiler/rustc_parse_format/src/lib.rs
+++ b/compiler/rustc_parse_format/src/lib.rs
@@ -100,6 +100,30 @@ pub struct Argument<'a> {
     pub format: FormatSpec<'a>,
 }
 
+impl<'a> Argument<'a> {
+    pub fn is_identifier(&self) -> bool {
+        matches!(self.position, Position::ArgumentNamed(_))
+            && matches!(
+                self.format,
+                FormatSpec {
+                    fill: None,
+                    fill_span: None,
+                    align: AlignUnknown,
+                    sign: None,
+                    alternate: false,
+                    zero_pad: false,
+                    debug_hex: None,
+                    precision: CountImplied,
+                    precision_span: None,
+                    width: CountImplied,
+                    width_span: None,
+                    ty: "",
+                    ty_span: None,
+                },
+            )
+    }
+}
+
 /// Specification for the formatting of an argument in the format string.
 #[derive(Copy, Clone, Debug, PartialEq)]
 pub struct FormatSpec<'a> {
@@ -894,6 +918,11 @@ impl<'a> Parser<'a> {
     }
 
     fn suggest_positional_arg_instead_of_captured_arg(&mut self, arg: Argument<'a>) {
+        // If the argument is not an identifier, it is not a field access.
+        if !arg.is_identifier() {
+            return;
+        }
+
         if let Some(end) = self.consume_pos('.') {
             let byte_pos = self.to_span_index(end);
             let start = InnerOffset(byte_pos.0 + 1);
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index f04b167889f..e5b20901c0c 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -683,7 +683,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
                         }
                     }
 
-                    if !other_attr.has_any_name(ALLOW_LIST) {
+                    if !other_attr.has_any_name(ALLOW_LIST)
+                        && !matches!(other_attr.path().as_slice(), [sym::rustfmt, ..])
+                    {
                         let path = other_attr.path();
                         let path: Vec<_> = path.iter().map(|s| s.as_str()).collect();
                         let other_attr_name = path.join("::");
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index 7a1fb36324b..3912c7dc7d6 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -531,6 +531,7 @@ symbols! {
         autodiff,
         automatically_derived,
         avx,
+        avx10_target_feature,
         avx512_target_feature,
         avx512bw,
         avx512f,
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index f856d3efc1c..d04c8f3f2eb 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -394,6 +394,26 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
     ("amx-tile", Unstable(sym::x86_amx_intrinsics), &[]),
     ("amx-transpose", Unstable(sym::x86_amx_intrinsics), &["amx-tile"]),
     ("avx", Stable, &["sse4.2"]),
+    (
+        "avx10.1",
+        Unstable(sym::avx10_target_feature),
+        &[
+            "avx512bf16",
+            "avx512bitalg",
+            "avx512bw",
+            "avx512cd",
+            "avx512dq",
+            "avx512f",
+            "avx512fp16",
+            "avx512ifma",
+            "avx512vbmi",
+            "avx512vbmi2",
+            "avx512vl",
+            "avx512vnni",
+            "avx512vpopcntdq",
+        ],
+    ),
+    ("avx10.2", Unstable(sym::avx10_target_feature), &["avx10.1"]),
     ("avx2", Stable, &["avx"]),
     ("avx512bf16", Unstable(sym::avx512_target_feature), &["avx512bw"]),
     ("avx512bitalg", Unstable(sym::avx512_target_feature), &["avx512bw"]),
diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt
index e6b5aa59622..2f0158609e0 100644
--- a/src/tools/tidy/src/issues.txt
+++ b/src/tools/tidy/src/issues.txt
@@ -276,13 +276,7 @@ ui/auto-traits/issue-23080-2.rs
 ui/auto-traits/issue-23080.rs
 ui/auto-traits/issue-83857-ub.rs
 ui/auto-traits/issue-84075.rs
-ui/auxiliary/issue-13560-1.rs
-ui/auxiliary/issue-13560-2.rs
-ui/auxiliary/issue-13560-3.rs
 ui/auxiliary/issue-16822.rs
-ui/auxiliary/issue-18502.rs
-ui/auxiliary/issue-24106.rs
-ui/auxiliary/issue-76387.rs
 ui/bench/issue-32062.rs
 ui/binding/issue-40402-1.rs
 ui/binding/issue-40402-2.rs
@@ -1378,12 +1372,8 @@ ui/intrinsics/issue-28575.rs
 ui/intrinsics/issue-84297-reifying-copy.rs
 ui/invalid/issue-114435-layout-type-err.rs
 ui/issue-11881.rs
-ui/issue-13560.rs
 ui/issue-15924.rs
 ui/issue-16822.rs
-ui/issue-18502.rs
-ui/issue-24106.rs
-ui/issue-76387-llvm-miscompile.rs
 ui/issues-71798.rs
 ui/issues/auxiliary/issue-11224.rs
 ui/issues/auxiliary/issue-11508.rs
diff --git a/tests/codegen/simd/extract-insert-dyn.rs b/tests/codegen/simd/extract-insert-dyn.rs
index 7d032c6bb3e..729f0145314 100644
--- a/tests/codegen/simd/extract-insert-dyn.rs
+++ b/tests/codegen/simd/extract-insert-dyn.rs
@@ -1,6 +1,12 @@
 //@compile-flags: -C opt-level=3 -C no-prepopulate-passes
 
-#![feature(core_intrinsics, repr_simd, arm_target_feature, mips_target_feature)]
+#![feature(
+    core_intrinsics,
+    repr_simd,
+    arm_target_feature,
+    mips_target_feature,
+    s390x_target_feature
+)]
 #![no_std]
 #![crate_type = "lib"]
 #![allow(non_camel_case_types)]
@@ -25,6 +31,7 @@ pub struct i8x16([i8; 16]);
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
 #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))]
 #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))]
+#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))]
 unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 {
     simd_extract_dyn(x, idx)
 }
@@ -36,6 +43,7 @@ unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 {
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
 #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))]
 #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))]
+#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))]
 unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 {
     simd_extract_dyn(x, 7)
 }
@@ -47,6 +55,7 @@ unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 {
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
 #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))]
 #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))]
+#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))]
 unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 {
     simd_extract_dyn(x, const { 3 + 4 })
 }
@@ -58,6 +67,7 @@ unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 {
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
 #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))]
 #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))]
+#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))]
 unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 {
     simd_extract(x, const { 3 + 4 })
 }
@@ -69,6 +79,7 @@ unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 {
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
 #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))]
 #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))]
+#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))]
 unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 {
     simd_insert_dyn(x, idx, e)
 }
@@ -80,6 +91,7 @@ unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 {
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
 #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))]
 #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))]
+#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))]
 unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 {
     simd_insert_dyn(x, 7, e)
 }
@@ -91,6 +103,7 @@ unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 {
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
 #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))]
 #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))]
+#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))]
 unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 {
     simd_insert_dyn(x, const { 3 + 4 }, e)
 }
@@ -102,6 +115,7 @@ unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 {
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
 #[cfg_attr(target_arch = "x86", target_feature(enable = "sse"))]
 #[cfg_attr(target_arch = "mips", target_feature(enable = "msa"))]
+#[cfg_attr(target_arch = "s390x", target_feature(enable = "vector"))]
 unsafe extern "C" fn const_simd_insert(x: i8x16, e: i8) -> i8x16 {
     simd_insert(x, const { 3 + 4 }, e)
 }
diff --git a/tests/ui/asm/naked-functions.rs b/tests/ui/asm/naked-functions.rs
index cb5fde9a80b..a6f41698b41 100644
--- a/tests/ui/asm/naked-functions.rs
+++ b/tests/ui/asm/naked-functions.rs
@@ -231,3 +231,9 @@ pub extern "C" fn compatible_linkage() {
 pub extern "C" fn rustc_std_internal_symbol() {
     naked_asm!("", options(raw));
 }
+
+#[rustfmt::skip]
+#[unsafe(naked)]
+pub extern "C" fn rustfmt_skip() {
+    naked_asm!("", options(raw));
+}
diff --git a/tests/ui/auxiliary/issue-13560-1.rs b/tests/ui/attributes/no_link/auxiliary/empty-crate-1.rs
index baca1567e1b..8bd2b3353b8 100644
--- a/tests/ui/auxiliary/issue-13560-1.rs
+++ b/tests/ui/attributes/no_link/auxiliary/empty-crate-1.rs
@@ -1,3 +1 @@
-//@ no-prefer-dynamic
-
 #![crate_type = "dylib"]
diff --git a/tests/ui/auxiliary/issue-13560-2.rs b/tests/ui/attributes/no_link/auxiliary/empty-crate-2.rs
index 1adaf2b0379..1adaf2b0379 100644
--- a/tests/ui/auxiliary/issue-13560-2.rs
+++ b/tests/ui/attributes/no_link/auxiliary/empty-crate-2.rs
diff --git a/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs b/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs
new file mode 100644
index 00000000000..1c3af5431cc
--- /dev/null
+++ b/tests/ui/attributes/no_link/auxiliary/no_link-crate.rs
@@ -0,0 +1,6 @@
+//@ no-prefer-dynamic
+
+#![crate_type = "rlib"]
+
+#[macro_use] #[no_link] extern crate empty_crate_1 as t1;
+#[macro_use] extern crate empty_crate_2 as t2;
diff --git a/tests/ui/attributes/no_link/multiple-crates-and-no_link.rs b/tests/ui/attributes/no_link/multiple-crates-and-no_link.rs
new file mode 100644
index 00000000000..0e6f1deb217
--- /dev/null
+++ b/tests/ui/attributes/no_link/multiple-crates-and-no_link.rs
@@ -0,0 +1,17 @@
+//! Regression test for #13560. Previously, it was possible to
+//! trigger an assert in crate numbering if a series of crates
+//! being loaded included a "syntax-only" extern crate.
+//! But it appears we don't mess with crate numbering for
+//! `#[no_link]` crates anymore, so this test doesn't seem
+//! to test anything now.
+
+//@ run-pass
+//@ needs-crate-type: dylib
+//@ aux-build:empty-crate-1.rs
+//@ aux-build:empty-crate-2.rs
+//@ aux-build:no_link-crate.rs
+
+extern crate empty_crate_2 as t2;
+extern crate no_link_crate as t3;
+
+fn main() {}
diff --git a/tests/ui/attributes/no_link/no-link-unknown-crate.rs b/tests/ui/attributes/no_link/no-link-unknown-crate.rs
new file mode 100644
index 00000000000..3a91fa27ee3
--- /dev/null
+++ b/tests/ui/attributes/no_link/no-link-unknown-crate.rs
@@ -0,0 +1,19 @@
+//! Unfortunately the development of `#[phase]` and `#[no_link]`
+//! predates Zulip, and thus has been lost in the sands of time.
+//! Understanding the true nature of this test has been left as
+//! an exercise for the reader.
+//!
+//! But we guess from the git history that originally this
+//! test was supposed to check that we error if we can't find
+//! an extern crate annotated with `#[phase(syntax)]`,
+//! see `macro-crate-unknown-crate.rs` in
+//! <https://github.com/rust-lang/rust/pull/11151>. Later, we changed
+//! `#[phase]` to `#![feature(plugin)]` and added a `#[no_link]`.
+//!
+//! I suppose that this now tests that we still error if we can't
+//! find a `#[no_link]` extern crate?
+
+#[no_link]
+extern crate doesnt_exist; //~ ERROR can't find crate
+
+fn main() {}
diff --git a/tests/ui/no-link-unknown-crate.stderr b/tests/ui/attributes/no_link/no-link-unknown-crate.stderr
index edc248db09e..999b013866c 100644
--- a/tests/ui/no-link-unknown-crate.stderr
+++ b/tests/ui/attributes/no_link/no-link-unknown-crate.stderr
@@ -1,5 +1,5 @@
 error[E0463]: can't find crate for `doesnt_exist`
-  --> $DIR/no-link-unknown-crate.rs:2:1
+  --> $DIR/no-link-unknown-crate.rs:17:1
    |
 LL | extern crate doesnt_exist;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
diff --git a/tests/ui/auxiliary/inner_static.rs b/tests/ui/auxiliary/inner_static.rs
deleted file mode 100644
index 42dcd379d41..00000000000
--- a/tests/ui/auxiliary/inner_static.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-pub struct A<T> { pub v: T }
-pub struct B<T> { pub v: T }
-
-pub mod test {
-    pub struct A<T> { pub v: T }
-
-    impl<T> A<T> {
-        pub fn foo(&self) -> isize {
-            static a: isize = 5;
-            return a
-        }
-
-        pub fn bar(&self) -> isize {
-            static a: isize = 6;
-            return a;
-        }
-    }
-}
-
-impl<T> A<T> {
-    pub fn foo(&self) -> isize {
-        static a: isize = 1;
-        return a
-    }
-
-    pub fn bar(&self) -> isize {
-        static a: isize = 2;
-        return a;
-    }
-}
-
-impl<T> B<T> {
-    pub fn foo(&self) -> isize {
-        static a: isize = 3;
-        return a
-    }
-
-    pub fn bar(&self) -> isize {
-        static a: isize = 4;
-        return a;
-    }
-}
-
-pub fn foo() -> isize {
-    let a = A { v: () };
-    let b = B { v: () };
-    let c = test::A { v: () };
-    return a.foo() + a.bar() +
-           b.foo() + b.bar() +
-           c.foo() + c.bar();
-}
diff --git a/tests/ui/auxiliary/issue-13560-3.rs b/tests/ui/auxiliary/issue-13560-3.rs
deleted file mode 100644
index 4aab2ddc73a..00000000000
--- a/tests/ui/auxiliary/issue-13560-3.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ no-prefer-dynamic
-
-#![crate_type = "rlib"]
-
-#[macro_use] #[no_link] extern crate issue_13560_1 as t1;
-#[macro_use] extern crate issue_13560_2 as t2;
diff --git a/tests/ui/cfg/cfg_false_no_std-2.rs b/tests/ui/cfg/cfg_false_no_std-2.rs
index 18b2c699fd7..666c90deaf0 100644
--- a/tests/ui/cfg/cfg_false_no_std-2.rs
+++ b/tests/ui/cfg/cfg_false_no_std-2.rs
@@ -1,7 +1,11 @@
 // Error, the linked empty library is `no_std` and doesn't provide a panic handler.
 
-//@ dont-require-annotations: ERROR
 //@ dont-check-compiler-stderr
+
+// NOTE: fix a panic strategy to prevent differing errors subject to target's default panic strategy
+// which changes between targets. The specific panic strategy doesn't matter for test intention.
+//@ compile-flags: -Cpanic=abort
+
 //@ aux-build: cfg_false_lib_no_std_before.rs
 
 #![no_std]
@@ -11,6 +15,3 @@ extern crate cfg_false_lib_no_std_before as _;
 fn main() {}
 
 //~? ERROR `#[panic_handler]` function required, but not found
-// FIXME: This error is target-dependent, could be served by some "optional error" annotation
-// instead of `dont-require-annotations`.
-//FIXME~? ERROR unwinding panics are not supported without std
diff --git a/tests/ui/check-cfg/and-more-diagnostic.rs b/tests/ui/check-cfg/and-more-diagnostic.rs
index 977f55e8a6d..5422829c5b3 100644
--- a/tests/ui/check-cfg/and-more-diagnostic.rs
+++ b/tests/ui/check-cfg/and-more-diagnostic.rs
@@ -5,7 +5,7 @@
 //@ no-auto-check-cfg
 //@ compile-flags: --check-cfg=cfg()
 //@ normalize-stderr: "and \d+ more" -> "and X more"
-//@ normalize-stderr: "`[a-zA-Z0-9_-]+`" -> "`xxx`"
+//@ normalize-stderr: "`[a-zA-Z0-9_\.-]+`" -> "`xxx`"
 
 fn main() {
     cfg!(target_feature = "zebra");
diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr
index 712ce941c54..3d7323298ba 100644
--- a/tests/ui/check-cfg/target_feature.stderr
+++ b/tests/ui/check-cfg/target_feature.stderr
@@ -29,6 +29,8 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `amx-transpose`
 `atomics`
 `avx`
+`avx10.1`
+`avx10.2`
 `avx2`
 `avx512bf16`
 `avx512bitalg`
diff --git a/tests/ui/auxiliary/issue-18502.rs b/tests/ui/cross-crate/auxiliary/inline-cross-crate.rs
index 4d4230607aa..4d4230607aa 100644
--- a/tests/ui/auxiliary/issue-18502.rs
+++ b/tests/ui/cross-crate/auxiliary/inline-cross-crate.rs
diff --git a/tests/ui/auxiliary/issue-76387.rs b/tests/ui/cross-crate/auxiliary/llvm-miscompile-MarkValue-MaybeLive.rs
index d540bceff93..d540bceff93 100644
--- a/tests/ui/auxiliary/issue-76387.rs
+++ b/tests/ui/cross-crate/auxiliary/llvm-miscompile-MarkValue-MaybeLive.rs
diff --git a/tests/ui/cross-crate/inline-cross-crate.rs b/tests/ui/cross-crate/inline-cross-crate.rs
new file mode 100644
index 00000000000..273aa8f8f0d
--- /dev/null
+++ b/tests/ui/cross-crate/inline-cross-crate.rs
@@ -0,0 +1,12 @@
+//! Dpn't ice on using an inlined function from another crate
+//! See <https://github.com/rust-lang/rust/issues/18502> and
+//! <https://github.com/rust-lang/rust/issues/18501>
+
+//@ run-pass
+//@ aux-build:inline-cross-crate.rs
+
+extern crate inline_cross_crate as fmt;
+
+fn main() {
+    ::fmt::baz();
+}
diff --git a/tests/ui/cross-crate/llvm-miscompile-MarkValue-MaybeLive.rs b/tests/ui/cross-crate/llvm-miscompile-MarkValue-MaybeLive.rs
new file mode 100644
index 00000000000..95d022ddd96
--- /dev/null
+++ b/tests/ui/cross-crate/llvm-miscompile-MarkValue-MaybeLive.rs
@@ -0,0 +1,22 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/76387>
+//! Tests that LLVM doesn't miscompile this
+//! See upstream fix: <https://reviews.llvm.org/D88529>.
+
+//@ compile-flags: -C opt-level=3
+//@ aux-build: llvm-miscompile-MarkValue-MaybeLive.rs
+//@ run-pass
+
+extern crate llvm_miscompile_MarkValue_MaybeLive;
+
+use llvm_miscompile_MarkValue_MaybeLive::FatPtr;
+
+fn print(data: &[u8]) {
+    println!("{:#?}", data);
+}
+
+fn main() {
+    let ptr = FatPtr::new(20);
+    let data = unsafe { std::slice::from_raw_parts(ptr.as_ptr(), ptr.len()) };
+
+    print(data);
+}
diff --git a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs
index b79b5ff6fdb..08f8ae391fd 100644
--- a/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs
+++ b/tests/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs
@@ -1,4 +1,6 @@
-//FIXME~ ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
+// ignore-tidy-linelength
+// FIXME(#140620)~ ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
+
 // Make sure the compiler does not ICE when trying to generate the debuginfo name of a type that
 // causes a layout error.
 // This version of the test already ICE'd before the commit that introduce the ICE described in
@@ -18,5 +20,5 @@ pub fn foo() -> usize {
     std::mem::size_of::<Foo<u8>>()
 }
 
-// FIXME: the error is reported on different lines on different targets
-//FIXME~? ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
+// FIXME(#140620): the error is reported on different lines on different targets
+//FIXME(#140620)~? ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
diff --git a/tests/ui/feature-gates/feature-gate-avx10_target_feature.rs b/tests/ui/feature-gates/feature-gate-avx10_target_feature.rs
new file mode 100644
index 00000000000..8557e67d1f4
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-avx10_target_feature.rs
@@ -0,0 +1,6 @@
+//@ only-x86_64
+#[target_feature(enable = "avx10.1")]
+//~^ ERROR: currently unstable
+unsafe fn foo() {}
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-avx10_target_feature.stderr b/tests/ui/feature-gates/feature-gate-avx10_target_feature.stderr
new file mode 100644
index 00000000000..e45ea3524ca
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-avx10_target_feature.stderr
@@ -0,0 +1,13 @@
+error[E0658]: the target feature `avx10.1` is currently unstable
+  --> $DIR/feature-gate-avx10_target_feature.rs:2:18
+   |
+LL | #[target_feature(enable = "avx10.1")]
+   |                  ^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #138843 <https://github.com/rust-lang/rust/issues/138843> for more information
+   = help: add `#![feature(avx10_target_feature)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/impl-privacy-xc-1.rs b/tests/ui/impl-privacy-xc-1.rs
deleted file mode 100644
index 6a10986739c..00000000000
--- a/tests/ui/impl-privacy-xc-1.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-//@ aux-build:impl_privacy_xc_1.rs
-
-
-extern crate impl_privacy_xc_1;
-
-pub fn main() {
-    let fish = impl_privacy_xc_1::Fish { x: 1 };
-    fish.swim();
-}
diff --git a/tests/ui/inner-static.rs b/tests/ui/inner-static.rs
deleted file mode 100644
index 9455ec5712f..00000000000
--- a/tests/ui/inner-static.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//@ run-pass
-//@ aux-build:inner_static.rs
-
-
-extern crate inner_static;
-
-pub fn main() {
-    let a = inner_static::A::<()> { v: () };
-    let b = inner_static::B::<()> { v: () };
-    let c = inner_static::test::A::<()> { v: () };
-    assert_eq!(a.bar(), 2);
-    assert_eq!(b.bar(), 4);
-    assert_eq!(c.bar(), 6);
-}
diff --git a/tests/ui/issue-13560.rs b/tests/ui/issue-13560.rs
deleted file mode 100644
index 6174fa9324b..00000000000
--- a/tests/ui/issue-13560.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ run-pass
-//@ ignore-cross-compile (needs dylibs and compiletest doesn't have a more specific header)
-//@ aux-build:issue-13560-1.rs
-//@ aux-build:issue-13560-2.rs
-//@ aux-build:issue-13560-3.rs
-
-// Regression test for issue #13560, the test itself is all in the dependent
-// libraries. The fail which previously failed to compile is the one numbered 3.
-
-extern crate issue_13560_2 as t2;
-extern crate issue_13560_3 as t3;
-
-fn main() {}
diff --git a/tests/ui/issue-18502.rs b/tests/ui/issue-18502.rs
deleted file mode 100644
index 3e2c37ee8aa..00000000000
--- a/tests/ui/issue-18502.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-18502.rs
-
-extern crate issue_18502 as fmt;
-
-fn main() {
-    ::fmt::baz();
-}
diff --git a/tests/ui/issue-24106.rs b/tests/ui/issue-24106.rs
deleted file mode 100644
index 4f7b299b12f..00000000000
--- a/tests/ui/issue-24106.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-24106.rs
-
-extern crate issue_24106;
-
-fn main() {
-    issue_24106::go::<()>();
-}
diff --git a/tests/ui/issue-76387-llvm-miscompile.rs b/tests/ui/issue-76387-llvm-miscompile.rs
deleted file mode 100644
index d674ebb5eaf..00000000000
--- a/tests/ui/issue-76387-llvm-miscompile.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-//@ compile-flags: -C opt-level=3
-//@ aux-build: issue-76387.rs
-//@ run-pass
-
-// Regression test for issue #76387
-// Tests that LLVM doesn't miscompile this
-
-extern crate issue_76387;
-
-use issue_76387::FatPtr;
-
-fn print(data: &[u8]) {
-    println!("{:#?}", data);
-}
-
-fn main() {
-    let ptr = FatPtr::new(20);
-    let data = unsafe { std::slice::from_raw_parts(ptr.as_ptr(), ptr.len()) };
-
-    print(data);
-}
diff --git a/tests/ui/auxiliary/fancy-panic.rs b/tests/ui/macros/auxiliary/fancy-panic.rs
index 35be93b0590..35be93b0590 100644
--- a/tests/ui/auxiliary/fancy-panic.rs
+++ b/tests/ui/macros/auxiliary/fancy-panic.rs
diff --git a/tests/ui/non-fmt-panic.fixed b/tests/ui/macros/non-fmt-panic.fixed
index fa9a1ad89bd..b102dba1731 100644
--- a/tests/ui/non-fmt-panic.fixed
+++ b/tests/ui/macros/non-fmt-panic.fixed
@@ -1,3 +1,9 @@
+//! The non_fmt_panics lint detects panic!(..) invocations where
+//! the first argument is not a formatting string.
+//!
+//! Also, this test checks that this is not emitted if it originates
+//! in an external macro.
+
 //@ run-rustfix
 //@ rustfix-only-machine-applicable
 //@ build-pass (FIXME(62277): should be check-pass)
diff --git a/tests/ui/non-fmt-panic.rs b/tests/ui/macros/non-fmt-panic.rs
index 451a0c76018..9277529c6d4 100644
--- a/tests/ui/non-fmt-panic.rs
+++ b/tests/ui/macros/non-fmt-panic.rs
@@ -1,3 +1,9 @@
+//! The non_fmt_panics lint detects panic!(..) invocations where
+//! the first argument is not a formatting string.
+//!
+//! Also, this test checks that this is not emitted if it originates
+//! in an external macro.
+
 //@ run-rustfix
 //@ rustfix-only-machine-applicable
 //@ build-pass (FIXME(62277): should be check-pass)
diff --git a/tests/ui/non-fmt-panic.stderr b/tests/ui/macros/non-fmt-panic.stderr
index 0134a8ddf29..30b63cb46e2 100644
--- a/tests/ui/non-fmt-panic.stderr
+++ b/tests/ui/macros/non-fmt-panic.stderr
@@ -1,5 +1,5 @@
 warning: panic message contains a brace
-  --> $DIR/non-fmt-panic.rs:13:29
+  --> $DIR/non-fmt-panic.rs:19:29
    |
 LL |     panic!("here's a brace: {");
    |                             ^
@@ -12,7 +12,7 @@ LL |     panic!("{}", "here's a brace: {");
    |            +++++
 
 warning: panic message contains a brace
-  --> $DIR/non-fmt-panic.rs:14:35
+  --> $DIR/non-fmt-panic.rs:20:35
    |
 LL |     unreachable!("here's a brace: {");
    |                                   ^
@@ -24,7 +24,7 @@ LL |     unreachable!("{}", "here's a brace: {");
    |                  +++++
 
 warning: panic message contains a brace
-  --> $DIR/non-fmt-panic.rs:15:31
+  --> $DIR/non-fmt-panic.rs:21:31
    |
 LL |     std::panic!("another one: }");
    |                               ^
@@ -36,7 +36,7 @@ LL |     std::panic!("{}", "another one: }");
    |                 +++++
 
 warning: panic message contains an unused formatting placeholder
-  --> $DIR/non-fmt-panic.rs:16:25
+  --> $DIR/non-fmt-panic.rs:22:25
    |
 LL |     core::panic!("Hello {}");
    |                         ^^
@@ -52,7 +52,7 @@ LL |     core::panic!("{}", "Hello {}");
    |                  +++++
 
 warning: panic message contains unused formatting placeholders
-  --> $DIR/non-fmt-panic.rs:17:21
+  --> $DIR/non-fmt-panic.rs:23:21
    |
 LL |     assert!(false, "{:03x} {test} bla");
    |                     ^^^^^^ ^^^^^^
@@ -68,7 +68,7 @@ LL |     assert!(false, "{}", "{:03x} {test} bla");
    |                    +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:19:20
+  --> $DIR/non-fmt-panic.rs:25:20
    |
 LL |     assert!(false, S);
    |                    ^
@@ -81,7 +81,7 @@ LL |     assert!(false, "{}", S);
    |                    +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:21:20
+  --> $DIR/non-fmt-panic.rs:27:20
    |
 LL |     assert!(false, 123);
    |                    ^^^
@@ -94,7 +94,7 @@ LL |     assert!(false, "{}", 123);
    |                    +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:23:20
+  --> $DIR/non-fmt-panic.rs:29:20
    |
 LL |     assert!(false, Some(123));
    |                    ^^^^^^^^^
@@ -107,7 +107,7 @@ LL |     assert!(false, "{:?}", Some(123));
    |                    +++++++
 
 warning: panic message contains braces
-  --> $DIR/non-fmt-panic.rs:25:27
+  --> $DIR/non-fmt-panic.rs:31:27
    |
 LL |     debug_assert!(false, "{{}} bla");
    |                           ^^^^
@@ -119,7 +119,7 @@ LL |     debug_assert!(false, "{}", "{{}} bla");
    |                          +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:26:12
+  --> $DIR/non-fmt-panic.rs:32:12
    |
 LL |     panic!(C);
    |            ^
@@ -132,7 +132,7 @@ LL |     panic!("{}", C);
    |            +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:27:12
+  --> $DIR/non-fmt-panic.rs:33:12
    |
 LL |     panic!(S);
    |            ^
@@ -145,7 +145,7 @@ LL |     panic!("{}", S);
    |            +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:28:18
+  --> $DIR/non-fmt-panic.rs:34:18
    |
 LL |     unreachable!(S);
    |                  ^
@@ -158,7 +158,7 @@ LL |     unreachable!("{}", S);
    |                  +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:29:18
+  --> $DIR/non-fmt-panic.rs:35:18
    |
 LL |     unreachable!(S);
    |                  ^
@@ -171,7 +171,7 @@ LL |     unreachable!("{}", S);
    |                  +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:30:17
+  --> $DIR/non-fmt-panic.rs:36:17
    |
 LL |     std::panic!(123);
    |                 ^^^
@@ -189,7 +189,7 @@ LL +     std::panic::panic_any(123);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:31:18
+  --> $DIR/non-fmt-panic.rs:37:18
    |
 LL |     core::panic!(&*"abc");
    |                  ^^^^^^^
@@ -202,7 +202,7 @@ LL |     core::panic!("{}", &*"abc");
    |                  +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:32:12
+  --> $DIR/non-fmt-panic.rs:38:12
    |
 LL |     panic!(Some(123));
    |            ^^^^^^^^^
@@ -220,7 +220,7 @@ LL +     std::panic::panic_any(Some(123));
    |
 
 warning: panic message contains an unused formatting placeholder
-  --> $DIR/non-fmt-panic.rs:33:12
+  --> $DIR/non-fmt-panic.rs:39:12
    |
 LL |     panic!(concat!("{", "}"));
    |            ^^^^^^^^^^^^^^^^^
@@ -236,7 +236,7 @@ LL |     panic!("{}", concat!("{", "}"));
    |            +++++
 
 warning: panic message contains braces
-  --> $DIR/non-fmt-panic.rs:34:5
+  --> $DIR/non-fmt-panic.rs:40:5
    |
 LL |     panic!(concat!("{", "{"));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -248,7 +248,7 @@ LL |     panic!("{}", concat!("{", "{"));
    |            +++++
 
 warning: panic message contains an unused formatting placeholder
-  --> $DIR/non-fmt-panic.rs:36:37
+  --> $DIR/non-fmt-panic.rs:42:37
    |
 LL |     fancy_panic::fancy_panic!("test {} 123");
    |                                     ^^
@@ -256,7 +256,7 @@ LL |     fancy_panic::fancy_panic!("test {} 123");
    = note: this message is not used as a format string when given without arguments, but will be in Rust 2021
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:46:12
+  --> $DIR/non-fmt-panic.rs:52:12
    |
 LL |     panic!(a!());
    |            ^^^^
@@ -274,7 +274,7 @@ LL +     std::panic::panic_any(a!());
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:47:18
+  --> $DIR/non-fmt-panic.rs:53:18
    |
 LL |     unreachable!(a!());
    |                  ^^^^
@@ -287,7 +287,7 @@ LL |     unreachable!("{}", a!());
    |                  +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:49:12
+  --> $DIR/non-fmt-panic.rs:55:12
    |
 LL |     panic!(format!("{}", 1));
    |            ^^^^^^^^^^^^^^^^
@@ -302,7 +302,7 @@ LL +     panic!("{}", 1);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:50:18
+  --> $DIR/non-fmt-panic.rs:56:18
    |
 LL |     unreachable!(format!("{}", 1));
    |                  ^^^^^^^^^^^^^^^^
@@ -317,7 +317,7 @@ LL +     unreachable!("{}", 1);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:51:20
+  --> $DIR/non-fmt-panic.rs:57:20
    |
 LL |     assert!(false, format!("{}", 1));
    |                    ^^^^^^^^^^^^^^^^
@@ -332,7 +332,7 @@ LL +     assert!(false, "{}", 1);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:52:26
+  --> $DIR/non-fmt-panic.rs:58:26
    |
 LL |     debug_assert!(false, format!("{}", 1));
    |                          ^^^^^^^^^^^^^^^^
@@ -347,7 +347,7 @@ LL +     debug_assert!(false, "{}", 1);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:54:12
+  --> $DIR/non-fmt-panic.rs:60:12
    |
 LL |     panic![123];
    |            ^^^
@@ -365,7 +365,7 @@ LL +     std::panic::panic_any(123);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:55:12
+  --> $DIR/non-fmt-panic.rs:61:12
    |
 LL |     panic!{123};
    |            ^^^
@@ -383,7 +383,7 @@ LL +     std::panic::panic_any(123);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:72:12
+  --> $DIR/non-fmt-panic.rs:78:12
    |
 LL |     panic!(v);
    |     ------ ^
@@ -394,7 +394,7 @@ LL |     panic!(v);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:73:20
+  --> $DIR/non-fmt-panic.rs:79:20
    |
 LL |     assert!(false, v);
    |                    ^
@@ -403,7 +403,7 @@ LL |     assert!(false, v);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:77:12
+  --> $DIR/non-fmt-panic.rs:83:12
    |
 LL |     panic!(v);
    |            ^
@@ -421,7 +421,7 @@ LL +     std::panic::panic_any(v);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:78:20
+  --> $DIR/non-fmt-panic.rs:84:20
    |
 LL |     assert!(false, v);
    |                    ^
@@ -434,7 +434,7 @@ LL |     assert!(false, "{:?}", v);
    |                    +++++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:82:12
+  --> $DIR/non-fmt-panic.rs:88:12
    |
 LL |     panic!(v);
    |            ^
@@ -452,7 +452,7 @@ LL +     std::panic::panic_any(v);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:83:20
+  --> $DIR/non-fmt-panic.rs:89:20
    |
 LL |     assert!(false, v);
    |                    ^
@@ -465,7 +465,7 @@ LL |     assert!(false, "{}", v);
    |                    +++++
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:87:12
+  --> $DIR/non-fmt-panic.rs:93:12
    |
 LL |     panic!(v);
    |            ^
@@ -483,7 +483,7 @@ LL +     std::panic::panic_any(v);
    |
 
 warning: panic message is not a string literal
-  --> $DIR/non-fmt-panic.rs:88:20
+  --> $DIR/non-fmt-panic.rs:94:20
    |
 LL |     assert!(false, v);
    |                    ^
diff --git a/tests/ui/no-link-unknown-crate.rs b/tests/ui/no-link-unknown-crate.rs
deleted file mode 100644
index c7da2e41832..00000000000
--- a/tests/ui/no-link-unknown-crate.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#[no_link]
-extern crate doesnt_exist; //~ ERROR can't find crate
-
-fn main() {}
diff --git a/tests/ui/panic-runtime/two-panic-runtimes.rs b/tests/ui/panic-runtime/two-panic-runtimes.rs
index 80591edd107..de76578a267 100644
--- a/tests/ui/panic-runtime/two-panic-runtimes.rs
+++ b/tests/ui/panic-runtime/two-panic-runtimes.rs
@@ -1,11 +1,19 @@
 // ignore-tidy-linelength
 //@ build-fail
-//@ dont-require-annotations: ERROR
 //@ dont-check-compiler-stderr
 //@ aux-build:panic-runtime-unwind.rs
 //@ aux-build:panic-runtime-unwind2.rs
 //@ aux-build:panic-runtime-lang-items.rs
 
+// NOTE: there can be additional errors regarding trying to mix this crate if the precompiled target
+// (such as `wasm32-unknown-unknown` currently unconditionally defaulting to panic=abort) panic
+// strategy differs to abort, then involving a potentially-unwinding `panic_runtime_unwind` that
+// uses a different panic strategy. These errors are important but not to the test intention, which
+// is to check that trying to bring two panic runtimes (`panic_runtime_unwind`) and
+// (`panic_runtime_unwind2`) is prohibited. As such, the additional errors are not checked in this
+// test.
+//@ dont-require-annotations: ERROR
+
 #![no_std]
 #![no_main]
 
@@ -16,7 +24,3 @@ extern crate panic_runtime_lang_items;
 fn main() {}
 
 //~? ERROR cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2
-// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
-// instead of `dont-require-annotations`.
-//FIXME~? ERROR the linked panic runtime `panic_runtime_unwind2` is not compiled with this crate's panic strategy `abort`
-//FIXME~? ERROR the crate `panic_runtime_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`
diff --git a/tests/ui/panic-runtime/want-abort-got-unwind.rs b/tests/ui/panic-runtime/want-abort-got-unwind.rs
index 42cdf8bc662..7a6bd011d9e 100644
--- a/tests/ui/panic-runtime/want-abort-got-unwind.rs
+++ b/tests/ui/panic-runtime/want-abort-got-unwind.rs
@@ -1,16 +1,18 @@
 // ignore-tidy-linelength
 //@ build-fail
-//@ dont-require-annotations: ERROR
 //@ dont-check-compiler-stderr
 //@ aux-build:panic-runtime-unwind.rs
 //@ compile-flags:-C panic=abort
 
+// NOTE: depending on the target's default panic strategy, there can be additional errors that
+// complain about linking two panic runtimes (e.g. precompiled `panic_unwind` if target default
+// panic strategy is unwind, in addition to `panic_runtime_unwind`). These additional errors will
+// not be observed on targets whose default panic strategy is abort, where `panic_abort` is linked
+// in instead.
+//@ dont-require-annotations: ERROR
+
 extern crate panic_runtime_unwind;
 
 fn main() {}
 
 //~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
-// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
-// instead of `dont-require-annotations`.
-//FIXME~? ERROR cannot link together two panic runtimes: panic_unwind and panic_runtime_unwind
-//FIXME~? ERROR the crate `panic_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`
diff --git a/tests/ui/panic-runtime/want-abort-got-unwind2.rs b/tests/ui/panic-runtime/want-abort-got-unwind2.rs
index ddf12cd2a9a..da239a675e5 100644
--- a/tests/ui/panic-runtime/want-abort-got-unwind2.rs
+++ b/tests/ui/panic-runtime/want-abort-got-unwind2.rs
@@ -1,17 +1,23 @@
 // ignore-tidy-linelength
 //@ build-fail
-//@ dont-require-annotations: ERROR
 //@ dont-check-compiler-stderr
 //@ aux-build:panic-runtime-unwind.rs
 //@ aux-build:wants-panic-runtime-unwind.rs
 //@ compile-flags:-C panic=abort
 
+// Like `want-abort-got-unwind.rs`, this version checks that if the root binary wants abort panic
+// runtime, that the compiler rejects a setup where a dependency crate in the dependency DAG
+// transitively provides an unwind panic runtime (which also is built with `-Cpanic=unwind`, making
+// that potentially-unwinding).
+
+// NOTE: similar to `want-abort-got-unwind.rs`, there can be additional errors if the target default
+// panic strategy is unwind, because then the precompiled `panic_unwind` would also be linked in,
+// duplicating `panic_runtime_unwind` (transitively). But those additional errors are not important
+// to test intention.
+//@ dont-require-annotations: ERROR
+
 extern crate wants_panic_runtime_unwind;
 
 fn main() {}
 
 //~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
-// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
-// instead of `dont-require-annotations`.
-//FIXME~? ERROR cannot link together two panic runtimes: panic_unwind and panic_runtime_unwind
-//FIXME~? ERROR the crate `panic_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`
diff --git a/tests/ui/parser/issues/invalid-parse-format-issue-139104.rs b/tests/ui/parser/issues/invalid-parse-format-issue-139104.rs
new file mode 100644
index 00000000000..7644df8be49
--- /dev/null
+++ b/tests/ui/parser/issues/invalid-parse-format-issue-139104.rs
@@ -0,0 +1,13 @@
+fn main() {
+    println!("{foo:_1.4}", foo = 3.14); //~ ERROR invalid format string: expected `}`, found `.`
+    println!("{0:_1.4}", 1.11); //~ ERROR invalid format string: expected `}`, found `.`
+    println!("{:_1.4}", 3.14); //~ ERROR invalid format string: expected `}`, found `.`
+
+    println!("{foo:_1.4", foo = 3.14); //~ ERROR invalid format string: expected `}`, found `.`
+    println!("{0:_1.4", 1.11); //~ ERROR invalid format string: expected `}`, found `.`
+    println!("{:_1.4", 3.14); //~ ERROR invalid format string: expected `}`, found `.`
+
+    println!("{  0", 1.11); //~ ERROR invalid format string: expected `}`, found `0`
+    println!("{foo:1.4_1.4}", foo = 3.14); //~ ERROR invalid format string: expected `}`, found `.`
+    println!("{0:1.4_1.4}", 3.14); //~ ERROR invalid format string: expected `}`, found `.`
+}
diff --git a/tests/ui/parser/issues/invalid-parse-format-issue-139104.stderr b/tests/ui/parser/issues/invalid-parse-format-issue-139104.stderr
new file mode 100644
index 00000000000..202aa450cab
--- /dev/null
+++ b/tests/ui/parser/issues/invalid-parse-format-issue-139104.stderr
@@ -0,0 +1,92 @@
+error: invalid format string: expected `}`, found `.`
+  --> $DIR/invalid-parse-format-issue-139104.rs:2:22
+   |
+LL |     println!("{foo:_1.4}", foo = 3.14);
+   |               -      ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: invalid format string: expected `}`, found `.`
+  --> $DIR/invalid-parse-format-issue-139104.rs:3:20
+   |
+LL |     println!("{0:_1.4}", 1.11);
+   |               -    ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: invalid format string: expected `}`, found `.`
+  --> $DIR/invalid-parse-format-issue-139104.rs:4:19
+   |
+LL |     println!("{:_1.4}", 3.14);
+   |               -   ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: invalid format string: expected `}`, found `.`
+  --> $DIR/invalid-parse-format-issue-139104.rs:6:22
+   |
+LL |     println!("{foo:_1.4", foo = 3.14);
+   |               -      ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: invalid format string: expected `}`, found `.`
+  --> $DIR/invalid-parse-format-issue-139104.rs:7:20
+   |
+LL |     println!("{0:_1.4", 1.11);
+   |               -    ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: invalid format string: expected `}`, found `.`
+  --> $DIR/invalid-parse-format-issue-139104.rs:8:19
+   |
+LL |     println!("{:_1.4", 3.14);
+   |               -   ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: invalid format string: expected `}`, found `0`
+  --> $DIR/invalid-parse-format-issue-139104.rs:10:18
+   |
+LL |     println!("{  0", 1.11);
+   |               -  ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: invalid format string: expected `}`, found `.`
+  --> $DIR/invalid-parse-format-issue-139104.rs:11:25
+   |
+LL |     println!("{foo:1.4_1.4}", foo = 3.14);
+   |               -         ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: invalid format string: expected `}`, found `.`
+  --> $DIR/invalid-parse-format-issue-139104.rs:12:23
+   |
+LL |     println!("{0:1.4_1.4}", 3.14);
+   |               -       ^ expected `}` in format string
+   |               |
+   |               because of this opening brace
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+
+error: aborting due to 9 previous errors
+
diff --git a/tests/ui/auxiliary/issue-24106.rs b/tests/ui/pattern/auxiliary/cross-crate-enum-pattern.rs
index 2c6a6034806..2c6a6034806 100644
--- a/tests/ui/auxiliary/issue-24106.rs
+++ b/tests/ui/pattern/auxiliary/cross-crate-enum-pattern.rs
diff --git a/tests/ui/pattern/cross-crate-enum-pattern.rs b/tests/ui/pattern/cross-crate-enum-pattern.rs
new file mode 100644
index 00000000000..254caf99277
--- /dev/null
+++ b/tests/ui/pattern/cross-crate-enum-pattern.rs
@@ -0,0 +1,13 @@
+//! Test that we can match on enum constants across crates.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/24106>.
+
+
+//@ run-pass
+//@ aux-build:cross-crate-enum-pattern.rs
+
+extern crate cross_crate_enum_pattern;
+
+fn main() {
+    cross_crate_enum_pattern::go::<()>();
+}
diff --git a/tests/ui/auxiliary/impl_privacy_xc_1.rs b/tests/ui/privacy/auxiliary/impl-privacy-cross-crate-1.rs
index 367b8ec8b88..367b8ec8b88 100644
--- a/tests/ui/auxiliary/impl_privacy_xc_1.rs
+++ b/tests/ui/privacy/auxiliary/impl-privacy-cross-crate-1.rs
diff --git a/tests/ui/privacy/auxiliary/impl_privacy_xc_2.rs b/tests/ui/privacy/auxiliary/impl-privacy-cross-crate-2.rs
index 5f9c2268167..5f9c2268167 100644
--- a/tests/ui/privacy/auxiliary/impl_privacy_xc_2.rs
+++ b/tests/ui/privacy/auxiliary/impl-privacy-cross-crate-2.rs
diff --git a/tests/ui/privacy/impl-privacy-cross-crate-1.rs b/tests/ui/privacy/impl-privacy-cross-crate-1.rs
new file mode 100644
index 00000000000..6b2ef3ccc78
--- /dev/null
+++ b/tests/ui/privacy/impl-privacy-cross-crate-1.rs
@@ -0,0 +1,10 @@
+//@ run-pass
+//@ aux-build:impl-privacy-cross-crate-1.rs
+
+
+extern crate impl_privacy_cross_crate_1;
+
+pub fn main() {
+    let fish = impl_privacy_cross_crate_1::Fish { x: 1 };
+    fish.swim();
+}
diff --git a/tests/ui/privacy/impl-privacy-cross-crate-2.rs b/tests/ui/privacy/impl-privacy-cross-crate-2.rs
new file mode 100644
index 00000000000..fa07e6e8cce
--- /dev/null
+++ b/tests/ui/privacy/impl-privacy-cross-crate-2.rs
@@ -0,0 +1,10 @@
+//@ run-pass
+//@ aux-build:impl-privacy-cross-crate-2.rs
+
+extern crate impl_privacy_cross_crate_2;
+
+pub fn main() {
+    let fish1 = impl_privacy_cross_crate_2::Fish { x: 1 };
+    let fish2 = impl_privacy_cross_crate_2::Fish { x: 2 };
+    if fish1.eq(&fish2) { println!("yes") } else { println!("no") };
+}
diff --git a/tests/ui/privacy/impl-privacy-xc-2.rs b/tests/ui/privacy/impl-privacy-xc-2.rs
deleted file mode 100644
index da345ba2072..00000000000
--- a/tests/ui/privacy/impl-privacy-xc-2.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-//@ aux-build:impl_privacy_xc_2.rs
-
-extern crate impl_privacy_xc_2;
-
-pub fn main() {
-    let fish1 = impl_privacy_xc_2::Fish { x: 1 };
-    let fish2 = impl_privacy_xc_2::Fish { x: 2 };
-    if fish1.eq(&fish2) { println!("yes") } else { println!("no") };
-}
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-allow.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-allow.rs
new file mode 100644
index 00000000000..76fdce7e5cf
--- /dev/null
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-allow.rs
@@ -0,0 +1,16 @@
+//@ check-pass
+//@ edition: 2021
+//
+// Anti-regression test for https://github.com/rust-lang/rust/issues/140602
+// where the generated warning couldn't be allowed due too being attached to
+// the wrong AST node.
+
+#![deny(unsafe_attr_outside_unsafe)]
+
+#[allow(unsafe_attr_outside_unsafe)]
+mod generated {
+    #[no_mangle]
+    fn _generated_foo() {}
+}
+
+fn main() {}
diff --git a/tests/ui/statics/auxiliary/inner_static.rs b/tests/ui/statics/auxiliary/inner_static.rs
new file mode 100644
index 00000000000..1c62046438f
--- /dev/null
+++ b/tests/ui/statics/auxiliary/inner_static.rs
@@ -0,0 +1,67 @@
+//! Test for inner statics with the same name.
+//!
+//! Before, the path name for all items defined in methods of traits and impls never
+//! took into account the name of the method. This meant that if you had two statics
+//! of the same name in two different methods the statics would end up having the
+//! same symbol named (even after mangling) because the path components leading to
+//! the symbol were exactly the same (just __extensions__ and the static name).
+//!
+//! It turns out that if you add the symbol "A" twice to LLVM, it automatically
+//! makes the second one "A1" instead of "A". What this meant is that in local crate
+//! compilations we never found this bug. Even across crates, this was never a
+//! problem. The problem arises when you have generic methods that don't get
+//! generated at compile-time of a library. If the statics were re-added to LLVM by
+//! a client crate of a library in a different order, you would reference different
+//! constants (the integer suffixes wouldn't be guaranteed to be the same).
+
+pub struct A<T> { pub v: T }
+pub struct B<T> { pub v: T }
+
+pub mod test {
+    pub struct A<T> { pub v: T }
+
+    impl<T> A<T> {
+        pub fn foo(&self) -> isize {
+            static a: isize = 5;
+            return a
+        }
+
+        pub fn bar(&self) -> isize {
+            static a: isize = 6;
+            return a;
+        }
+    }
+}
+
+impl<T> A<T> {
+    pub fn foo(&self) -> isize {
+        static a: isize = 1;
+        return a
+    }
+
+    pub fn bar(&self) -> isize {
+        static a: isize = 2;
+        return a;
+    }
+}
+
+impl<T> B<T> {
+    pub fn foo(&self) -> isize {
+        static a: isize = 3;
+        return a
+    }
+
+    pub fn bar(&self) -> isize {
+        static a: isize = 4;
+        return a;
+    }
+}
+
+pub fn foo() -> isize {
+    let a = A { v: () };
+    let b = B { v: () };
+    let c = test::A { v: () };
+    return a.foo() + a.bar() +
+           b.foo() + b.bar() +
+           c.foo() + c.bar();
+}
diff --git a/tests/ui/statics/inner-static.rs b/tests/ui/statics/inner-static.rs
new file mode 100644
index 00000000000..1916435c46a
--- /dev/null
+++ b/tests/ui/statics/inner-static.rs
@@ -0,0 +1,30 @@
+//! Test for inner statics with the same name.
+//!
+//! Before, the path name for all items defined in methods of traits and impls never
+//! took into account the name of the method. This meant that if you had two statics
+//! of the same name in two different methods the statics would end up having the
+//! same symbol named (even after mangling) because the path components leading to
+//! the symbol were exactly the same (just __extensions__ and the static name).
+//!
+//! It turns out that if you add the symbol "A" twice to LLVM, it automatically
+//! makes the second one "A1" instead of "A". What this meant is that in local crate
+//! compilations we never found this bug. Even across crates, this was never a
+//! problem. The problem arises when you have generic methods that don't get
+//! generated at compile-time of a library. If the statics were re-added to LLVM by
+//! a client crate of a library in a different order, you would reference different
+//! constants (the integer suffixes wouldn't be guaranteed to be the same).
+
+//@ run-pass
+//@ aux-build:inner_static.rs
+
+
+extern crate inner_static;
+
+pub fn main() {
+    let a = inner_static::A::<()> { v: () };
+    let b = inner_static::B::<()> { v: () };
+    let c = inner_static::test::A::<()> { v: () };
+    assert_eq!(a.bar(), 2);
+    assert_eq!(b.bar(), 4);
+    assert_eq!(c.bar(), 6);
+}