Skip to content

#[repr(transparent)] not parsed correctly on nightly #14318

Closed
@mysteriouslyseeing

Description

@mysteriouslyseeing

Summary

The following code:

#[repr(transparent)]
pub struct Foo;

results in the following report:

Report

thread 'rustc' panicked at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6\compiler\rustc_hir\src\hir.rs:1165:18:
can't get the span of an arbitrary parsed attribute: Parsed(Repr([(ReprTransparent, src\lib.rs:1:8: 1:19 (#0))]))
stack backtrace:
   0:     0x7ffe102e3783 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ffe102e3783 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffe102e3783 - std::backtrace::Backtrace::create
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\backtrace.rs:331
   3:     0x7ffe102e36ca - std::backtrace::Backtrace::force_capture
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\backtrace.rs:312
   4:     0x7ffe118817b8 - core[f63c015fcb3bfc81]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[f9912897f861590f]::Level, &str), usize), <((rustc_lint_defs[f9912897f861590f]::Level, &str), usize) as core[f63c015fcb3bfc81]::cmp::PartialOrd>::lt>
   5:     0x7ffe103002ce - alloc::boxed::impl$30::call
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\alloc\src\boxed.rs:1986
   6:     0x7ffe103002ce - std::panicking::rust_panic_with_hook
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\panicking.rs:839
   7:     0x7ffe10300029 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\panicking.rs:704
   8:     0x7ffe102fcbff - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\sys\backtrace.rs:168
   9:     0x7ffe102ffc2e - std::panicking::begin_panic_handler
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\panicking.rs:695
  10:     0x7ffe1313f231 - core::panicking::panic_fmt
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\core\src\panicking.rs:75
  11:     0x7ff60380514a - <unknown>
  12:     0x7ffe127b8632 - <rustc_lint[76db42d44afaa49f]::lints::EnumIntrinsicsMemDiscriminate as rustc_errors[6b81606b15cc003]::diagnostic::LintDiagnostic<()>>::decorate_lint
  13:     0x7ffe0fede2de - rustc_lint[76db42d44afaa49f]::late::check_crate
  14:     0x7ffe0fedd46d - rustc_lint[76db42d44afaa49f]::late::check_crate
  15:     0x7ffe0cce76f1 - rustc_interface[c68737abf20ed903]::passes::analysis
  16:     0x7ffe0fe7f75a - <alloc[62742d1d7a096e52]::sync::Arc<rustc_session[3ca55610b8562266]::cstore::CrateSource>>::drop_slow
  17:     0x7ffe0fd8fc6c - RINvNtNtCs47XltVl453i_18rustc_query_system5query8plumbing17try_execute_queryINtCs1tWBenDs7vx_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCskPYpWAQYLNC_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  18:     0x7ffe0fe85150 - rustc_query_impl[1145f483adce1c71]::query_system
  19:     0x7ffe0ccad562 - RINvNtNtCs29PJS8x85kR_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs8s4aQECIfBu_5alloc5boxed3BoxDINtNtNtCsl8HosAE7mmb_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECsauP
  20:     0x7ffe0cca5af4 - RINvNtNtCs29PJS8x85kR_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs8s4aQECIfBu_5alloc5boxed3BoxDINtNtNtCsl8HosAE7mmb_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECsauP
  21:     0x7ffe0cc9e113 - RINvNtNtCs29PJS8x85kR_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsh2LaX8xPh29_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCsauPlOHlCpgh_17rustc_driver_i
  22:     0x7ffe0ccb2760 - RINvNtNtCs29PJS8x85kR_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs8s4aQECIfBu_5alloc5boxed3BoxDINtNtNtCsl8HosAE7mmb_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECsauP
  23:     0x7ffe1031167d - alloc::boxed::impl$28::call_once
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\alloc\src\boxed.rs:1972
  24:     0x7ffe1031167d - alloc::boxed::impl$28::call_once
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\alloc\src\boxed.rs:1972
  25:     0x7ffe1031167d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\sys\pal\windows\thread.rs:56
  26:     0x7ffec2ae7374 - BaseThreadInitThunk
  27:     0x7ffec2e9cc91 - RtlUserThreadStart


rustc version: 1.87.0-nightly (00f245915 2025-02-26)
platform: x86_64-pc-windows-msvc

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack

Version

rustc 1.87.0-nightly (00f245915 2025-02-26)
binary: rustc
commit-hash: 00f245915b0c7839d42c26f9628220c4f1b93bf6
commit-date: 2025-02-26
host: x86_64-pc-windows-msvc
release: 1.87.0-nightly
LLVM version: 20.1.0

Error output

Backtrace

thread 'rustc' panicked at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6\compiler\rustc_hir\src\hir.rs:1165:18:
can't get the span of an arbitrary parsed attribute: Parsed(Repr([(ReprTransparent, src\lib.rs:1:8: 1:19 (#0))]))
stack backtrace:
 0: std::panicking::begin_panic_handler
           at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\std\src\panicking.rs:695
 1: core::panicking::panic_fmt
           at /rustc/00f245915b0c7839d42c26f9628220c4f1b93bf6/library\core\src\panicking.rs:75
 2: <unknown>
 3: <rustc_lint::lints::EnumIntrinsicsMemDiscriminate as rustc_errors::diagnostic::LintDiagnostic<()>>::decorate_lint
 4: rustc_lint::late::check_crate
 5: rustc_lint::late::check_crate
 6: rustc_interface::passes::analysis
 7: <alloc::sync::Arc<rustc_session::cstore::CrateSource>>::drop_slow
 8: RINvNtNtCs47XltVl453i_18rustc_query_system5query8plumbing17try_execute_queryINtCs1tWBenDs7vx_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCskPYpWAQYLNC_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
 9: rustc_query_impl::query_system
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions