Skip to content

ICE: expected exactly one expression #111749

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

macro_rules! cbor_map {
    ($key:expr) => {
        $key.signum();
    };
}

fn main() {
    cbor_map! { #[test(test)] 4};
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (d3f416dc0 2023-05-18)
binary: rustc
commit-hash: d3f416dc063fc478c7250873246cb2d4136d8c42
commit-date: 2023-05-18
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.4

Error output

<output>
Backtrace

thread 'rustc' panicked at 'expected exactly one expression', compiler/rustc_expand/src/expand.rs:308:30
stack backtrace:
   0:     0x7f36d07696f1 - std::backtrace_rs::backtrace::libunwind::trace::ha0547a5335ba6eb8
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f36d07696f1 - std::backtrace_rs::backtrace::trace_unsynchronized::h597700f2649fb43a
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f36d07696f1 - std::sys_common::backtrace::_print_fmt::ha306a728a864b1ec
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f36d07696f1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h60926fa2ed907188
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f36d07c9bef - core::fmt::rt::Argument::fmt::hbfab9f7ca3ec46a1
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/core/src/fmt/rt.rs:138:9
   5:     0x7f36d07c9bef - core::fmt::write::he942607094ccdb30
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f36d075c9f1 - std::io::Write::write_fmt::hf8f718f51475564f
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/io/mod.rs:1712:15
   7:     0x7f36d0769505 - std::sys_common::backtrace::_print::h069f307f286f01b8
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f36d0769505 - std::sys_common::backtrace::print::h3024c4761bf76173
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f36d076c177 - std::panicking::default_hook::{{closure}}::h32ba135d303524b9
  10:     0x7f36d076bf64 - std::panicking::default_hook::hd5920ecdc023cc57
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/panicking.rs:288:9
  11:     0x7f36d38d338b - rustc_driver_impl[11297d21f3442eb3]::install_ice_hook::{closure#0}
  12:     0x7f36d076c897 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h50fbac85275e3d54
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/alloc/src/boxed.rs:1999:9
  13:     0x7f36d076c897 - std::panicking::rust_panic_with_hook::h904e506787ae7ee1
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/panicking.rs:695:13
  14:     0x7f36d076c617 - std::panicking::begin_panic_handler::{{closure}}::h5222fe796d39ff56
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/panicking.rs:582:13
  15:     0x7f36d0769b26 - std::sys_common::backtrace::__rust_end_short_backtrace::h7a1e0e290e329ce5
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f36d076c382 - rust_begin_unwind
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/panicking.rs:578:5
  17:     0x7f36d07c5e73 - core::panicking::panic_fmt::hbfb35e1471f52240
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/core/src/panicking.rs:67:14
  18:     0x7f36d07c5be3 - core::panicking::panic_display::h2d7011a26ee5dcbe
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/core/src/panicking.rs:150:5
  19:     0x7f36d07c5be3 - core::panicking::panic_str::hb88b6546f0fb14e2
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/core/src/panicking.rs:134:5
  20:     0x7f36d07c5be3 - core::option::expect_failed::h729fc13c8d4d788f
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/core/src/option.rs:1932:5
  21:     0x7f36d25cc935 - <rustc_expand[71acc567b1798896]::expand::AstFragmentKind>::expect_from_annotatables::<alloc[fc4b4bc0698cdd67]::vec::Vec<rustc_expand[71acc567b1798896]::base::Annotatable>>
  22:     0x7f36d25bc0fc - <rustc_expand[71acc567b1798896]::expand::MacroExpander>::fully_expand_fragment
  23:     0x7f36d296591b - <rustc_expand[71acc567b1798896]::expand::MacroExpander>::expand_crate
  24:     0x7f36d2964921 - <rustc_session[81c0ead03495bb02]::session::Session>::time::<rustc_ast[b603ac21411ab182]::ast::Crate, rustc_interface[bf9d7b52826e2146]::passes::configure_and_expand::{closure#1}>
  25:     0x7f36d295e4fe - rustc_interface[bf9d7b52826e2146]::passes::resolver_for_lowering
  26:     0x7f36d2e1699a - rustc_query_impl[c44f9c9108d77c0f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c44f9c9108d77c0f]::dynamic_query::resolver_for_lowering::{closure#2}::{closure#0}, rustc_middle[4996dda2e843c480]::query::erase::Erased<[u8; 8usize]>>
  27:     0x7f36d2e16989 - <rustc_query_impl[c44f9c9108d77c0f]::dynamic_query::resolver_for_lowering::{closure#2} as core[4434429b7305d0b8]::ops::function::FnOnce<(rustc_middle[4996dda2e843c480]::ty::context::TyCtxt, ())>>::call_once
  28:     0x7f36d2d922bd - rustc_query_system[af5f8ea193900a95]::query::plumbing::try_execute_query::<rustc_query_impl[c44f9c9108d77c0f]::DynamicConfig<rustc_query_system[af5f8ea193900a95]::query::caches::SingleCache<rustc_middle[4996dda2e843c480]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c44f9c9108d77c0f]::plumbing::QueryCtxt, false>
  29:     0x7f36d32a12a7 - rustc_query_impl[c44f9c9108d77c0f]::get_query_non_incr::resolver_for_lowering::__rust_end_short_backtrace
  30:     0x7f36d2fbe73f - <rustc_middle[4996dda2e843c480]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[11297d21f3442eb3]::run_compiler::{closure#1}::{closure#2}::{closure#2}, &rustc_data_structures[b08b489b4cdf5f63]::steal::Steal<(rustc_middle[4996dda2e843c480]::ty::ResolverAstLowering, alloc[fc4b4bc0698cdd67]::rc::Rc<rustc_ast[b603ac21411ab182]::ast::Crate>)>>
  31:     0x7f36d2b67df5 - <rustc_interface[bf9d7b52826e2146]::interface::Compiler>::enter::<rustc_driver_impl[11297d21f3442eb3]::run_compiler::{closure#1}::{closure#2}, core[4434429b7305d0b8]::result::Result<core[4434429b7305d0b8]::option::Option<rustc_interface[bf9d7b52826e2146]::queries::Linker>, rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>>
  32:     0x7f36d2b65bfd - <scoped_tls[32a73cfd30817de0]::ScopedKey<rustc_span[ee77a0ef2703f5aa]::SessionGlobals>>::set::<rustc_interface[bf9d7b52826e2146]::interface::run_compiler<core[4434429b7305d0b8]::result::Result<(), rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>, rustc_driver_impl[11297d21f3442eb3]::run_compiler::{closure#1}>::{closure#0}, core[4434429b7305d0b8]::result::Result<(), rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>>
  33:     0x7f36d2b65056 - std[bc266c592f396f35]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[bf9d7b52826e2146]::util::run_in_thread_pool_with_globals<rustc_interface[bf9d7b52826e2146]::interface::run_compiler<core[4434429b7305d0b8]::result::Result<(), rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>, rustc_driver_impl[11297d21f3442eb3]::run_compiler::{closure#1}>::{closure#0}, core[4434429b7305d0b8]::result::Result<(), rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4434429b7305d0b8]::result::Result<(), rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>>
  34:     0x7f36d3194265 - <<std[bc266c592f396f35]::thread::Builder>::spawn_unchecked_<rustc_interface[bf9d7b52826e2146]::util::run_in_thread_pool_with_globals<rustc_interface[bf9d7b52826e2146]::interface::run_compiler<core[4434429b7305d0b8]::result::Result<(), rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>, rustc_driver_impl[11297d21f3442eb3]::run_compiler::{closure#1}>::{closure#0}, core[4434429b7305d0b8]::result::Result<(), rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4434429b7305d0b8]::result::Result<(), rustc_span[ee77a0ef2703f5aa]::ErrorGuaranteed>>::{closure#1} as core[4434429b7305d0b8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:     0x7f36d0776d45 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h284ea0362d17b1a9
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/alloc/src/boxed.rs:1985:9
  36:     0x7f36d0776d45 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4cdb6c0705a7967c
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/alloc/src/boxed.rs:1985:9
  37:     0x7f36d0776d45 - std::sys::unix::thread::Thread::new::thread_start::hca4af62dde160e36
                               at /rustc/d3f416dc063fc478c7250873246cb2d4136d8c42/library/std/src/sys/unix/thread.rs:108:17
  38:     0x7f36d04dabb5 - <unknown>
  39:     0x7f36d055cd90 - <unknown>
  40:                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: rustc 1.71.0-nightly (d3f416dc0 2023-05-18) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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