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: "expected exactly one expression" #80251

Closed
matthiaskrgr opened this issue Dec 21, 2020 · 6 comments · Fixed by #83814
Closed

ICE: "expected exactly one expression" #80251

matthiaskrgr opened this issue Dec 21, 2020 · 6 comments · Fixed by #83814
Assignees
Labels
A-attributes Area: #[attributes(..)] A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

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`.

@matthiaskrgr matthiaskrgr 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 Dec 21, 2020
@matthiaskrgr
Copy link
Member Author

@rustbot modify labels: +regression-from-stable-to-stable

Had to uninstall ~20 gigs of rustc releases again but since this code does not ICE on 1.20 but ices on 1.48.0, this is a stable-to-stable ice.

@rustbot rustbot added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 21, 2020
@camelid camelid added A-attributes Area: #[attributes(..)] A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Dec 21, 2020
@LeSeulArtichaut
Copy link
Contributor

LeSeulArtichaut commented Dec 21, 2020

This started ICE'ing in 1.30.0.

Error message in 1.29.0:

error[E0658]: attributes on expressions are experimental. (see issue #15701)
 --> <source>:2:13
  |
2 |     let _ = #[test] ();
  |             ^^^^^^^

error: removing an expression is not supported in this position
 --> <source>:2:13
  |
2 |     let _ = #[test] ();
  |             ^^^^^^^

error: aborting due to 2 previous errors

@camelid camelid added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Dec 21, 2020
@camelid
Copy link
Member

camelid commented Dec 21, 2020

This is not supposed to work yet and it gives a good error message saying so -> P-low

Assigning P-low and removing I-prioritize as discussed in the prioritization working group.

@osa1
Copy link
Contributor

osa1 commented Jan 27, 2021

The error message is helpful but it still panics in nightly. Do we want to fix the ICE at least or keep it?

@chengniansun
Copy link

A possible duplicate.

const CR: i32 = #[test]
C;

@petrochenkov
Copy link
Contributor

Fixed in #83814.

@bors bors closed this as completed in 67ffbed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: #[attributes(..)] A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
7 participants