Skip to content

[ICE]: malformed lint attributes #154800

@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: --crate-type=lib
#[expect]
#[cfg(false)]
fn main();

Version information

rustc 1.96.0-nightly (2972b5e59 2026-04-03)
binary: rustc
commit-hash: 2972b5e59f1c5529b6ba770437812fd83ab4ebd4
commit-date: 2026-04-03
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.2

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --crate-type=lib

Program output

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error[E0539]: malformed `expect` attribute input
 --> /tmp/icemaker_global_tempdir.6CTfpaDhruXt/rustc_testrunner_tmpdir_reporting.LCZVTqw8b8Jy/mvce.rs:1:1
  |
1 | #[expect]
  | ^^------^
  |   |
  |   expected this to be a list
  |
  = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes>
note: delayed at /rustc-dev/2972b5e59f1c5529b6ba770437812fd83ab4ebd4/compiler/rustc_attr_parsing/src/context.rs:375:48
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::diagnostic::Diag>::delay_as_bug
         4: <rustc_attr_parsing::context::ShouldEmit>::emit_err
         5: <rustc_attr_parsing::context::AttributeDiagnosticContext<rustc_attr_parsing::context::Early>>::emit_parse_error
         6: <rustc_attr_parsing::context::AttributeDiagnosticContext<rustc_attr_parsing::context::Early>>::expected_list
         7: <<rustc_attr_parsing::attributes::lint::Expect as rustc_attr_parsing::attributes::lint::Mapping<rustc_attr_parsing::context::Early>>::MAPPING::{closure#0} as core::ops::function::FnOnce<(&mut rustc_attr_parsing::attributes::lint::LintParser, &mut rustc_attr_parsing::context::AcceptContext<rustc_attr_parsing::context::Early>, &rustc_attr_parsing::parser::ArgParser)>>::call_once
         8: <rustc_lint::levels::LintLevelsBuilder<rustc_lint::levels::TopDown>>::push
         9: rustc_interface::passes::configure_and_expand
        10: rustc_interface::passes::resolver_for_lowering_raw
        11: rustc_query_impl::query_impl::resolver_for_lowering_raw::invoke_provider_fn::__rust_begin_short_backtrace
        12: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 16]>>, false>
        13: rustc_query_impl::query_impl::resolver_for_lowering_raw::execute_query_non_incr::__rust_end_short_backtrace
        14: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        15: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        16: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        17: <std::sys::thread::unix::Thread>::new::thread_start
        18: <unknown>
        19: <unknown>
      
 --> /tmp/icemaker_global_tempdir.6CTfpaDhruXt/rustc_testrunner_tmpdir_reporting.LCZVTqw8b8Jy/mvce.rs:1:1
  |
1 | #[expect]
  | ^^^^^^^^^
help: try changing it to one of the following valid forms of the attribute
  |
1 | #[expect(lint1)]
  |         +++++++
1 | #[expect(lint1, lint2, ...)]
  |         +++++++++++++++++++
1 | #[expect(lint1, lint2, lint3, reason = "...")]
  |         +++++++++++++++++++++++++++++++++++++

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.96.0-nightly (2972b5e59 2026-04-03) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -Z dump-mir-dir=dir

query stack during panic:
end of query stack

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) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions