Skip to content

ICE: attr None #131759

Closed
Closed
@matthiaskrgr

Description

@matthiaskrgr
Member

auto-reduced (treereduce-rust):

#[cfg(not(any(all(target(i128::MIN, true)))))]

fn main() {}

original:

#[cfg(target(os = "linux"))] //~ ERROR compact `cfg(target(..))` is experimental
struct Foo(u64, f64)

#[cfg_attr(target(os = "linux"), non_exhaustive)] //~ ERROR compact `cfg(target(..))` is experimental
struct Bar(u64, u64);

#[cfg(not(any(all(target(i128::MIN, true)))))] //~ ERROR compact `cfg(target(..))` is experimental
fn foo() {}

fn main() {
    let f: fn() -> Box<dyn Iterator<Item = u8>> = || Box::new(gen_fn());
    assert_eq!(f().next(), Some(6));
}

Version information

rustc 1.84.0-nightly (a0c2aba29 2024-10-15)
binary: rustc
commit-hash: a0c2aba29aa9ea50a7c45c3391dd446f856bef7b
commit-date: 2024-10-15
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1

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

Program output

error[E0658]: compact `cfg(target(..))` is experimental and subject to change
 --> /tmp/icemaker_global_tempdir.N28BKWiTeWPn/rustc_testrunner_tmpdir_reporting.DIs4hC4AtRX2/mvce.rs:1:19
  |
1 | #[cfg(not(any(all(target(i128::MIN, true)))))]
  |                   ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #96901 <https://github.com/rust-lang/rust/issues/96901> for more information
  = help: add `#![feature(cfg_target_compact)]` to the crate attributes to enable
  = note: this compiler was built on 2024-10-15; consider upgrading it if it is out of date

error: `cfg` predicate key must be an identifier
 --> /tmp/icemaker_global_tempdir.N28BKWiTeWPn/rustc_testrunner_tmpdir_reporting.DIs4hC4AtRX2/mvce.rs:1:26
  |
