about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/mod.rs51
-rw-r--r--src/librustdoc/config.rs4
-rw-r--r--src/librustdoc/core.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs4
-rw-r--r--src/tools/generate-copyright/Cargo.toml2
-rw-r--r--src/tools/generate-copyright/src/cargo_metadata.rs3
-rw-r--r--src/tools/miri/src/diagnostics.rs2
-rw-r--r--src/tools/miri/src/helpers.rs1
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.stderr2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.rs2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.stderr2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.rs2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.stderr2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.rs2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.stderr2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.rs2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.stderr2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.rs2
-rw-r--r--src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.stderr2
-rw-r--r--src/tools/miri/tests/fail/shims/input_arg_mismatch.rs2
-rw-r--r--src/tools/miri/tests/fail/shims/input_arg_mismatch.stderr2
-rw-r--r--src/tools/miri/tests/fail/shims/return_type_mismatch.stderr2
-rw-r--r--src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.rs2
-rw-r--r--src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.stderr2
-rw-r--r--src/tools/tidy/Cargo.toml2
-rw-r--r--src/tools/tidy/src/deps.rs16
29 files changed, 58 insertions, 67 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 1265a39d27b..14295ce0a31 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -36,6 +36,7 @@ use std::mem;
 
 use rustc_ast::token::{Token, TokenKind};
 use rustc_ast::tokenstream::{TokenStream, TokenTree};
+use rustc_attr_data_structures::{AttributeKind, find_attr};
 use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet, IndexEntry};
 use rustc_errors::codes::*;
 use rustc_errors::{FatalError, struct_span_code_err};
@@ -987,28 +988,17 @@ fn clean_proc_macro<'tcx>(
     kind: MacroKind,
     cx: &mut DocContext<'tcx>,
 ) -> ItemKind {
-    let attrs = cx.tcx.hir_attrs(item.hir_id());
-    if kind == MacroKind::Derive
-        && let Some(derive_name) =
-            hir_attr_lists(attrs, sym::proc_macro_derive).find_map(|mi| mi.ident())
-    {
-        *name = derive_name.name;
+    if kind != MacroKind::Derive {
+        return ProcMacroItem(ProcMacro { kind, helpers: vec![] });
     }
+    let attrs = cx.tcx.hir_attrs(item.hir_id());
+    let Some((trait_name, helper_attrs)) = find_attr!(attrs, AttributeKind::ProcMacroDerive { trait_name, helper_attrs, ..} => (*trait_name, helper_attrs))
+    else {
+        return ProcMacroItem(ProcMacro { kind, helpers: vec![] });
+    };
+    *name = trait_name;
+    let helpers = helper_attrs.iter().copied().collect();
 
-    let mut helpers = Vec::new();
-    for mi in hir_attr_lists(attrs, sym::proc_macro_derive) {
-        if !mi.has_name(sym::attributes) {
-            continue;
-        }
-
-        if let Some(list) = mi.meta_item_list() {
-            for inner_mi in list {
-                if let Some(ident) = inner_mi.ident() {
-                    helpers.push(ident.name);
-                }
-            }
-        }
-    }
     ProcMacroItem(ProcMacro { kind, helpers })
 }
 
@@ -1021,17 +1011,16 @@ fn clean_fn_or_proc_macro<'tcx>(
     cx: &mut DocContext<'tcx>,
 ) -> ItemKind {
     let attrs = cx.tcx.hir_attrs(item.hir_id());
-    let macro_kind = attrs.iter().find_map(|a| {
-        if a.has_name(sym::proc_macro) {
-            Some(MacroKind::Bang)
-        } else if a.has_name(sym::proc_macro_derive) {
-            Some(MacroKind::Derive)
-        } else if a.has_name(sym::proc_macro_attribute) {
-            Some(MacroKind::Attr)
-        } else {
-            None
-        }
-    });
+    let macro_kind = if find_attr!(attrs, AttributeKind::ProcMacro(..)) {
+        Some(MacroKind::Bang)
+    } else if find_attr!(attrs, AttributeKind::ProcMacroDerive { .. }) {
+        Some(MacroKind::Derive)
+    } else if find_attr!(attrs, AttributeKind::ProcMacroAttribute(..)) {
+        Some(MacroKind::Attr)
+    } else {
+        None
+    };
+
     match macro_kind {
         Some(kind) => clean_proc_macro(item, name, kind, cx),
         None => {
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 986390dbaa0..57456e906de 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -173,6 +173,9 @@ pub(crate) struct Options {
 
     /// Arguments to be used when compiling doctests.
     pub(crate) doctest_build_args: Vec<String>,
+
+    /// Target modifiers.
+    pub(crate) target_modifiers: BTreeMap<OptionsTargetModifiers, String>,
 }
 
 impl fmt::Debug for Options {
@@ -846,6 +849,7 @@ impl Options {
             unstable_features,
             expanded_args: args,
             doctest_build_args,
+            target_modifiers,
         };
         let render_options = RenderOptions {
             output,
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index bd57bb21e63..e89733b2f6d 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -214,6 +214,7 @@ pub(crate) fn create_config(
         scrape_examples_options,
         expanded_args,
         remap_path_prefix,
+        target_modifiers,
         ..
     }: RustdocOptions,
     render_options: &RenderOptions,
@@ -277,6 +278,7 @@ pub(crate) fn create_config(
         } else {
             OutputTypes::new(&[])
         },
+        target_modifiers,
         ..Options::default()
     };
 
diff --git a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
index 2006a824402..7b057998063 100644
--- a/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
+++ b/src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
@@ -312,9 +312,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
 /// Functions marked with these attributes must have the exact signature.
 pub(crate) fn requires_exact_signature(attrs: &[Attribute]) -> bool {
     attrs.iter().any(|attr| {
-        [sym::proc_macro, sym::proc_macro_attribute, sym::proc_macro_derive]
-            .iter()
-            .any(|&allow| attr.has_name(allow))
+        attr.is_proc_macro_attr()
     })
 }
 
diff --git a/src/tools/generate-copyright/Cargo.toml b/src/tools/generate-copyright/Cargo.toml
index e420a450d42..bcb3165de45 100644
--- a/src/tools/generate-copyright/Cargo.toml
+++ b/src/tools/generate-copyright/Cargo.toml
@@ -9,7 +9,7 @@ description = "Produces a manifest of all the copyrighted materials in the Rust
 [dependencies]
 anyhow = "1.0.65"
 askama = "0.14.0"
-cargo_metadata = "0.18.1"
+cargo_metadata = "0.21"
 serde = { version = "1.0.147", features = ["derive"] }
 serde_json = "1.0.85"
 thiserror = "1"
diff --git a/src/tools/generate-copyright/src/cargo_metadata.rs b/src/tools/generate-copyright/src/cargo_metadata.rs
index 3fae26bda47..87cd85c8def 100644
--- a/src/tools/generate-copyright/src/cargo_metadata.rs
+++ b/src/tools/generate-copyright/src/cargo_metadata.rs
@@ -92,7 +92,8 @@ pub fn get_metadata(
                 continue;
             }
             // otherwise it's an out-of-tree dependency
-            let package_id = Package { name: package.name, version: package.version.to_string() };
+            let package_id =
+                Package { name: package.name.to_string(), version: package.version.to_string() };
             output.insert(
                 package_id,
                 PackageMetadata {
diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs
index 9ecbd31c5b9..8fdf8d643ea 100644
--- a/src/tools/miri/src/diagnostics.rs
+++ b/src/tools/miri/src/diagnostics.rs
@@ -382,7 +382,7 @@ pub fn report_error<'tcx>(
                             helps.push(note_span!(span, "{:?} was deallocated here:", alloc_id));
                         }
                     }
-                    AbiMismatchArgument { .. } | AbiMismatchReturn { .. } => {
+                    AbiMismatchArgument { .. } => {
                         helps.push(note!("this means these two types are not *guaranteed* to be ABI-compatible across all targets"));
                         helps.push(note!("if you think this code should be accepted anyway, please report an issue with Miri"));
                     }
diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs
index ccfff7fa94b..15699828e00 100644
--- a/src/tools/miri/src/helpers.rs
+++ b/src/tools/miri/src/helpers.rs
@@ -1079,6 +1079,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
             .position(|b| !b)
         {
             throw_ub!(AbiMismatchArgument {
+                arg_idx: index,
                 caller_ty: caller_fn_abi.args[index].layout.ty,
                 callee_ty: callee_fn_abi.args[index].layout.ty
             });
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs
index 4468eb299f3..26f2e73dd75 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs
@@ -17,5 +17,5 @@ fn main() {
     // These two types have the same size but are still not compatible.
     let g = unsafe { std::mem::transmute::<fn(S), fn(A)>(f) };
 
-    g(Default::default()) //~ ERROR: calling a function with argument of type S passing data of type [i32; 4]
+    g(Default::default()) //~ ERROR: type S passing argument of type [i32; 4]
 }
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.stderr b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.stderr
index cabefa8bee9..f793abb0b62 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.stderr
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_array_vs_struct.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with argument of type S passing data of type [i32; 4]
+error: Undefined Behavior: calling a function whose parameter #1 has type S passing argument of type [i32; 4]
   --> tests/fail/function_pointers/abi_mismatch_array_vs_struct.rs:LL:CC
    |
 LL |     g(Default::default())
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.rs b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.rs
index a1fda329e8d..0cca4a13233 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.rs
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.rs
@@ -3,5 +3,5 @@ fn main() {
 
     let g = unsafe { std::mem::transmute::<fn(f32), fn(i32)>(f) };
 
-    g(42) //~ ERROR: calling a function with argument of type f32 passing data of type i32
+    g(42) //~ ERROR: type f32 passing argument of type i32
 }
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.stderr b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.stderr
index 52cc48d58ce..3651fc9b3f7 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.stderr
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_int_vs_float.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with argument of type f32 passing data of type i32
+error: Undefined Behavior: calling a function whose parameter #1 has type f32 passing argument of type i32
   --> tests/fail/function_pointers/abi_mismatch_int_vs_float.rs:LL:CC
    |
 LL |     g(42)
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.rs b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.rs
index f0ea5ccfe0f..053a4a5f284 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.rs
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.rs
@@ -3,5 +3,5 @@ fn main() {
 
     let g = unsafe { std::mem::transmute::<fn(*const [i32]), fn(*const i32)>(f) };
 
-    g(&42 as *const i32) //~ ERROR: calling a function with argument of type *const [i32] passing data of type *const i32
+    g(&42 as *const i32) //~ ERROR: type *const [i32] passing argument of type *const i32
 }
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.stderr b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.stderr
index 2fbb0408c59..88345a0688c 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.stderr
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_raw_pointer.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with argument of type *const [i32] passing data of type *const i32
+error: Undefined Behavior: calling a function whose parameter #1 has type *const [i32] passing argument of type *const i32
   --> tests/fail/function_pointers/abi_mismatch_raw_pointer.rs:LL:CC
    |
 LL |     g(&42 as *const i32)
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs
index c5900489b4c..f3dffcc4e86 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.rs
@@ -12,5 +12,5 @@ fn main() {
     let fnptr: fn(S2) = callee;
     let fnptr: fn(S1) = unsafe { std::mem::transmute(fnptr) };
     fnptr(S1(NonZero::new(1).unwrap()));
-    //~^ ERROR: calling a function with argument of type S2 passing data of type S1
+    //~^ ERROR: type S2 passing argument of type S1
 }
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr
index 2c1ac0ee702..47658395132 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_repr_C.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with argument of type S2 passing data of type S1
+error: Undefined Behavior: calling a function whose parameter #1 has type S2 passing argument of type S1
   --> tests/fail/function_pointers/abi_mismatch_repr_C.rs:LL:CC
    |
 LL |     fnptr(S1(NonZero::new(1).unwrap()));
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.rs b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.rs
index 0fdab49b94b..05b645cf75a 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.rs
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.rs
@@ -5,5 +5,5 @@ fn main() {
 
     let g = unsafe { std::mem::transmute::<fn() -> u32, fn()>(f) };
 
-    g() //~ ERROR: calling a function with return type u32 passing return place of type ()
+    g() //~ ERROR: type u32 passing return place of type ()
 }
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.stderr b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.stderr
index 28c676ad482..07e6561b53e 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.stderr
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_return_type.stderr
@@ -6,8 +6,6 @@ LL |     g()
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
-   = help: this means these two types are not *guaranteed* to be ABI-compatible across all targets
-   = help: if you think this code should be accepted anyway, please report an issue with Miri
    = note: BACKTRACE:
    = note: inside `main` at tests/fail/function_pointers/abi_mismatch_return_type.rs:LL:CC
 
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.rs b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.rs
index 20384f0965b..ca43c06008f 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.rs
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.rs
@@ -3,5 +3,5 @@ fn main() {
 
     let g = unsafe { std::mem::transmute::<fn((i32, i32)), fn(i32)>(f) };
 
-    g(42) //~ ERROR: calling a function with argument of type (i32, i32) passing data of type i32
+    g(42) //~ ERROR: type (i32, i32) passing argument of type i32
 }
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.stderr b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.stderr
index e45ad12ec05..2ed9ac2e6da 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.stderr
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_simple.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with argument of type (i32, i32) passing data of type i32
+error: Undefined Behavior: calling a function whose parameter #1 has type (i32, i32) passing argument of type i32
   --> tests/fail/function_pointers/abi_mismatch_simple.rs:LL:CC
    |
 LL |     g(42)
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.rs b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.rs
index 80f357b61ba..dedcaac6142 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.rs
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.rs
@@ -7,5 +7,5 @@ fn main() {
     // These two vector types have the same size but are still not compatible.
     let g = unsafe { std::mem::transmute::<fn(simd::u32x8), fn(simd::u64x4)>(f) };
 
-    g(Default::default()) //~ ERROR: calling a function with argument of type std::simd::Simd<u32, 8> passing data of type std::simd::Simd<u64, 4>
+    g(Default::default()) //~ ERROR: type std::simd::Simd<u32, 8> passing argument of type std::simd::Simd<u64, 4>
 }
diff --git a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.stderr b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.stderr
index bad2495cb39..b13e8d936db 100644
--- a/src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.stderr
+++ b/src/tools/miri/tests/fail/function_pointers/abi_mismatch_vector.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with argument of type std::simd::Simd<u32, 8> passing data of type std::simd::Simd<u64, 4>
+error: Undefined Behavior: calling a function whose parameter #1 has type std::simd::Simd<u32, 8> passing argument of type std::simd::Simd<u64, 4>
   --> tests/fail/function_pointers/abi_mismatch_vector.rs:LL:CC
    |
 LL |     g(Default::default())
diff --git a/src/tools/miri/tests/fail/shims/input_arg_mismatch.rs b/src/tools/miri/tests/fail/shims/input_arg_mismatch.rs
index eb8de04dcc4..77699776aea 100644
--- a/src/tools/miri/tests/fail/shims/input_arg_mismatch.rs
+++ b/src/tools/miri/tests/fail/shims/input_arg_mismatch.rs
@@ -16,6 +16,6 @@ fn main() {
     } as u32;
     let _ = unsafe {
         close(fd);
-        //~^ ERROR: calling a function with argument of type i32 passing data of type u32
+        //~^ ERROR: type i32 passing argument of type u32
     };
 }
diff --git a/src/tools/miri/tests/fail/shims/input_arg_mismatch.stderr b/src/tools/miri/tests/fail/shims/input_arg_mismatch.stderr
index ce00b624a42..ec27fd5ebb8 100644
--- a/src/tools/miri/tests/fail/shims/input_arg_mismatch.stderr
+++ b/src/tools/miri/tests/fail/shims/input_arg_mismatch.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with argument of type i32 passing data of type u32
+error: Undefined Behavior: calling a function whose parameter #1 has type i32 passing argument of type u32
   --> tests/fail/shims/input_arg_mismatch.rs:LL:CC
    |
 LL |         close(fd);
diff --git a/src/tools/miri/tests/fail/shims/return_type_mismatch.stderr b/src/tools/miri/tests/fail/shims/return_type_mismatch.stderr
index 18ff3067fa0..080ee16a2eb 100644
--- a/src/tools/miri/tests/fail/shims/return_type_mismatch.stderr
+++ b/src/tools/miri/tests/fail/shims/return_type_mismatch.stderr
@@ -6,8 +6,6 @@ LL |         close(fd);
    |
    = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
    = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
-   = help: this means these two types are not *guaranteed* to be ABI-compatible across all targets
-   = help: if you think this code should be accepted anyway, please report an issue with Miri
    = note: BACKTRACE:
    = note: inside `main` at tests/fail/shims/return_type_mismatch.rs:LL:CC
 
diff --git a/src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.rs b/src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.rs
index 6df132d3255..36bd1e99cfb 100644
--- a/src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.rs
+++ b/src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.rs
@@ -6,7 +6,7 @@ fn main() {
     //   the error should point to `become g(x)`,
     //   but tail calls mess up the backtrace it seems like...
     f(0);
-    //~^ error: Undefined Behavior: calling a function with argument of type i32 passing data of type u32
+    //~^ error: type i32 passing argument of type u32
 }
 
 fn f(x: u32) {
diff --git a/src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.stderr b/src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.stderr
index fbb0d3d565d..cabea5df85d 100644
--- a/src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.stderr
+++ b/src/tools/miri/tests/fail/tail_calls/signature-mismatch-arg.stderr
@@ -1,4 +1,4 @@
-error: Undefined Behavior: calling a function with argument of type i32 passing data of type u32
+error: Undefined Behavior: calling a function whose parameter #1 has type i32 passing argument of type u32
   --> tests/fail/tail_calls/signature-mismatch-arg.rs:LL:CC
    |
 LL |     f(0);
diff --git a/src/tools/tidy/Cargo.toml b/src/tools/tidy/Cargo.toml
index d995106ae02..c1f27de7ed4 100644
--- a/src/tools/tidy/Cargo.toml
+++ b/src/tools/tidy/Cargo.toml
@@ -6,7 +6,7 @@ autobins = false
 
 [dependencies]
 build_helper = { path = "../../build_helper" }
-cargo_metadata = "0.19"
+cargo_metadata = "0.21"
 regex = "1"
 miropt-test-tools = { path = "../miropt-test-tools" }
 walkdir = "2"
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index c40572c115b..8e2a796106f 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -633,8 +633,8 @@ fn check_proc_macro_dep_list(root: &Path, cargo: &Path, bless: bool, bad: &mut b
     proc_macro_deps.retain(|pkg| !is_proc_macro_pkg(&metadata[pkg]));
 
     let proc_macro_deps: HashSet<_> =
-        proc_macro_deps.into_iter().map(|dep| metadata[dep].name.clone()).collect();
-    let expected = proc_macro_deps::CRATES.iter().map(|s| s.to_string()).collect::<HashSet<_>>();
+        proc_macro_deps.into_iter().map(|dep| metadata[dep].name.as_ref()).collect();
+    let expected = proc_macro_deps::CRATES.iter().copied().collect::<HashSet<_>>();
 
     let needs_blessing = proc_macro_deps.difference(&expected).next().is_some()
         || expected.difference(&proc_macro_deps).next().is_some();
@@ -718,7 +718,7 @@ fn check_runtime_license_exceptions(metadata: &Metadata, bad: &mut bool) {
             // See https://github.com/rust-lang/rust/issues/62620 for more.
             // In general, these should never be added and this exception
             // should not be taken as precedent for any new target.
-            if pkg.name == "fortanix-sgx-abi" && pkg.license.as_deref() == Some("MPL-2.0") {
+            if *pkg.name == "fortanix-sgx-abi" && pkg.license.as_deref() == Some("MPL-2.0") {
                 continue;
             }
 
@@ -734,7 +734,7 @@ fn check_license_exceptions(metadata: &Metadata, exceptions: &[(&str, &str)], ba
     // Validate the EXCEPTIONS list hasn't changed.
     for (name, license) in exceptions {
         // Check that the package actually exists.
-        if !metadata.packages.iter().any(|p| p.name == *name) {
+        if !metadata.packages.iter().any(|p| *p.name == *name) {
             tidy_error!(
                 bad,
                 "could not find exception package `{}`\n\
@@ -743,7 +743,7 @@ fn check_license_exceptions(metadata: &Metadata, exceptions: &[(&str, &str)], ba
             );
         }
         // Check that the license hasn't changed.
-        for pkg in metadata.packages.iter().filter(|p| p.name == *name) {
+        for pkg in metadata.packages.iter().filter(|p| *p.name == *name) {
             match &pkg.license {
                 None => {
                     if *license == NON_STANDARD_LICENSE
@@ -818,9 +818,9 @@ fn check_permitted_dependencies(
                 let Ok(version) = Version::parse(version) else {
                     return false;
                 };
-                pkg.name == name && pkg.version == version
+                *pkg.name == name && pkg.version == version
             } else {
-                pkg.name == permitted
+                *pkg.name == permitted
             }
         }
         if !deps.iter().any(|dep_id| compare(pkg_from_id(metadata, dep_id), permitted)) {
@@ -868,7 +868,7 @@ fn check_permitted_dependencies(
 
 /// Finds a package with the given name.
 fn pkg_from_name<'a>(metadata: &'a Metadata, name: &'static str) -> &'a Package {
-    let mut i = metadata.packages.iter().filter(|p| p.name == name);
+    let mut i = metadata.packages.iter().filter(|p| *p.name == name);
     let result =
         i.next().unwrap_or_else(|| panic!("could not find package `{name}` in package list"));
     assert!(i.next().is_none(), "more than one package found for `{name}`");