From d9e4ab652aa8eb685e8b6114ecdea78300d0c430 Mon Sep 17 00:00:00 2001 From: Krasimir Georgiev Date: Thu, 27 Apr 2023 08:26:17 +0000 Subject: [PATCH] [DO NOT MERGE] have tag be explicit debug_args! argument No functional changes intended. We've got a custom rustc build. After https://github.com/rust-lang/rust/commit/2b8d27b402b621d20c7c29c500852c727d4cc8cd we're seeing a new build error while building rustc_middle: ``` error: there is no argument named `tag` --> /compiler/rustc_middle/src/ty/mod.rs:1505:1 | 1505 | / impl_tag! { 1506 | | impl Tag for ParamTag; 1507 | | ParamTag { reveal: traits::Reveal::UserFacing, constness: hir::Constness::NotConst }, 1508 | | ParamTag { reveal: traits::Reveal::All, constness: hir::Constness::NotConst }, 1509 | | ParamTag { reveal: traits::Reveal::UserFacing, constness: hir::Constness::Const }, 1510 | | ParamTag { reveal: traits::Reveal::All, constness: hir::Constness::Const }, 1511 | | } | |_^ | = note: did you intend to capture a variable `tag` from the surrounding scope? = note: to avoid ambiguity, `format_args!` cannot capture variables when the format string is expanded from a macro = note: this error originates in the macro `impl_tag` (in Nightly builds, run with -Z macro-backtrace for more info) ``` This patch fixes it. I'm not sure why this doesn't fire with x.py, hence the DO NOT MERGE. Maybe we're missing come rustc flags that silence this error? --- compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs b/compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs index cb7f7d318dc41..44c6833252830 100644 --- a/compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs +++ b/compiler/rustc_data_structures/src/tagged_ptr/impl_tag.rs @@ -128,8 +128,9 @@ macro_rules! impl_tag { _ => unsafe { debug_assert!( false, - "invalid tag: {tag}\ - (this is a bug in the caller of `from_usize`)" + "invalid tag: {}\ + (this is a bug in the caller of `from_usize`)", + tag ); std::hint::unreachable_unchecked() },