Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE in macro_metavar_expr_concat #131393

Closed
crumblingstatue opened this issue Oct 8, 2024 · 1 comment · May be fixed by #131522
Closed

ICE in macro_metavar_expr_concat #131393

crumblingstatue opened this issue Oct 8, 2024 · 1 comment · May be fixed by #131522
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@crumblingstatue
Copy link
Contributor

Code

#![feature(macro_metavar_expr_concat)]

// paste version included for reference, can be commented out or removed
macro_rules! r_paste {
    ($t:ident $($en:ident)?) => {
        paste::paste! {
            read::<[<$t $($en)?>]>()
        }
    }
}

// Probably not valid usage, but obviously it shouldn't cause an ICE
macro_rules! r_concat {
    ($t:ident $($en:ident)?) => {
        read::<${concat($t, $en)}>()
    }
}

struct u16le;

fn read<T>() {
    
}

fn main() {
    r_paste!(u8);
    r_paste!(u16 le);
    r_concat!(u8);
    r_concat!(u16 le);
}

Meta

rustc --version --verbose:

rustc 1.83.0-nightly (3ae715c8c 2024-10-07)
binary: rustc
commit-hash: 3ae715c8c63f9aeac47cbf7d8d9dadb3fa32c638
commit-date: 2024-10-07
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.1

Error output

thread 'rustc' panicked at compiler/rustc_expand/src/mbe/transcribe.rs:698:63:
called `Option::unwrap()` on a `None` value
Backtrace

   0:     0x7bec75b3594a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hd8f0d1407b3b8899
   1:     0x7bec76203466 - core::fmt::write::hf411bc19ef187626
   2:     0x7bec77420591 - std::io::Write::write_fmt::h9fe7746e7ac11b2b
   3:     0x7bec75b357a2 - std::sys::backtrace::BacktraceLock::print::h241a50c788e7dbe0
   4:     0x7bec75b37c76 - std::panicking::default_hook::{{closure}}::hb89df2c6bb06eab3
   5:     0x7bec75b37ac0 - std::panicking::default_hook::hd88da784341d8173
   6:     0x7bec74beab9f - std[b225c22db7505898]::panicking::update_hook::<alloc[e060cc36c346c01]::boxed::Box<rustc_driver_impl[9c4640f0daa151b4]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7bec75b38388 - std::panicking::rust_panic_with_hook::h16aa6d6c31ae1afe
   8:     0x7bec75b38126 - std::panicking::begin_panic_handler::{{closure}}::hf40b15a26e74665c
   9:     0x7bec75b35df9 - std::sys::backtrace::__rust_end_short_backtrace::ha63b5874988ffb19
  10:     0x7bec75b37e1c - rust_begin_unwind
  11:     0x7bec73595c70 - core::panicking::panic_fmt::hab572b17d227b63d
  12:     0x7bec7346ee9c - core::panicking::panic::h9cbbea0c3e271237
  13:     0x7bec73b6efb9 - core::option::unwrap_failed::hb19494f6a6c93824
  14:     0x7bec72730af6 - <rustc_expand[d70db93bdc7ee376]::expand::MacroExpander>::fully_expand_fragment
  15:     0x7bec7739eacd - <rustc_expand[d70db93bdc7ee376]::expand::MacroExpander>::expand_crate
  16:     0x7bec76708b51 - rustc_interface[e791496ce9706df7]::passes::resolver_for_lowering_raw
  17:     0x7bec767080f5 - rustc_query_impl[cec98a3f89bceaba]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cec98a3f89bceaba]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f6e66c5d05108f4f]::query::erase::Erased<[u8; 16usize]>>
  18:     0x7bec767080e3 - <rustc_query_impl[cec98a3f89bceaba]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[f4521e9068f32b0a]::ops::function::FnOnce<(rustc_middle[f6e66c5d05108f4f]::ty::context::TyCtxt, ())>>::call_once
  19:     0x7bec7713a38d - rustc_query_system[42f51c145ab84848]::query::plumbing::try_execute_query::<rustc_query_impl[cec98a3f89bceaba]::DynamicConfig<rustc_query_system[42f51c145ab84848]::query::caches::SingleCache<rustc_middle[f6e66c5d05108f4f]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[cec98a3f89bceaba]::plumbing::QueryCtxt, true>
  20:     0x7bec77139e0a - rustc_query_impl[cec98a3f89bceaba]::query_impl::resolver_for_lowering_raw::get_query_incr::__rust_end_short_backtrace
  21:     0x7bec76f55b92 - rustc_interface[e791496ce9706df7]::interface::run_compiler::<core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>, rustc_driver_impl[9c4640f0daa151b4]::run_compiler::{closure#0}>::{closure#1}
  22:     0x7bec7700ce90 - std[b225c22db7505898]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e791496ce9706df7]::util::run_in_thread_with_globals<rustc_interface[e791496ce9706df7]::util::run_in_thread_pool_with_globals<rustc_interface[e791496ce9706df7]::interface::run_compiler<core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>, rustc_driver_impl[9c4640f0daa151b4]::run_compiler::{closure#0}>::{closure#1}, core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>>::{closure#0}, core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>>
  23:     0x7bec7700d557 - <<std[b225c22db7505898]::thread::Builder>::spawn_unchecked_<rustc_interface[e791496ce9706df7]::util::run_in_thread_with_globals<rustc_interface[e791496ce9706df7]::util::run_in_thread_pool_with_globals<rustc_interface[e791496ce9706df7]::interface::run_compiler<core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>, rustc_driver_impl[9c4640f0daa151b4]::run_compiler::{closure#0}>::{closure#1}, core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>>::{closure#0}, core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f4521e9068f32b0a]::result::Result<(), rustc_span[13130a1ca6fd67da]::ErrorGuaranteed>>::{closure#1} as core[f4521e9068f32b0a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7bec7700e441 - std::sys::pal::unix::thread::Thread::new::thread_start::h38e396ea274cc7c9

Tracking issue for macro_metavar_expr_concat: #124225

@crumblingstatue crumblingstatue added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 8, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 8, 2024
@matthiaskrgr
Copy link
Member

probably duplicate of #128346

@matthiaskrgr matthiaskrgr closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants