Skip to content

ICE: transcribe: None #128346

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

macro_rules! one_rep {
    ( $($a:ident)* ) => {
        A(
            const ${concat($a, Z)}: i32 = 3;
        )*
    };
}

fn main() {
    one_rep!(A B C);
}

original:

#![feature(macro_metavar_expr_concat)]

macro_rules! one_rep {
    ( $($a:ident)* ) => {
        A(
            const ${concat($a, Z)}: i32 = 3;
        )*
    };
}

fn main() {
    one_rep!(A B C);
    assert_eq!(AZ, 3);
    assert_eq!{
        $(
            const ${concat($a, Z)}: i32 = 3;
        )*
    };
    assert_eq!(CZ, 3);
}

Version information

rustc 1.82.0-nightly (a5ee5cbad 2024-07-29)
binary: rustc
commit-hash: a5ee5cbad1dde83dde61959e9436716094e3408c
commit-date: 2024-07-29
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0658]: the `concat` meta-variable expression is unstable
 --> /tmp/icemaker_global_tempdir.FDR6hVZZQzAl/rustc_testrunner_tmpdir_reporting.TfJpwWG3aR5f/mvce.rs:4:20
  |
4 |             const ${concat($a, Z)}: i32 = 3;
  |                    ^^^^^^^^^^^^^^^
  |
  = note: see issue #124225 <https://github.com/rust-lang/rust/issues/124225> for more information
  = help: add `#![feature(macro_metavar_expr_concat)]` to the crate attributes to enable
  = note: this compiler was built on 2024-07-29; consider upgrading it if it is out of date

thread 'rustc' panicked at compiler/rustc_expand/src/mbe/transcribe.rs:698:63:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x796dd2857055 - std::backtrace_rs::backtrace::libunwind::trace::h5200c2caec84f42d
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x796dd2857055 - std::backtrace_rs::backtrace::trace_unsynchronized::he7c3f8fab4bfbd07
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x796dd2857055 - std::sys::backtrace::_print_fmt::hd631a028372816d9
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/sys/backtrace.rs:66:9
   3:     0x796dd2857055 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::he0a1eeb2110733a8
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/sys/backtrace.rs:39:26
   4:     0x796dd28a7f2b - core::fmt::rt::Argument::fmt::h5f59e0ff9c29f201
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/core/src/fmt/rt.rs:173:76
   5:     0x796dd28a7f2b - core::fmt::write::h40fd57865b73e8d1
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/core/src/fmt/mod.rs:1178:21
   6:     0x796dd284b94f - std::io::Write::write_fmt::ha91da9d1116ba39c
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/io/mod.rs:1823:15
   7:     0x796dd28598f1 - std::sys::backtrace::BacktraceLock::print::h5bc1e8aea4432fca
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/sys/backtrace.rs:42:9
   8:     0x796dd28598f1 - std::panicking::default_hook::{{closure}}::h7ac8a47d098eca56
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/panicking.rs:266:22
   9:     0x796dd28595cc - std::panicking::default_hook::h23ba2c1fd8c8a801
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/panicking.rs:293:9
  10:     0x796dcec39279 - std[ccabb9a6d43d485f]::panicking::update_hook::<alloc[f8f6e0ead239af4d]::boxed::Box<rustc_driver_impl[31237189629bb2ae]::install_ice_hook::{closure#0}>>::{closure#0}
  11:     0x796dd285a2bf - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h01ae6a2308bc025d
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/alloc/src/boxed.rs:2162:9
  12:     0x796dd285a2bf - std::panicking::rust_panic_with_hook::ha5fda6924ae6df7c
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/panicking.rs:805:13
  13:     0x796dd2859eb3 - std::panicking::begin_panic_handler::{{closure}}::h30d298a80e866e15
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/panicking.rs:664:13
  14:     0x796dd2857519 - std::sys::backtrace::__rust_end_short_backtrace::hb93e9e8450183be8
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/sys/backtrace.rs:170:18
  15:     0x796dd2859b74 - rust_begin_unwind
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/panicking.rs:662:5
  16:     0x796dd28a44f3 - core::panicking::panic_fmt::h1f4e0c5152ffe5e0
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/core/src/panicking.rs:74:14
  17:     0x796dd28a457c - core::panicking::panic::h16d496a9254bba48
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/core/src/panicking.rs:148:5
  18:     0x796dd28a42e9 - core::option::unwrap_failed::h2566b8f64654f995
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/core/src/option.rs:2017:5
  19:     0x796dcc860028 - <rustc_expand[34e14bfb072448c]::expand::MacroExpander>::fully_expand_fragment
  20:     0x796dd0cc87d8 - <rustc_expand[34e14bfb072448c]::expand::MacroExpander>::expand_crate
  21:     0x796dd05746f3 - rustc_interface[539f3934048b9842]::passes::resolver_for_lowering_raw
  22:     0x796dd0573cb1 - rustc_query_impl[bbbbf68942f8fd9d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bbbbf68942f8fd9d]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cb63de5e900177d3]::query::erase::Erased<[u8; 16usize]>>
  23:     0x796dd0573c9f - <rustc_query_impl[bbbbf68942f8fd9d]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[52a599b2714c5040]::ops::function::FnOnce<(rustc_middle[cb63de5e900177d3]::ty::context::TyCtxt, ())>>::call_once
  24:     0x796dd107215d - rustc_query_system[85ec09cc279e17de]::query::plumbing::try_execute_query::<rustc_query_impl[bbbbf68942f8fd9d]::DynamicConfig<rustc_query_system[85ec09cc279e17de]::query::caches::SingleCache<rustc_middle[cb63de5e900177d3]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bbbbf68942f8fd9d]::plumbing::QueryCtxt, false>
  25:     0x796dd1071df7 - rustc_query_impl[bbbbf68942f8fd9d]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  26:     0x796dd0f45963 - rustc_interface[539f3934048b9842]::interface::run_compiler::<core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>, rustc_driver_impl[31237189629bb2ae]::run_compiler::{closure#0}>::{closure#1}
  27:     0x796dd0f1be89 - std[ccabb9a6d43d485f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[539f3934048b9842]::util::run_in_thread_with_globals<rustc_interface[539f3934048b9842]::util::run_in_thread_pool_with_globals<rustc_interface[539f3934048b9842]::interface::run_compiler<core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>, rustc_driver_impl[31237189629bb2ae]::run_compiler::{closure#0}>::{closure#1}, core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>>::{closure#0}, core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>>
  28:     0x796dd0f1bc3a - <<std[ccabb9a6d43d485f]::thread::Builder>::spawn_unchecked_<rustc_interface[539f3934048b9842]::util::run_in_thread_with_globals<rustc_interface[539f3934048b9842]::util::run_in_thread_pool_with_globals<rustc_interface[539f3934048b9842]::interface::run_compiler<core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>, rustc_driver_impl[31237189629bb2ae]::run_compiler::{closure#0}>::{closure#1}, core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>>::{closure#0}, core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[52a599b2714c5040]::result::Result<(), rustc_span[155dece38b7eea75]::ErrorGuaranteed>>::{closure#1} as core[52a599b2714c5040]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x796dd286420b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4c8f9bb98b743875
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/alloc/src/boxed.rs:2148:9
  30:     0x796dd286420b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2598fa8752cf32b5
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/alloc/src/boxed.rs:2148:9
  31:     0x796dd286420b - std::sys::pal::unix::thread::Thread::new::thread_start::hcc536d54f273dcc2
                               at /rustc/a5ee5cbad1dde83dde61959e9436716094e3408c/library/std/src/sys/pal/unix/thread.rs:105:17
  32:     0x796dd25f7ded - <unknown>
  33:     0x796dd267b0dc - <unknown>
  34:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.82.0-nightly (a5ee5cbad 2024-07-29) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0658`.

@rustbot label +F-macro_metavar_expr_concat

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-macro_metavar_expr_concat`#![feature(macro_metavar_expr_concat)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions