Open racharron opened 1 day ago
This started ICEing in 2022, when GATs stopped being an incomplete_feature
. I don't think bisection will be informative.
Somewhat reduced:
trait LockReference: 'static {
type Ref<'a>;
}
struct SliceRef<'a, T: ?Sized> {
_x: &'a T,
}
impl<'a, T: ?Sized, SR: LockReference> IntoIterator for SliceRef<'a, T>
where
&'a T: IntoIterator<Item = &'a SR>,
{
type Item = SR::Ref<'a>;
type IntoIter = std::iter::Map<<&'a T as IntoIterator>::IntoIter, for<'c> fn(&'c SR) -> SR::Ref<'c>>;
fn into_iter(self) -> Self::IntoIter {
loop {}
}
}
impl LockReference for () {
type Ref<'a> = ();
}
fn locked() -> SliceRef<'static, [()]> {
loop {}
}
fn main() {
let _ = locked().into_iter();
}
Code
Meta
rustc --version --verbose
:Error output
Backtrace
``` Compiling tester v0.1.0 (C:\Users\BLUEM\rust\tester) 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: broken MIR in DefId(0:43 ~ tester[0e95]::main) (Terminator { source_info: SourceInfo { span: src/main.rs:50:13: 50:41 (#0), scope: scope[1] }, kind: _3 = <&SliceRef<'_, [()]> as IntoIterator>::int o_iter(move _4) -> [return: bb4, unwind: bb6] }): call dest mismatch (std::iter::Map, Binder { value: fn(&'^0.Named(DefId(0:26 ~ tester[0e95]::{impl#0}::IntoIter::'c), "'c") ()) -> &'^0.Named(DefId(0:26
~ tester[0e95]::{impl#0}::IntoIter::'c), "'c") (), bound_vars: [Region(BrNamed(DefId(0:26 ~ tester[0e95]::{impl#0}::IntoIter::'c), 'c))] }> <- std::iter::Map, Binder { value: fn(&'^0.Named(DefId(0:26 ~
tester[0e95]::{impl#0}::IntoIter::'c), "'c") ()) -> Alias(Projection, AliasTy { args: [(), '^0.Named(DefId(0:26 ~ tester[0e95]::{impl#0}::IntoIter::'c), "'c")], def_id: DefId(0:8 ~ tester[0e95]::Reference::Ref) }), bound_vars: [Region(BrNamed(DefId(0:26 ~ tester[0e95]::{impl#0}::IntoIter::'c), 'c))] }>): NoSolution
--> src/main.rs:50:13
|
50 | let _ = (&data.locked()).into_iter();
| ^^^^^^^^^^^^^^^^
|
note: delayed at compiler\rustc_borrowck\src\type_check\mod.rs:1571:21
0: std::backtrace_rs::backtrace::dbghelp64::trace
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
1: std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: std::backtrace::Backtrace::create
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\backtrace.rs:331
3: std::backtrace::Backtrace::capture
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\backtrace.rs:296
4: ::steal_fulfilled_expectation_ids
5: ::emit_diagnostic
6: ::emit_producing_guarantee
7: >::decorate_lint
8: ::push_region_constraints
9: rustc_borrowck::dataflow::calculate_borrows_out_of_scope_at_location
10: rustc_borrowck::dataflow::calculate_borrows_out_of_scope_at_location
11: ::push_region_constraints
12: rustc_borrowck::mir_borrowck
13: rustc_query_impl::plumbing::query_key_hash_verify_all
14: rustc_ty_utils::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
15: rustc_query_impl::plumbing::query_key_hash_verify_all
16: rustc_interface::passes::analysis
17: rustc_ty_utils::ty::adt_sized_constraint
18: rustc_ty_utils::ty::adt_sized_constraint
19: rustc_query_impl::query_system
20: _LNan_C
21: _LNan_C
22: _LNan_C
23: alloc::boxed::impl$48::call_once
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\alloc\src\boxed.rs:2070
24: alloc::boxed::impl$48::call_once
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\alloc\src\boxed.rs:2070
25: std::sys::pal::windows::thread::impl$0::new::thread_start
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\sys\pal\windows\thread.rs:58
26: BaseThreadInitThunk
27: RtlUserThreadStart
--> src/main.rs:50:13
|
50 | let _ = (&data.locked()).into_iter();
| ^^^^^^^^^^^^^^^^
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.81.0 (eeb90cda1 2024-09-04) running on x86_64-pc-windows-msvc
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `tester` (bin "tester")
```