1 | #[cfg(not(any(all(target(i128::MIN, true)))))]
  |                          ^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_attr/src/builtin.rs:726:53:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x75819c07377a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h390c6245de649a12
   1:     0x75819c80398a - core::fmt::write::h866a31ba09394586
   2:     0x75819dba6751 - std::io::Write::write_fmt::h1bd6164a2ca8262e
   3:     0x75819c0735d2 - std::sys::backtrace::BacktraceLock::print::hd27dbf205e73f88a
   4:     0x75819c075ab6 - std::panicking::default_hook::{{closure}}::h4f636451ba8b5ef6
   5:     0x75819c075900 - std::panicking::default_hook::hd1b1a58948a85a4a
   6:     0x75819b0f70af - std[358004a43e0a8d13]::panicking::update_hook::<alloc[578f5aba64ed82e]::boxed::Box<rustc_driver_impl[9beb6d2d9a098eaa]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x75819c0761c8 - std::panicking::rust_panic_with_hook::h00d0b0e0c911f9f5
   8:     0x75819c075f66 - std::panicking::begin_panic_handler::{{closure}}::h3644c9bdaa1c5be2
   9:     0x75819c073c29 - std::sys::backtrace::__rust_end_short_backtrace::h16b8efef09ea13d9
  10:     0x75819c075c5c - rust_begin_unwind
  11:     0x758199989900 - core::panicking::panic_fmt::hc97e9a3e5a0bc98b
  12:     0x75819952df3c - core::panicking::panic::h2c426f91196b9622
  13:     0x75819a0e3e89 - core::option::unwrap_failed::h6dfeef268bbac9af
  14:     0x75819d3b3cda - rustc_attr[9996a2fd39e5e57]::builtin::eval_condition::<rustc_attr[9996a2fd39e5e57]::builtin::cfg_matches::{closure#0}>
  15:     0x75819d3b3105 - rustc_attr[9996a2fd39e5e57]::builtin::eval_condition::<rustc_attr[9996a2fd39e5e57]::builtin::cfg_matches::{closure#0}>
  16:     0x75819d3b3072 - rustc_attr[9996a2fd39e5e57]::builtin::eval_condition::<rustc_attr[9996a2fd39e5e57]::builtin::cfg_matches::{closure#0}>
  17:     0x75819d3b2e69 - <rustc_expand[c8f989f3b47fb755]::config::StripUnconfigured>::cfg_true
  18:     0x75819d024a86 - <rustc_expand[c8f989f3b47fb755]::expand::InvocationCollector as rustc_ast[f45b22bab05e21f3]::mut_visit::MutVisitor>::flat_map_item
  19:     0x75819d023569 - <rustc_expand[c8f989f3b47fb755]::expand::InvocationCollector as rustc_ast[f45b22bab05e21f3]::mut_visit::MutVisitor>::visit_crate
  20:     0x75819a7323d1 - <rustc_expand[c8f989f3b47fb755]::expand::MacroExpander>::collect_invocations
  21:     0x758198b2a929 - <rustc_expand[c8f989f3b47fb755]::expand::MacroExpander>::fully_expand_fragment
  22:     0x75819d9d854d - <rustc_expand[c8f989f3b47fb755]::expand::MacroExpander>::expand_crate
  23:     0x75819cc4ed51 - rustc_interface[4f4330e0939c819]::passes::resolver_for_lowering_raw
  24:     0x75819cc4e2db - rustc_query_impl[16736231d1f5ebef]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[16736231d1f5ebef]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[980f7e873ecf1275]::query::erase::Erased<[u8; 16usize]>>
  25:     0x75819cc4e2c9 - <rustc_query_impl[16736231d1f5ebef]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[9fbb0d406331042b]::ops::function::FnOnce<(rustc_middle[980f7e873ecf1275]::ty::context::TyCtxt, ())>>::call_once
  26:     0x75819d703a06 - rustc_query_system[5473b42295b1a067]::query::plumbing::try_execute_query::<rustc_query_impl[16736231d1f5ebef]::DynamicConfig<rustc_query_system[5473b42295b1a067]::query::caches::SingleCache<rustc_middle[980f7e873ecf1275]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[16736231d1f5ebef]::plumbing::QueryCtxt, false>
  27:     0x75819d7036a1 - rustc_query_impl[16736231d1f5ebef]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  28:     0x75819d57cbd2 - rustc_interface[4f4330e0939c819]::interface::run_compiler::<core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>, rustc_driver_impl[9beb6d2d9a098eaa]::run_compiler::{closure#0}>::{closure#1}
  29:     0x75819d618a14 - std[358004a43e0a8d13]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4f4330e0939c819]::util::run_in_thread_with_globals<rustc_interface[4f4330e0939c819]::util::run_in_thread_pool_with_globals<rustc_interface[4f4330e0939c819]::interface::run_compiler<core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>, rustc_driver_impl[9beb6d2d9a098eaa]::run_compiler::{closure#0}>::{closure#1}, core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>>::{closure#0}, core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>>
  30:     0x75819d618e28 - <<std[358004a43e0a8d13]::thread::Builder>::spawn_unchecked_<rustc_interface[4f4330e0939c819]::util::run_in_thread_with_globals<rustc_interface[4f4330e0939c819]::util::run_in_thread_pool_with_globals<rustc_interface[4f4330e0939c819]::interface::run_compiler<core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>, rustc_driver_impl[9beb6d2d9a098eaa]::run_compiler::{closure#0}>::{closure#1}, core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>>::{closure#0}, core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9fbb0d406331042b]::result::Result<(), rustc_span[ce8abf2fafbd4049]::ErrorGuaranteed>>::{closure#1} as core[9fbb0d406331042b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x75819d6198eb - std::sys::pal::unix::thread::Thread::new::thread_start::hf51e3212cfb0892f
  32:     0x75819ee0739d - <unknown>
  33:     0x75819ee8c49c - <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.84.0-nightly (a0c2aba29 2024-10-15) 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 2 previous errors

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

Activity

added
A-attributesArea: Attributes (`#[…]`, `#![…]`)
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.
on Oct 15, 2024
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 15, 2024
matthiaskrgr

matthiaskrgr commented on Oct 15, 2024

@matthiaskrgr
MemberAuthor

mvce

#[cfg(target(i128::MIN, true))]
fn main() {}
matthiaskrgr

matthiaskrgr commented on Oct 15, 2024

@matthiaskrgr
MemberAuthor

bisects to #131034 cc @Urgau ^^'

added
S-has-bisectionStatus: A bisection has been found for this issue
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 16, 2024
added a commit that references this issue on Oct 16, 2024

Rollup merge of rust-lang#131771 - Urgau:cfg-target-131759, r=jieyouxu

e0e1e35
added a commit that references this issue on Oct 16, 2024
fbbc0df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-bisectionStatus: A bisection has been found for this issueT-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

      Participants

      @matthiaskrgr@jieyouxu@rustbot

      Issue actions

        ICE: attr `None` · Issue #131759 · rust-lang/rust