Skip to content

ICE: "expected exactly one expression" #80251

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

fn main() {
    let _ = #[test] ();
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (1f5bc176b 2020-12-19)

Error output

error[E0658]: attributes on expressions are experimental
 --> ./src/test/compile-fail/cfg-non-opt-expr.rs:3:13
  |
3 |     let _ = #[test] ();
  |             ^^^^^^^
  |
  = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
  = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

thread 'rustc' panicked at 'expected exactly one expression', compiler/rustc_expand/src/expand.rs:277:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: 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.50.0-nightly (1f5bc176b 2020-12-19) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error

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

error[E0658]: attributes on expressions are experimental
 --> ./src/test/compile-fail/cfg-non-opt-expr.rs:3:13
  |
3 |     let _ = #[test] ();
  |             ^^^^^^^
  |
  = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
  = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

thread 'rustc' panicked at 'expected exactly one expression', compiler/rustc_expand/src/expand.rs:277:30
stack backtrace:
   0:     0x7f93b0be36c7 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f93b0be36c7 - std::backtrace_rs::backtrace::trace_unsynchronized::h84373278bfb39e0c
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f93b0be36c7 - std::sys_common::backtrace::_print_fmt::h517324efde750597
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f93b0be36c7 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf594ab77fac89284
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f93b0c5428c - core::fmt::write::h3868db8542c90941
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f93b0bd5592 - std::io::Write::write_fmt::h3f6656f045fa877f
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/io/mod.rs:1519:15
   6:     0x7f93b0be73b5 - std::sys_common::backtrace::_print::hda7655c057c24dcc
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f93b0be73b5 - std::sys_common::backtrace::print::h546a6c8431d46287
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f93b0be73b5 - std::panicking::default_hook::{{closure}}::h006dd083853faf51
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:208:50
   9:     0x7f93b0be6f0a - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:225:9
  10:     0x7f93b1487ea8 - rustc_driver::report_ice::h956234bae73e460f
  11:     0x7f93b0be7cb6 - std::panicking::rust_panic_with_hook::hb7a19826c029b1d6
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:595:17
  12:     0x7f93b0be77d7 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:497:13
  13:     0x7f93b0be3b8c - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f93b0be7739 - rust_begin_unwind
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/panicking.rs:493:5
  15:     0x7f93b0c506a1 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/core/src/panicking.rs:92:14
  16:     0x7f93b0c50283 - core::option::expect_failed::h8be1ca96ca0d69ca
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/core/src/option.rs:1260:5
  17:     0x7f93b351fbd3 - rustc_expand::expand::AstFragmentKind::expect_from_annotatables::h05fc875ee2cd0717
  18:     0x7f93b3522cfd - rustc_expand::expand::MacroExpander::fully_expand_fragment::he26fff039b78329f
  19:     0x7f93b3520d8e - rustc_expand::expand::MacroExpander::expand_crate::hd5614e1080b391fe
  20:     0x7f93b16bf498 - rustc_session::utils::<impl rustc_session::session::Session>::time::h2ca8885ebbb2a4d1
  21:     0x7f93b16fe248 - rustc_interface::passes::configure_and_expand_inner::h90f77254651e066c
  22:     0x7f93b16b7697 - rustc_interface::passes::configure_and_expand::{{closure}}::h711307f1fc684295
  23:     0x7f93b16a87cf - rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new::h2878e50656ccab01
  24:     0x7f93b16fd488 - rustc_interface::passes::configure_and_expand::ha44c525d7e0c6049
  25:     0x7f93b175a52f - rustc_interface::queries::Queries::expansion::h3a59c340f40b4f2f
  26:     0x7f93b14f5751 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h58cc75bad344bc3b
  27:     0x7f93b14b1597 - rustc_span::with_source_map::hb087a1c2bc75d8e9
  28:     0x7f93b14f6f8b - rustc_interface::interface::create_compiler_and_run::ha492945fb183c01e
  29:     0x7f93b14c5530 - scoped_tls::ScopedKey<T>::set::hf41307147817b997
  30:     0x7f93b14d67c7 - std::sys_common::backtrace::__rust_begin_short_backtrace::h645f3b510f7fe2fd
  31:     0x7f93b144b7ea - core::ops::function::FnOnce::call_once{{vtable.shim}}::h19b1a0a715ec4eae
  32:     0x7f93b0bf77ba - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/alloc/src/boxed.rs:1328:9
  33:     0x7f93b0bf77ba - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/alloc/src/boxed.rs:1328:9
  34:     0x7f93b0bf77ba - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/1f5bc176b0e54a8e464704adcd7e571700207fe9/library/std/src/sys/unix/thread.rs:71:17
  35:     0x7f93b0ae83e9 - start_thread
  36:     0x7f93b0a05293 - __GI___clone
  37:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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.50.0-nightly (1f5bc176b 2020-12-19) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error

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

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions