Open
Description
openedon Jul 5, 2024
Code
#![feature(type_alias_impl_trait)]
trait Trait<T> {}
type Alias<'a, U> = impl Trait<U>;
fn f<'a>() -> Alias<'a, ()> {}
pub enum UninhabitedVariants {
Tuple(Alias),
}
struct A;
fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A {
match x {}
}
fn main() {}
Meta
rustc --version --verbose
:
rustc 1.81.0-nightly (cc8da78a0 2024-07-04)
binary: rustc
commit-hash: cc8da78a036dc3c15c35a97651b02af9a6d30c1e
commit-date: 2024-07-04
host: x86_64-apple-darwin
release: 1.81.0-nightly
LLVM version: 18.1.7
Error output
error[E0106]: missing lifetime specifier
--> ./24D5A.rs:8:11
|
8 | Tuple(Alias),
| ^^^^^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
7 ~ pub enum UninhabitedVariants<'a> {
8 ~ Tuple(Alias<'a>),
|
error[E0107]: missing generics for type alias `Alias`
--> ./24D5A.rs:8:11
|
8 | Tuple(Alias),
| ^^^^^ expected 1 generic argument
|
note: type alias defined here, with 1 generic parameter: `U`
--> ./24D5A.rs:3:6
|
3 | type Alias<'a, U> = impl Trait<U>;
| ^^^^^ -
help: add missing generic argument
|
8 | Tuple(Alias<U>),
| +++
error[E0792]: non-defining opaque type use in defining scope
--> ./24D5A.rs:5:15
|
5 | fn f<'a>() -> Alias<'a, ()> {}
| ^^^^^^^^^^^^^ argument `()` is not a generic parameter
|
note: for this opaque type
--> ./24D5A.rs:3:21
|
3 | type Alias<'a, U> = impl Trait<U>;
| ^^^^^^^^^^^^^
error[E0277]: the trait bound `(): Trait<()>` is not satisfied
--> ./24D5A.rs:5:15
|
5 | fn f<'a>() -> Alias<'a, ()> {}
| ^^^^^^^^^^^^^ the trait `Trait<()>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> ./24D5A.rs:2:1
|
2 | trait Trait<T> {}
| ^^^^^^^^^^^^^^
error[E0792]: non-defining opaque type use in defining scope
--> ./24D5A.rs:8:11
|
8 | Tuple(Alias),
| ^^^^^ argument `'_` is not a generic parameter
|
note: for this opaque type
--> ./24D5A.rs:3:21
|
3 | type Alias<'a, U> = impl Trait<U>;
| ^^^^^^^^^^^^^
error: item does not constrain `Alias::{opaque#0}`, but has it in its signature
--> ./24D5A.rs:13:4
|
13 | fn cannot_empty_match_on_enum_with_empty_variants_struct_to_anything(x: UninhabitedVariants) -> A {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: consider moving the opaque type's declaration and defining uses into a separate module
note: this opaque type is in the signature
--> ./24D5A.rs:3:21
|
3 | type Alias<'a, U> = impl Trait<U>;
| ^^^^^^^^^^^^^
Backtrace
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:168:90: Failed to normalize Alias(Weak, AliasTy { args: ['{erased}, {type error}], def_id: DefId(0:5 ~ 24D5A[2b49]::Alias) }), maybe try to call `try_normalize_erasing_regions` instead
thread 'rustc' panicked at compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:168:90:
Box<dyn Any>
stack backtrace:
0: 0x107af2d93 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfeb614152c5fc770
1: 0x107b3e17b - core::fmt::write::h19d9b55d1716a641
2: 0x107ae8b7e - std::io::Write::write_fmt::h65bfd6c063c93506
3: 0x107af2b81 - std::sys::backtrace::print::h6f13abc1d63a7b7a
4: 0x107af5959 - std::panicking::default_hook::{{closure}}::h53504a5e8286ae49
5: 0x107af56da - std::panicking::default_hook::h46ce4737ada06aa6
6: 0x110deb07c - std[96ba86566161595a]::panicking::update_hook::<alloc[d7368e4144f22d76]::boxed::Box<rustc_driver_impl[d6cc6074f4ffa8bf]::install_ice_hook::{closure#0}>>::{closure#0}
7: 0x107af6699 - std::panicking::rust_panic_with_hook::h3ebbbfeff58c5313
8: 0x110e5f177 - std[96ba86566161595a]::panicking::begin_panic::<rustc_errors[8113839328e8a1a6]::ExplicitBug>::{closure#0}
9: 0x110e4afb9 - std[96ba86566161595a]::sys::backtrace::__rust_end_short_backtrace::<std[96ba86566161595a]::panicking::begin_panic<rustc_errors[8113839328e8a1a6]::ExplicitBug>::{closure#0}, !>
10: 0x115884fc9 - std[96ba86566161595a]::panicking::begin_panic::<rustc_errors[8113839328e8a1a6]::ExplicitBug>
11: 0x110e712b6 - <rustc_errors[8113839328e8a1a6]::diagnostic::BugAbort as rustc_errors[8113839328e8a1a6]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x111b16315 - rustc_middle[3507220e01ce78dc]::util::bug::opt_span_bug_fmt::<rustc_span[9a6059d5c98a4f34]::span_encoding::Span>::{closure#0}
13: 0x111acbf57 - rustc_middle[3507220e01ce78dc]::ty::context::tls::with_opt::<rustc_middle[3507220e01ce78dc]::util::bug::opt_span_bug_fmt<rustc_span[9a6059d5c98a4f34]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x111acba95 - rustc_middle[3507220e01ce78dc]::ty::context::tls::with_context_opt::<rustc_middle[3507220e01ce78dc]::ty::context::tls::with_opt<rustc_middle[3507220e01ce78dc]::util::bug::opt_span_bug_fmt<rustc_span[9a6059d5c98a4f34]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x11594862b - rustc_middle[3507220e01ce78dc]::util::bug::bug_fmt
16: 0x1121c2343 - <rustc_pattern_analysis[c69ad356d2d58605]::rustc::RustcPatCtxt as rustc_pattern_analysis[c69ad356d2d58605]::PatCx>::ctor_sub_tys
17: 0x1121ba4ee - <rustc_pattern_analysis[c69ad356d2d58605]::pat::WitnessPat<rustc_pattern_analysis[c69ad356d2d58605]::rustc::RustcPatCtxt>>::wild_from_ctor
18: 0x1121ce5c3 - rustc_pattern_analysis[c69ad356d2d58605]::usefulness::compute_exhaustiveness_and_usefulness::<rustc_pattern_analysis[c69ad356d2d58605]::rustc::RustcPatCtxt>
19: 0x1121c6fa7 - rustc_pattern_analysis[c69ad356d2d58605]::analyze_match
20: 0x111c15814 - <rustc_mir_build[7e4b23411c86858b]::thir::pattern::check_match::MatchVisitor>::analyze_patterns
21: 0x111c4b85f - <rustc_mir_build[7e4b23411c86858b]::thir::pattern::check_match::MatchVisitor as rustc_middle[3507220e01ce78dc]::thir::visit::Visitor>::visit_expr
22: 0x111c4c0dd - <rustc_mir_build[7e4b23411c86858b]::thir::pattern::check_match::MatchVisitor as rustc_middle[3507220e01ce78dc]::thir::visit::Visitor>::visit_expr
23: 0x111c4b5f8 - <rustc_mir_build[7e4b23411c86858b]::thir::pattern::check_match::MatchVisitor as rustc_middle[3507220e01ce78dc]::thir::visit::Visitor>::visit_expr
24: 0x111b7f3ee - rustc_middle[3507220e01ce78dc]::thir::visit::walk_block::<rustc_mir_build[7e4b23411c86858b]::thir::pattern::check_match::MatchVisitor>
25: 0x111c4c0dd - <rustc_mir_build[7e4b23411c86858b]::thir::pattern::check_match::MatchVisitor as rustc_middle[3507220e01ce78dc]::thir::visit::Visitor>::visit_expr
26: 0x111c4b5f8 - <rustc_mir_build[7e4b23411c86858b]::thir::pattern::check_match::MatchVisitor as rustc_middle[3507220e01ce78dc]::thir::visit::Visitor>::visit_expr
27: 0x111c148e8 - rustc_mir_build[7e4b23411c86858b]::thir::pattern::check_match::check_match
28: 0x1124a50dc - rustc_query_impl[e04fdc29b284e1d7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e04fdc29b284e1d7]::query_impl::check_match::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 1usize]>>
29: 0x1123292af - rustc_query_system[31cd079b68d87400]::query::plumbing::try_execute_query::<rustc_query_impl[e04fdc29b284e1d7]::DynamicConfig<rustc_query_system[31cd079b68d87400]::query::caches::VecCache<rustc_span[9a6059d5c98a4f34]::def_id::LocalDefId, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e04fdc29b284e1d7]::plumbing::QueryCtxt, false>
30: 0x1124d9200 - rustc_query_impl[e04fdc29b284e1d7]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace
31: 0x111bc8464 - rustc_mir_build[7e4b23411c86858b]::build::mir_build
32: 0x111eabb2c - rustc_mir_transform[7f80daa91ef18b2a]::mir_built
33: 0x1124ac36c - rustc_query_impl[e04fdc29b284e1d7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e04fdc29b284e1d7]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 8usize]>>
34: 0x11232265e - rustc_query_system[31cd079b68d87400]::query::plumbing::try_execute_query::<rustc_query_impl[e04fdc29b284e1d7]::DynamicConfig<rustc_query_system[31cd079b68d87400]::query::caches::VecCache<rustc_hir[2175b85699631de1]::hir_id::OwnerId, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e04fdc29b284e1d7]::plumbing::QueryCtxt, false>
35: 0x1124bc28b - rustc_query_impl[e04fdc29b284e1d7]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
36: 0x111c0e61b - rustc_mir_build[7e4b23411c86858b]::check_unsafety::check_unsafety
37: 0x1124a5bce - rustc_query_impl[e04fdc29b284e1d7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e04fdc29b284e1d7]::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 0usize]>>
38: 0x1123249d8 - rustc_query_system[31cd079b68d87400]::query::plumbing::try_execute_query::<rustc_query_impl[e04fdc29b284e1d7]::DynamicConfig<rustc_query_system[31cd079b68d87400]::query::caches::VecCache<rustc_span[9a6059d5c98a4f34]::def_id::LocalDefId, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[e04fdc29b284e1d7]::plumbing::QueryCtxt, false>
39: 0x1124cb7a0 - rustc_query_impl[e04fdc29b284e1d7]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
40: 0x1116c5512 - <rustc_middle[3507220e01ce78dc]::hir::map::Map>::par_body_owners::<rustc_interface[dea1eaaf15b0b7c8]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
41: 0x11176237c - rustc_interface[dea1eaaf15b0b7c8]::passes::run_required_analyses
42: 0x1117647f0 - rustc_interface[dea1eaaf15b0b7c8]::passes::analysis
43: 0x1124abeac - rustc_query_impl[e04fdc29b284e1d7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e04fdc29b284e1d7]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 1usize]>>
44: 0x11228ac1e - rustc_query_system[31cd079b68d87400]::query::plumbing::try_execute_query::<rustc_query_impl[e04fdc29b284e1d7]::DynamicConfig<rustc_query_system[31cd079b68d87400]::query::caches::SingleCache<rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e04fdc29b284e1d7]::plumbing::QueryCtxt, false>
45: 0x1124b6407 - rustc_query_impl[e04fdc29b284e1d7]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
46: 0x110d94bb7 - <rustc_interface[dea1eaaf15b0b7c8]::queries::QueryResult<&rustc_middle[3507220e01ce78dc]::ty::context::GlobalCtxt>>::enter::<core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>, rustc_driver_impl[d6cc6074f4ffa8bf]::run_compiler::{closure#0}::{closure#1}::{closure#5}>
47: 0x110df23cb - rustc_interface[dea1eaaf15b0b7c8]::interface::run_compiler::<core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>, rustc_driver_impl[d6cc6074f4ffa8bf]::run_compiler::{closure#0}>::{closure#1}
48: 0x110ddc9f1 - std[96ba86566161595a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[dea1eaaf15b0b7c8]::util::run_in_thread_with_globals<rustc_interface[dea1eaaf15b0b7c8]::util::run_in_thread_pool_with_globals<rustc_interface[dea1eaaf15b0b7c8]::interface::run_compiler<core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>, rustc_driver_impl[d6cc6074f4ffa8bf]::run_compiler::{closure#0}>::{closure#1}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#0}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>
49: 0x110df8d96 - <<std[96ba86566161595a]::thread::Builder>::spawn_unchecked_<rustc_interface[dea1eaaf15b0b7c8]::util::run_in_thread_with_globals<rustc_interface[dea1eaaf15b0b7c8]::util::run_in_thread_pool_with_globals<rustc_interface[dea1eaaf15b0b7c8]::interface::run_compiler<core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>, rustc_driver_impl[d6cc6074f4ffa8bf]::run_compiler::{closure#0}>::{closure#1}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#0}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#2} as core[677ae2db44f68e98]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
50: 0x107aff83b - std::sys::pal::unix::thread::Thread::new::thread_start::he8797374daece752
51: 0x7ff801f5318b - __pthread_start
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 `/Users/240703-nightly/rustc-ice-2024-07-05T02_05_23-90845.txt` to your bug report
query stack during panic:
#0 [check_match] match-checking `cannot_empty_match_on_enum_with_empty_variants_struct_to_anything`
#1 [mir_built] building MIR for `cannot_empty_match_on_enum_with_empty_variants_struct_to_anything`
end of query stack
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0106, E0107, E0277, E0792.
For more information about an error, try `rustc --explain E0106`.
Note
Ice location:
rust/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs
Lines 161 to 173 in cc8da78
Similar Issue
#109387 use same feature but has different query stack
#120267 has same query stack, but mine uses (type_alias_impl_trait) and Alias(Weak, AliasTy {
was something I'v never seen before
@rustbot label +F-type_alias_impl_trait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Category: This is a bug.`#[feature(type_alias_impl_trait)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Status: a bisection has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
Todo