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: builtin attribute "cfg_attr" not handled by CheckAttrVisitor #128716

Closed
matthiaskrgr opened this issue Aug 6, 2024 · 0 comments · Fixed by #128718
Closed

ICE: builtin attribute "cfg_attr" not handled by CheckAttrVisitor #128716

matthiaskrgr opened this issue Aug 6, 2024 · 0 comments · Fixed by #128718
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) 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

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#[cfg_attr::skip]
fn main() {}

original:

//@ revisions: feature gated

#![cfg_attr(feature, feature(lazy_type_alias))]
#![allow(incomplete_features)]

type X = Vec<X>;
//[gated]~^ ERROR cycle detected
//[feature]~^^ ERROR: overflow normalizing the type alias `X`

#[cfg_attr::skip]
fn main() { let b: X = b::lazy_type_alias(); }

Version information

rustc 1.82.0-nightly (b586701f7 2024-08-05)
binary: rustc
commit-hash: b586701f78a6d5c7f618b76e7ae3cace9a6fbf37
commit-date: 2024-08-05
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

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

Program output

error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
 --> /tmp/icemaker_global_tempdir.ua4jR8LHGY53/rustc_testrunner_tmpdir_reporting.q5SQCEnEcl5a/mvce.rs:1:3
  |
1 | #[cfg_attr::skip]
  |   ^^^^^^^^ use of undeclared crate or module `cfg_attr`

error: internal compiler error: compiler/rustc_passes/src/check_attr.rs:287:33: builtin attribute "cfg_attr" not handled by `CheckAttrVisitor`
 --> /tmp/icemaker_global_tempdir.ua4jR8LHGY53/rustc_testrunner_tmpdir_reporting.q5SQCEnEcl5a/mvce.rs:1:1
  |
1 | #[cfg_attr::skip]
  | ^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_passes/src/check_attr.rs:287:33:
Box<dyn Any>
stack backtrace:
   0:     0x7c8f65f56f5d - std::backtrace_rs::backtrace::libunwind::trace::h54121657fad6b938
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7c8f65f56f5d - std::backtrace_rs::backtrace::trace_unsynchronized::hd2e82ea9904f2ea9
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7c8f65f56f5d - std::sys::backtrace::_print_fmt::h75adf07dfa40e5d2
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/backtrace.rs:66:9
   3:     0x7c8f65f56f5d - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h98e5ee4b224fe254
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/backtrace.rs:39:26
   4:     0x7c8f65fa76eb - core::fmt::rt::Argument::fmt::h0835d2bcbbdcecae
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/core/src/fmt/rt.rs:173:76
   5:     0x7c8f65fa76eb - core::fmt::write::h41425652aafb8d55
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/core/src/fmt/mod.rs:1178:21
   6:     0x7c8f65f4acc3 - std::io::Write::write_fmt::h722492c13c12a6df
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/io/mod.rs:1823:15
   7:     0x7c8f65f59752 - std::sys::backtrace::BacktraceLock::print::hcfe3c665d987f44a
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/backtrace.rs:42:9
   8:     0x7c8f65f59752 - std::panicking::default_hook::{{closure}}::h73b850e758a43b44
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/panicking.rs:266:22
   9:     0x7c8f65f593be - std::panicking::default_hook::h0ed5c4bdc6aad088
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/panicking.rs:293:9
  10:     0x7c8f62498bf7 - std[5068228d6f0dc02a]::panicking::update_hook::<alloc[8fcb41ef64dc878b]::boxed::Box<rustc_driver_impl[b43ed4103cc78677]::install_ice_hook::{closure#0}>>::{closure#0}
  11:     0x7c8f65f5a142 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h88c4c4826ca7daef
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/alloc/src/boxed.rs:2164:9
  12:     0x7c8f65f5a142 - std::panicking::rust_panic_with_hook::h9849dc0f6b06d65d
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/panicking.rs:805:13
  13:     0x7c8f624d40c1 - std[5068228d6f0dc02a]::panicking::begin_panic::<rustc_errors[1c74d9fcab0bdd42]::ExplicitBug>::{closure#0}
  14:     0x7c8f624c6dd6 - std[5068228d6f0dc02a]::sys::backtrace::__rust_end_short_backtrace::<std[5068228d6f0dc02a]::panicking::begin_panic<rustc_errors[1c74d9fcab0bdd42]::ExplicitBug>::{closure#0}, !>
  15:     0x7c8f624c1eb6 - std[5068228d6f0dc02a]::panicking::begin_panic::<rustc_errors[1c74d9fcab0bdd42]::ExplicitBug>
  16:     0x7c8f624dd331 - <rustc_errors[1c74d9fcab0bdd42]::diagnostic::BugAbort as rustc_errors[1c74d9fcab0bdd42]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  17:     0x7c8f62d2853d - <rustc_errors[1c74d9fcab0bdd42]::DiagCtxtHandle>::span_bug::<rustc_span[6b6bb1cd45519793]::span_encoding::Span, alloc[8fcb41ef64dc878b]::string::String>
  18:     0x7c8f62d44ed8 - rustc_middle[6ed3e96e78853911]::util::bug::opt_span_bug_fmt::<rustc_span[6b6bb1cd45519793]::span_encoding::Span>::{closure#0}
  19:     0x7c8f62d44f0a - rustc_middle[6ed3e96e78853911]::ty::context::tls::with_opt::<rustc_middle[6ed3e96e78853911]::util::bug::opt_span_bug_fmt<rustc_span[6b6bb1cd45519793]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7c8f62d3804b - rustc_middle[6ed3e96e78853911]::ty::context::tls::with_context_opt::<rustc_middle[6ed3e96e78853911]::ty::context::tls::with_opt<rustc_middle[6ed3e96e78853911]::util::bug::opt_span_bug_fmt<rustc_span[6b6bb1cd45519793]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7c8f62d361f7 - rustc_middle[6ed3e96e78853911]::util::bug::span_bug_fmt::<rustc_span[6b6bb1cd45519793]::span_encoding::Span>
  22:     0x7c8f63c5a60f - <rustc_passes[267b2ef4b868bd78]::check_attr::CheckAttrVisitor>::check_attributes
  23:     0x7c8f63c56d3a - <rustc_passes[267b2ef4b868bd78]::check_attr::CheckAttrVisitor as rustc_hir[62b307f3adfb02d2]::intravisit::Visitor>::visit_item
  24:     0x7c8f63c560c0 - rustc_passes[267b2ef4b868bd78]::check_attr::check_mod_attrs
  25:     0x7c8f63c5603b - rustc_query_impl[bae30e77a033ddc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bae30e77a033ddc]::query_impl::check_mod_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6ed3e96e78853911]::query::erase::Erased<[u8; 0usize]>>
  26:     0x7c8f645cd436 - rustc_query_system[9eda3ab91ed39e2e]::query::plumbing::try_execute_query::<rustc_query_impl[bae30e77a033ddc]::DynamicConfig<rustc_query_system[9eda3ab91ed39e2e]::query::caches::DefaultCache<rustc_span[6b6bb1cd45519793]::def_id::LocalModDefId, rustc_middle[6ed3e96e78853911]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[bae30e77a033ddc]::plumbing::QueryCtxt, false>
  27:     0x7c8f645cd159 - rustc_query_impl[bae30e77a033ddc]::query_impl::check_mod_attrs::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7c8f645ccc13 - <rustc_middle[6ed3e96e78853911]::hir::map::Map>::par_for_each_module::<rustc_interface[dcf23a6b0366e6de]::passes::run_required_analyses::{closure#0}::{closure#0}::{closure#1}::{closure#0}>::{closure#0}
  29:     0x7c8f63d84f3c - rustc_interface[dcf23a6b0366e6de]::passes::analysis
  30:     0x7c8f63d84c07 - rustc_query_impl[bae30e77a033ddc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bae30e77a033ddc]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6ed3e96e78853911]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7c8f649a816e - rustc_query_system[9eda3ab91ed39e2e]::query::plumbing::try_execute_query::<rustc_query_impl[bae30e77a033ddc]::DynamicConfig<rustc_query_system[9eda3ab91ed39e2e]::query::caches::SingleCache<rustc_middle[6ed3e96e78853911]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bae30e77a033ddc]::plumbing::QueryCtxt, false>
  32:     0x7c8f649a7ecf - rustc_query_impl[bae30e77a033ddc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7c8f648adc23 - rustc_interface[dcf23a6b0366e6de]::interface::run_compiler::<core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>, rustc_driver_impl[b43ed4103cc78677]::run_compiler::{closure#0}>::{closure#1}
  34:     0x7c8f647e9709 - std[5068228d6f0dc02a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[dcf23a6b0366e6de]::util::run_in_thread_with_globals<rustc_interface[dcf23a6b0366e6de]::util::run_in_thread_pool_with_globals<rustc_interface[dcf23a6b0366e6de]::interface::run_compiler<core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>, rustc_driver_impl[b43ed4103cc78677]::run_compiler::{closure#0}>::{closure#1}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#0}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>
  35:     0x7c8f647e94b2 - <<std[5068228d6f0dc02a]::thread::Builder>::spawn_unchecked_<rustc_interface[dcf23a6b0366e6de]::util::run_in_thread_with_globals<rustc_interface[dcf23a6b0366e6de]::util::run_in_thread_pool_with_globals<rustc_interface[dcf23a6b0366e6de]::interface::run_compiler<core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>, rustc_driver_impl[b43ed4103cc78677]::run_compiler::{closure#0}>::{closure#1}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#0}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#1} as core[430efa8e2f06c6b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7c8f65f63e5b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h47908fbe26776c73
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/alloc/src/boxed.rs:2150:9
  37:     0x7c8f65f63e5b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h54da00d4b6e8da22
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/alloc/src/boxed.rs:2150:9
  38:     0x7c8f65f63e5b - std::sys::pal::unix::thread::Thread::new::thread_start::hbf56854fd7d508a2
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/pal/unix/thread.rs:105:17
  39:     0x7c8f5eea6ded - <unknown>
  40:     0x7c8f5ef2a0dc - <unknown>
  41:                0x0 - <unknown>

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.82.0-nightly (b586701f7 2024-08-05) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_attrs] checking attributes in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

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

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Aug 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 6, 2024
@jieyouxu jieyouxu self-assigned this Aug 6, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 6, 2024
@jieyouxu jieyouxu removed their assignment Aug 6, 2024
@jieyouxu jieyouxu added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Aug 6, 2024
@jieyouxu jieyouxu self-assigned this Aug 6, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 6, 2024
…cote

Consider `cfg_attr` checked by `CheckAttrVisitor`

I forgor about `cfg_attr` in rust-lang#128581, it should be treated like `cfg`.

Fixes rust-lang#128716.
@bors bors closed this as completed in 3158a86 Aug 7, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Aug 7, 2024
Rollup merge of rust-lang#128718 - jieyouxu:check-cfg_attr, r=nnethercote

Consider `cfg_attr` checked by `CheckAttrVisitor`

I forgor about `cfg_attr` in rust-lang#128581, it should be treated like `cfg`.

Fixes rust-lang#128716.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) 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.

3 participants