-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed as not planned
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I have a 2-variant enum and was curious if I can use #[repr(bool)] maybe and got this error. Only works when there's some #[derive(...)], too.
Code
#[derive(Debug)]
#[repr(bool)]
pub enum Foo {
Bar,
}Meta
rustup check:
stable-aarch64-apple-darwin - Up to date : 1.75.0 (82e1608df 2023-12-21)
beta-aarch64-apple-darwin - Up to date : 1.76.0-beta.1 (0e09125c6 2023-12-21)
nightly-aarch64-apple-darwin - Up to date : 1.77.0-nightly (e51e98dde 2023-12-31)
rustup - Up to date : 1.26.0
Checked with stable, beta, and nightly via cargo.
Cargo's rustc execution:
${HOME}/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc \
--crate-name repr_bool \
--edition=2021 src/lib.rs \
--error-format=json \
--json=diagnostic-rendered-ansi,artifacts,future-incompat \
--diagnostic-width=97 \
--crate-type lib \
--emit=dep-info,metadata,link \
-C embed-bitcode=no \
-C debuginfo=2 \
-C split-debuginfo=unpacked \
-C metadata=9388f8b0ffb557cf \
-C extra-filename=-9388f8b0ffb557cf \
--out-dir ${CRATE}/target/debug/deps \
-L dependency=${CRATE}/target/debug/depsError output
warning: ignoring -C extra-filename flag due to -o flag
error: internal compiler error: no errors encountered even though `span_delayed_bug` issued
error: internal compiler error: unrecognized representation hint
--> src/lib.rs:2:8
|
2 | #[repr(bool)]
| ^^^^
|
Backtrace
delayed span bug: unrecognized representation hint
0: std::backtrace::Backtrace::create
1: <rustc_errors::DiagCtxtInner>::emit_diagnostic_without_consuming
2: <rustc_errors::DiagCtxt>::emit_diagnostic_without_consuming
3: <rustc_errors::DiagCtxt>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
4: rustc_attr::builtin::parse_repr_attr
5: <rustc_builtin_macros::deriving::generic::TraitDef>::expand_ext
6: rustc_builtin_macros::deriving::debug::expand_deriving_debug
7: <rustc_builtin_macros::deriving::BuiltinDerive as rustc_expand::base::MultiItemModifier>::expand
8: <rustc_expand::expand::MacroExpander>::fully_expand_fragment
9: <rustc_expand::expand::MacroExpander>::expand_crate
10: <rustc_session::session::Session>::time::<rustc_ast::ast::Crate, rustc_interface::passes::configure_and_expand::{closure#1}>
11: rustc_interface::passes::resolver_for_lowering
12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::resolver_for_lowering::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
13: <rustc_query_impl::query_impl::resolver_for_lowering::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
15: rustc_query_impl::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace
16: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#0}::{closure#2}, &rustc_data_structures::steal::Steal<(rustc_middle::ty::ResolverAstLowering, alloc::sync::Arc<rustc_ast::ast::Crate>)>>
17: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#0}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
18: 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#0}>::{closure#0}::{closure#0}>
19: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<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#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
20: std::sys_common::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<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
21: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<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#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{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}
22: std::sys::unix::thread::Thread::new::thread_start
23: __pthread_joiner_wake
rustc version: 1.77.0-nightly (e51e98dde 2023-12-31)
platform: aarch64-apple-darwin
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.