Skip to content

ICE: unpretty dies because of invalid repr #138534

Open
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -Zunpretty=expanded
#[repr(bool)]
pub enum TopFg {
    Bar,
}

original:

#[derive(Debug)]
#[repr(bool)]
pub enum TopFg {
    Bar,
}

Version information

rustc 1.87.0-nightly (aa95b9648 2025-03-15)
binary: rustc
commit-hash: aa95b9648ad0383a3fd73b5271dd86f848b7c00c
commit-date: 2025-03-15
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zunpretty=expanded

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[E0552]: unrecognized representation hint
 --> /tmp/icemaker_global_tempdir.FwSxYTjb3IWb/rustc_testrunner_tmpdir_reporting.9LnNTYsaI8WQ/mvce.rs:1:8
  |
1 | #[repr(bool)]
  |        ^^^^
  |
  = help: valid reprs are `Rust` (default), `C`, `align`, `packed`, `transparent`, `simd`, `i8`, `u8`, `i16`, `u16`, `i32`, `u32`, `i64`, `u64`, `i128`, `u128`, `isize`, `usize`
note: delayed at compiler/rustc_attr_parsing/src/context.rs:96:24
         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::attributes::repr::ReprParser as rustc_attr_parsing::attributes::CombineAttributeParser>::extend
         5: <<rustc_attr_parsing::attributes::Combine<rustc_attr_parsing::attributes::repr::ReprParser> as rustc_attr_parsing::attributes::AttributeParser>::ATTRIBUTES::{closure#0} as core::ops::function::FnOnce<(&mut rustc_attr_parsing::attributes::Combine<rustc_attr_parsing::attributes::repr::ReprParser>, &rustc_attr_parsing::context::AcceptContext, &rustc_attr_parsing::parser::ArgParser)>>::call_once
         6: rustc_attr_parsing::context::ATTRIBUTE_MAPPING::{closure#0}::{closure#12}
         7: <rustc_lint::BuiltinCombinedEarlyLintPass as rustc_lint::passes::EarlyLintPass>::check_item
         8: <rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_item
         9: rustc_interface::passes::early_lint_checks
        10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::early_lint_checks::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        12: rustc_query_impl::query_impl::early_lint_checks::get_query_non_incr::__rust_end_short_backtrace
        13: rustc_interface::passes::create_and_enter_global_ctxt::<(), rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2}::{closure#0}
        14: <rustc_interface::passes::create_and_enter_global_ctxt<(), rustc_driver_impl::run_compiler::{closure#0}::{closure#1}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1})>>::call_once::{shim:vtable#0}
        15: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        16: 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}, ()>
        17: <<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<(), 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}
        18: std::sys::pal::unix::thread::Thread::new::thread_start
        19: <unknown>
        20: <unknown>
 --> /tmp/icemaker_global_tempdir.FwSxYTjb3IWb/rustc_testrunner_tmpdir_reporting.9LnNTYsaI8WQ/mvce.rs:1:8
  |
1 | #[repr(bool)]
  |        ^^^^

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.87.0-nightly (aa95b9648 2025-03-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=expanded -Z dump-mir-dir=dir

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-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