Skip to content

ICE "unrecognized representation hint" -Zast-json #96114

Closed as not planned
Closed as not planned
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(attr_literals)]
#[repr("C")] 
struct A {  }
fn main() {  }

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (080d5452e 2022-04-16)
binary: rustc
commit-hash: 080d5452e1bb6e18e12a073d4d0283fd9b6dac0b
commit-date: 2022-04-16
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0

Error output

rustc ./src/test/compile-fail/E0565.rs -Zast-json

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: unrecognized representation hint
 --> ./src/test/compile-fail/E0565.rs:2:8
  |
2 | #[repr("C")]
  |        ^^^
  |
  = note: delayed at compiler/rustc_attr/src/builtin.rs:1028:36

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1383:13
Backtrace

{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":3,"hi":10},"segments":[{"ident":{"name":"feature","span":{"lo":3,"hi":10}},"id":1,"args":null}],"tokens":null},"args":{"variant":"Delimited","fields":[{"open":{"lo":10,"hi":11},"close":{"lo":24,"hi":25}},"Parenthesis",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["attr_literals",false]},"span":{"lo":11,"hi":24}}]},"Alone"]]}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":1}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":1,"hi":2}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":2,"hi":3},"close":{"lo":25,"hi":26}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["feature",false]},"span":{"lo":3,"hi":10}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":10,"hi":11},"close":{"lo":24,"hi":25}},"Paren",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["attr_literals",false]},"span":{"lo":11,"hi":24}}]},"Alone"]]}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":26}}],"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":3,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":2,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":4,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":5,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":6,"args":null},{"ident":{"name":"rust_2015","span":{"lo":0,"hi":0}},"id":7,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":9,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":8,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":29,"hi":33},"segments":[{"ident":{"name":"repr","span":{"lo":29,"hi":33}},"id":11,"args":null}],"tokens":null},"args":{"variant":"Delimited","fields":[{"open":{"lo":33,"hi":34},"close":{"lo":37,"hi":38}},"Parenthesis",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"C","suffix":null}]},"span":{"lo":34,"hi":37}}]},"Alone"]]}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":27,"hi":28}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":28,"hi":29},"close":{"lo":38,"hi":39}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["repr",false]},"span":{"lo":29,"hi":33}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":33,"hi":34},"close":{"lo":37,"hi":38}},"Paren",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"C","suffix":null}]},"span":{"lo":34,"hi":37}}]},"Alone"]]}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Outer","span":{"lo":27,"hi":39}}],"id":10,"span":{"lo":41,"hi":54},"vis":{"kind":"Inherited","span":{"lo":41,"hi":41},"tokens":null},"ident":{"name":"A","span":{"lo":48,"hi":49}},"kind":{"variant":"Struct","fields":[{"variant":"Struct","fields":[[],false]},{"params":[],"where_clause":{"has_where_token":false,"predicates":[],"span":{"lo":49,"hi":49}},"span":{"lo":49,"hi":49}}]},"tokens":null},{"attrs":[],"id":12,"span":{"lo":55,"hi":69},"vis":{"kind":"Inherited","span":{"lo":55,"hi":55},"tokens":null},"ident":{"name":"main","span":{"lo":58,"hi":62}},"kind":{"variant":"Fn","fields":[{"defaultness":"Final","generics":{"params":[],"where_clause":{"has_where_token":false,"predicates":[],"span":{"lo":64,"hi":64}},"span":{"lo":62,"hi":62}},"sig":{"header":{"unsafety":"No","asyncness":"No","constness":"No","ext":"None"},"decl":{"inputs":[],"output":{"variant":"Default","fields":[{"lo":65,"hi":65}]}},"span":{"lo":55,"hi":64}},"body":{"stmts":[],"id":13,"rules":"Default","span":{"lo":65,"hi":69},"tokens":null,"could_be_bare_literal":false}}]},"tokens":null}],"spans":{"inner_span":{"lo":0,"hi":69},"inject_use_span":{"lo":27,"hi":27}},"id":0,"is_placeholder":false}
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: unrecognized representation hint
 --> ./src/test/compile-fail/E0565.rs:2:8
  |
2 | #[repr("C")]
  |        ^^^
  |
  = note: delayed at compiler/rustc_attr/src/builtin.rs:1028:36

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1383:13
stack backtrace:
   0:     0x7f504009d86d - std::backtrace_rs::backtrace::libunwind::trace::hf4a9b37fd4cb1de6
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f504009d86d - std::backtrace_rs::backtrace::trace_unsynchronized::hc5646239bd28d6d5
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f504009d86d - std::sys_common::backtrace::_print_fmt::hbcf844b366cf31ee
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f504009d86d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h824cdfa6f8b2421b
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f50400f8f5c - core::fmt::write::h92ae3d019870038d
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/core/src/fmt/mod.rs:1194:17
   5:     0x7f504008efc1 - std::io::Write::write_fmt::h7960e44181cc8d53
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/io/mod.rs:1655:15
   6:     0x7f50400a0585 - std::sys_common::backtrace::_print::hbcc102cb2f6667c0
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f50400a0585 - std::sys_common::backtrace::print::h145bd1306d2f2839
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f50400a0585 - std::panicking::default_hook::{{closure}}::h7611500ee543574a
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/panicking.rs:295:22
   9:     0x7f50400a01f9 - std::panicking::default_hook::hb179967da55a3e92
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/panicking.rs:314:9
  10:     0x7f50408d0971 - rustc_driver[db9ec4c5eaabb596]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f50400a0d56 - std::panicking::rust_panic_with_hook::hd471070a15949dd9
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/panicking.rs:702:17
  12:     0x7f5041a171f1 - std[45a6a48f798f8fe1]::panicking::begin_panic::<rustc_errors[3dec4a496ff7fc15]::ExplicitBug>::{closure#0}
  13:     0x7f5041a161c6 - std[45a6a48f798f8fe1]::sys_common::backtrace::__rust_end_short_backtrace::<std[45a6a48f798f8fe1]::panicking::begin_panic<rustc_errors[3dec4a496ff7fc15]::ExplicitBug>::{closure#0}, !>
  14:     0x7f5041a1eb4f - std[45a6a48f798f8fe1]::panicking::begin_panic::<rustc_errors[3dec4a496ff7fc15]::ExplicitBug>
  15:     0x7f5041a21aa6 - std[45a6a48f798f8fe1]::panic::panic_any::<rustc_errors[3dec4a496ff7fc15]::ExplicitBug>
  16:     0x7f50431c0437 - <rustc_errors[3dec4a496ff7fc15]::HandlerInner as core[ecf393b468e0bb07]::ops::drop::Drop>::drop
  17:     0x7f50428d3218 - core[ecf393b468e0bb07]::ptr::drop_in_place::<rustc_session[f82f58b9ae715780]::parse::ParseSess>
  18:     0x7f50428d58d3 - <alloc[84f38da3286aa3f2]::rc::Rc<rustc_session[f82f58b9ae715780]::session::Session> as core[ecf393b468e0bb07]::ops::drop::Drop>::drop
  19:     0x7f50428ffc3d - core[ecf393b468e0bb07]::ptr::drop_in_place::<rustc_interface[e137e6842d2aed1c]::interface::Compiler>
  20:     0x7f50428ff3d4 - rustc_span[95c56a3242fac7b4]::with_source_map::<core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>, rustc_interface[e137e6842d2aed1c]::interface::create_compiler_and_run<core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>, rustc_driver[db9ec4c5eaabb596]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f50428d7247 - <scoped_tls[a98ac1d31e6919a7]::ScopedKey<rustc_span[95c56a3242fac7b4]::SessionGlobals>>::set::<rustc_interface[e137e6842d2aed1c]::interface::run_compiler<core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>, rustc_driver[db9ec4c5eaabb596]::run_compiler::{closure#1}>::{closure#0}, core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>>
  22:     0x7f50428ec61f - std[45a6a48f798f8fe1]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e137e6842d2aed1c]::util::run_in_thread_pool_with_globals<rustc_interface[e137e6842d2aed1c]::interface::run_compiler<core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>, rustc_driver[db9ec4c5eaabb596]::run_compiler::{closure#1}>::{closure#0}, core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>>::{closure#0}, core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>>
  23:     0x7f50428ec769 - <<std[45a6a48f798f8fe1]::thread::Builder>::spawn_unchecked_<rustc_interface[e137e6842d2aed1c]::util::run_in_thread_pool_with_globals<rustc_interface[e137e6842d2aed1c]::interface::run_compiler<core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>, rustc_driver[db9ec4c5eaabb596]::run_compiler::{closure#1}>::{closure#0}, core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>>::{closure#0}, core[ecf393b468e0bb07]::result::Result<(), rustc_errors[3dec4a496ff7fc15]::ErrorGuaranteed>>::{closure#1} as core[ecf393b468e0bb07]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7f50400aac03 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb0335208d7774586
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/alloc/src/boxed.rs:1866:9
  25:     0x7f50400aac03 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha1a9e99037caafac
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/alloc/src/boxed.rs:1866:9
  26:     0x7f50400aac03 - std::sys::unix::thread::Thread::new::thread_start::he54f6eb1ba9b61f3
                               at /rustc/080d5452e1bb6e18e12a073d4d0283fd9b6dac0b/library/std/src/sys/unix/thread.rs:108:17
  27:     0x7f503fe835c2 - start_thread
  28:     0x7f503ff08584 - __clone
  29:                0x0 - <unknown>

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.62.0-nightly (080d5452e 2022-04-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z ast-json

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions