Skip to content

ICE: Layout::compute: unexpected type '_' #124207

Description

@matthiaskrgr

Code

#![feature(transmutability)]
#![feature(type_alias_impl_trait)]
trait OpaqueTrait {}
type OpaqueType = impl OpaqueTrait;
trait AnotherTrait {}
impl<T: std::mem::BikeshedIntrinsicFrom<(), ()>> AnotherTrait for T {}
impl AnotherTrait for OpaqueType {}
pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.79.0-nightly (f9b161492 2024-04-19)
binary: rustc
commit-hash: f9b16149208c8a8a349c32813312716f6603eb6f
commit-date: 2024-04-19
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.4

Error output

error: unconstrained opaque type
 --> a.rs:4:19
  |
4 | type OpaqueType = impl OpaqueTrait;
  |                   ^^^^^^^^^^^^^^^^
  |
  = note: `OpaqueType` must be used in combination with a concrete type within the same module

error[E0747]: type provided when a constant was expected
 --> a.rs:6:45
  |
6 | impl<T: std::mem::BikeshedIntrinsicFrom<(), ()>> AnotherTrait for T {}
  |                                             ^^
Backtrace

error: internal compiler error: compiler/rustc_ty_utils/src/layout.rs:676:13: Layout::compute: unexpected type `_`

thread 'rustc' panicked at compiler/rustc_ty_utils/src/layout.rs:676:13:
Box<dyn Any>
stack backtrace:
   0:     0x770d87853a75 - std::backtrace_rs::backtrace::libunwind::trace::ha83ac36f3d576216
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x770d87853a75 - std::backtrace_rs::backtrace::trace_unsynchronized::hb98e29c033b56d71
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x770d87853a75 - std::sys_common::backtrace::_print_fmt::h9cac98576a93da05
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x770d87853a75 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc08cb2c96bc6af47
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x770d878a2ceb - core::fmt::rt::Argument::fmt::h7e0e829b93f0d534
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/core/src/fmt/rt.rs:165:63
   5:     0x770d878a2ceb - core::fmt::write::hc94efcaace3d21b0
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/core/src/fmt/mod.rs:1157:21
   6:     0x770d878485ff - std::io::Write::write_fmt::h04b543bbaa6f2dd7
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/io/mod.rs:1832:15
   7:     0x770d8785384e - std::sys_common::backtrace::_print::hee1e9db3a2945572
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x770d8785384e - std::sys_common::backtrace::print::h6c7cba00911f4786
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x770d878561b9 - std::panicking::default_hook::{{closure}}::ha7d58c0a2e775af5
  10:     0x770d87855efd - std::panicking::default_hook::h87a09229bb1730d2
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/panicking.rs:298:9
  11:     0x770d8421a4bc - std[b1a6245f99d026e2]::panicking::update_hook::<alloc[ffa384fe5a6ae168]::boxed::Box<rustc_driver_impl[5ebafc17f6baf5ac]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x770d878568b6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h5e2a6d4eae799185
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/alloc/src/boxed.rs:2036:9
  13:     0x770d878568b6 - std::panicking::rust_panic_with_hook::hd810693d9a8c8478
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/panicking.rs:799:13
  14:     0x770d84249f84 - std[b1a6245f99d026e2]::panicking::begin_panic::<rustc_errors[ba5989c8493379f8]::ExplicitBug>::{closure#0}
  15:     0x770d84246936 - std[b1a6245f99d026e2]::sys_common::backtrace::__rust_end_short_backtrace::<std[b1a6245f99d026e2]::panicking::begin_panic<rustc_errors[ba5989c8493379f8]::ExplicitBug>::{closure#0}, !>
  16:     0x770d84241f06 - std[b1a6245f99d026e2]::panicking::begin_panic::<rustc_errors[ba5989c8493379f8]::ExplicitBug>
  17:     0x770d84252ea1 - <rustc_errors[ba5989c8493379f8]::diagnostic::BugAbort as rustc_errors[ba5989c8493379f8]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x770d846fcf9c - rustc_middle[e99f9e5b138cd7e6]::util::bug::opt_span_bug_fmt::<rustc_span[add96f0181708003]::span_encoding::Span>::{closure#0}
  19:     0x770d846e47fa - rustc_middle[e99f9e5b138cd7e6]::ty::context::tls::with_opt::<rustc_middle[e99f9e5b138cd7e6]::util::bug::opt_span_bug_fmt<rustc_span[add96f0181708003]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x770d846e467b - rustc_middle[e99f9e5b138cd7e6]::ty::context::tls::with_context_opt::<rustc_middle[e99f9e5b138cd7e6]::ty::context::tls::with_opt<rustc_middle[e99f9e5b138cd7e6]::util::bug::opt_span_bug_fmt<rustc_span[add96f0181708003]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x770d82ab2580 - rustc_middle[e99f9e5b138cd7e6]::util::bug::bug_fmt
  22:     0x770d85c63c6d - rustc_ty_utils[48d247cc516c592c]::layout::layout_of_uncached
  23:     0x770d85c55348 - rustc_ty_utils[48d247cc516c592c]::layout::layout_of
  24:     0x770d85c552d1 - rustc_query_impl[c33ec4ad6556889c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c33ec4ad6556889c]::query_impl::layout_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 16usize]>>
  25:     0x770d85c545b9 - rustc_query_system[4ce495e28c9907d2]::query::plumbing::try_execute_query::<rustc_query_impl[c33ec4ad6556889c]::DynamicConfig<rustc_query_system[4ce495e28c9907d2]::query::caches::DefaultCache<rustc_middle[e99f9e5b138cd7e6]::ty::ParamEnvAnd<rustc_middle[e99f9e5b138cd7e6]::ty::Ty>, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 16usize]>>, false, true, false>, rustc_query_impl[c33ec4ad6556889c]::plumbing::QueryCtxt, false>
  26:     0x770d85c54238 - rustc_query_impl[c33ec4ad6556889c]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
  27:     0x770d84dc16fe - rustc_middle[e99f9e5b138cd7e6]::query::plumbing::query_get_at::<rustc_query_system[4ce495e28c9907d2]::query::caches::DefaultCache<rustc_middle[e99f9e5b138cd7e6]::ty::ParamEnvAnd<rustc_middle[e99f9e5b138cd7e6]::ty::Ty>, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 16usize]>>>
  28:     0x770d84ddd419 - <rustc_transmute[fa409bc515f85ab3]::maybe_transmutable::MaybeTransmutableQuery<rustc_middle[e99f9e5b138cd7e6]::ty::Ty, rustc_middle[e99f9e5b138cd7e6]::ty::context::TyCtxt>>::answer::{closure#0}
  29:     0x770d84ddab53 - <rustc_transmute[fa409bc515f85ab3]::rustc::TransmuteTypeEnv>::is_transmutable
  30:     0x770d85eb7ad3 - <rustc_trait_selection[c82f91c0eb405fdf]::traits::select::SelectionContext>::confirm_candidate
  31:     0x770d85a915cb - <rustc_trait_selection[c82f91c0eb405fdf]::traits::select::SelectionContext>::evaluate_candidate::{closure#0}::{closure#0}
  32:     0x770d82378af3 - <rustc_trait_selection[c82f91c0eb405fdf]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  33:     0x770d823b8b59 - <rustc_trait_selection[c82f91c0eb405fdf]::traits::select::SelectionContext>::candidate_from_obligation
  34:     0x770d85a94da0 - <rustc_trait_selection[c82f91c0eb405fdf]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
  35:     0x770d85a8522e - <rustc_infer[c524740c99df999d]::infer::InferCtxt>::probe::<core[4c074f95c636289]::result::Result<rustc_middle[e99f9e5b138cd7e6]::traits::select::EvaluationResult, rustc_middle[e99f9e5b138cd7e6]::traits::select::OverflowError>, <rustc_trait_selection[c82f91c0eb405fdf]::traits::select::SelectionContext>::evaluation_probe<<rustc_trait_selection[c82f91c0eb405fdf]::traits::select::SelectionContext>::evaluate_root_obligation::{closure#0}>::{closure#0}>
  36:     0x770d85a84201 - rustc_trait_selection[c82f91c0eb405fdf]::traits::coherence::overlap
  37:     0x770d823a0914 - <rustc_middle[e99f9e5b138cd7e6]::traits::specialization_graph::Children as rustc_trait_selection[c82f91c0eb405fdf]::traits::specialize::specialization_graph::ChildrenExt>::insert
  38:     0x770d832180e7 - <rustc_middle[e99f9e5b138cd7e6]::traits::specialization_graph::Graph as rustc_trait_selection[c82f91c0eb405fdf]::traits::specialize::specialization_graph::GraphExt>::insert
  39:     0x770d856b40bc - rustc_trait_selection[c82f91c0eb405fdf]::traits::specialize::specialization_graph_provider
  40:     0x770d856b3c1d - rustc_query_impl[c33ec4ad6556889c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c33ec4ad6556889c]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 8usize]>>
  41:     0x770d856b65e1 - rustc_query_system[4ce495e28c9907d2]::query::plumbing::try_execute_query::<rustc_query_impl[c33ec4ad6556889c]::DynamicConfig<rustc_query_system[4ce495e28c9907d2]::query::caches::DefIdCache<rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c33ec4ad6556889c]::plumbing::QueryCtxt, false>
  42:     0x770d85d8a65e - rustc_query_impl[c33ec4ad6556889c]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  43:     0x770d85ce3af1 - rustc_hir_analysis[465c838ed0c91715]::coherence::coherent_trait
  44:     0x770d85ce37f1 - rustc_query_impl[c33ec4ad6556889c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c33ec4ad6556889c]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 1usize]>>
  45:     0x770d858371d0 - rustc_query_system[4ce495e28c9907d2]::query::plumbing::try_execute_query::<rustc_query_impl[c33ec4ad6556889c]::DynamicConfig<rustc_query_system[4ce495e28c9907d2]::query::caches::DefIdCache<rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c33ec4ad6556889c]::plumbing::QueryCtxt, false>
  46:     0x770d85835d49 - rustc_query_impl[c33ec4ad6556889c]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  47:     0x770d85e4c61e - rustc_hir_analysis[465c838ed0c91715]::check::wfcheck::check_well_formed
  48:     0x770d85e4a3c7 - rustc_query_impl[c33ec4ad6556889c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c33ec4ad6556889c]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 1usize]>>
  49:     0x770d85e49b6a - rustc_query_system[4ce495e28c9907d2]::query::plumbing::try_execute_query::<rustc_query_impl[c33ec4ad6556889c]::DynamicConfig<rustc_query_system[4ce495e28c9907d2]::query::caches::VecCache<rustc_hir[5039c425fb71505b]::hir_id::OwnerId, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c33ec4ad6556889c]::plumbing::QueryCtxt, false>
  50:     0x770d85e498d3 - rustc_query_impl[c33ec4ad6556889c]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  51:     0x770d85e47841 - rustc_hir_analysis[465c838ed0c91715]::check::wfcheck::check_mod_type_wf
  52:     0x770d85e47689 - rustc_query_impl[c33ec4ad6556889c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c33ec4ad6556889c]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 1usize]>>
  53:     0x770d860c4d46 - rustc_query_system[4ce495e28c9907d2]::query::plumbing::try_execute_query::<rustc_query_impl[c33ec4ad6556889c]::DynamicConfig<rustc_query_system[4ce495e28c9907d2]::query::caches::DefaultCache<rustc_span[add96f0181708003]::def_id::LocalModDefId, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c33ec4ad6556889c]::plumbing::QueryCtxt, false>
  54:     0x770d860c4aff - rustc_query_impl[c33ec4ad6556889c]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  55:     0x770d857f1247 - rustc_hir_analysis[465c838ed0c91715]::check_crate
  56:     0x770d85be39fa - rustc_interface[4d16e32404bcb20f]::passes::analysis
  57:     0x770d85be3555 - rustc_query_impl[c33ec4ad6556889c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c33ec4ad6556889c]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 1usize]>>
  58:     0x770d863b50e5 - rustc_query_system[4ce495e28c9907d2]::query::plumbing::try_execute_query::<rustc_query_impl[c33ec4ad6556889c]::DynamicConfig<rustc_query_system[4ce495e28c9907d2]::query::caches::SingleCache<rustc_middle[e99f9e5b138cd7e6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c33ec4ad6556889c]::plumbing::QueryCtxt, false>
  59:     0x770d863b4e49 - rustc_query_impl[c33ec4ad6556889c]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  60:     0x770d862374d9 - rustc_interface[4d16e32404bcb20f]::interface::run_compiler::<core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>, rustc_driver_impl[5ebafc17f6baf5ac]::run_compiler::{closure#0}>::{closure#1}
  61:     0x770d86222367 - std[b1a6245f99d026e2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4d16e32404bcb20f]::util::run_in_thread_with_globals<rustc_interface[4d16e32404bcb20f]::util::run_in_thread_pool_with_globals<rustc_interface[4d16e32404bcb20f]::interface::run_compiler<core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>, rustc_driver_impl[5ebafc17f6baf5ac]::run_compiler::{closure#0}>::{closure#1}, core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>>::{closure#0}, core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>>
  62:     0x770d8622212a - <<std[b1a6245f99d026e2]::thread::Builder>::spawn_unchecked_<rustc_interface[4d16e32404bcb20f]::util::run_in_thread_with_globals<rustc_interface[4d16e32404bcb20f]::util::run_in_thread_pool_with_globals<rustc_interface[4d16e32404bcb20f]::interface::run_compiler<core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>, rustc_driver_impl[5ebafc17f6baf5ac]::run_compiler::{closure#0}>::{closure#1}, core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>>::{closure#0}, core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[4c074f95c636289]::result::Result<(), rustc_span[add96f0181708003]::ErrorGuaranteed>>::{closure#2} as core[4c074f95c636289]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  63:     0x770d8786078b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h51d53d77b032da76
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/alloc/src/boxed.rs:2022:9
  64:     0x770d8786078b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd03902f6d1c8cd92
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/alloc/src/boxed.rs:2022:9
  65:     0x770d8786078b - std::sys::pal::unix::thread::Thread::new::thread_start::ha033681dd3a5d038
                               at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/library/std/src/sys/pal/unix/thread.rs:108:17
  66:     0x770d810a955a - <unknown>
  67:     0x770d81126a3c - <unknown>
  68:                0x0 - <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: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/rustc-ice-2024-04-20T20_22_42-649638.txt` to your bug report

query stack during panic:
panicked at /rustc/f9b16149208c8a8a349c32813312716f6603eb6f/compiler/rustc_type_ir/src/ty_kind.rs:709:17:
thread panicked while processing panic. aborting.
[2]    649638 IOT instruction  rustc a.rs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-transmutability`#![feature(transmutability)]`F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`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