Skip to content

ICE: unrecognized representation hint if repr == doc attr #111051

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#[repr(hello)]
#[doc(hello)]
trait MyTrait {}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (87b1f891e 2023-04-29)
binary: rustc
commit-hash: 87b1f891ea76713462cfc5a15137a8fe2b24ecc2
commit-date: 2023-04-29
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

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

error: internal compiler error: unrecognized representation hint
 --> a.rs:1:8
  |
1 | #[repr(hello)]
  |        ^^^^^
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: rustc_attr::builtin::parse_repr_attr
             3: <rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_item
             4: rustc_lint::early::check_ast_node::<rustc_lint::BuiltinCombinedEarlyLintPass, (&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute])>
             5: rustc_interface::passes::early_lint_checks
             6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::early_lint_checks, rustc_query_impl::plumbing::QueryCtxt>
             7: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::early_lint_checks
             8: rustc_ast_lowering::lower_to_hir
             9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::hir_crate, rustc_query_impl::plumbing::QueryCtxt>
            10: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::hir_crate
            11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::hir_owner, rustc_query_impl::plumbing::QueryCtxt>
            12: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::hir_owner
            13: <rustc_middle::hir::map::Map>::get_module
            14: rustc_middle::hir::map::hir_crate_items
            15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::hir_crate_items, rustc_query_impl::plumbing::QueryCtxt>
            16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::hir_crate_items
            17: rustc_interface::proc_macro_decls::proc_macro_decls_static
            18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::proc_macro_decls_static, rustc_query_impl::plumbing::QueryCtxt>
            19: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::proc_macro_decls_static
            20: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#0}::{closure#0}::{closure#1}>
            21: <core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::analysis::{closure#0}::{closure#0}> as core::ops::function::FnOnce<()>>::call_once
            22: rustc_interface::passes::analysis
            23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            25: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            26: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            27: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            28: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            29: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            30: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/87b1f891ea76713462cfc5a15137a8fe2b24ecc2/library/alloc/src/boxed.rs:1962:9
            31: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/87b1f891ea76713462cfc5a15137a8fe2b24ecc2/library/alloc/src/boxed.rs:1962:9
            32: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/87b1f891ea76713462cfc5a15137a8fe2b24ecc2/library/std/src/sys/unix/thread.rs:108:17
            33: <unknown>
            34: <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: rustc 1.71.0-nightly (87b1f891e 2023-04-29) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

query stack during panic:
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example 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

No branches or pull requests

Issue actions