Closed
Description
#![feature(unboxed_closures)]
trait Lt<'a> {
type T;
}
impl<'a> Lt<'a> for () {
type T = ();
}
fn main() {
let v:<() as Lt<'_>>::T = ();
let f:&mut FnMut<(_,),Output=()> = &mut |_:<() as Lt<'_>>::T|{};
f(v);
}
causes panic with message
cannot access a scoped thread local variable without calling `set` first
which is irrelevant to the code. Simply modify link_binary
function in src\librustc_codegen_llvm\back\link.rs to make it panic before return, will then output some result that says
query stack during panic:
end of query stack
error: internal compiler error: broken MIR in DefId(0/0:7 ~ hrtb_fn_parameters[317d]::main[0]) (_7 = &mut (*_2)): bad assignment (&mut dyn std::ops::FnMut(()) = &mut dyn std::ops::FnMut(<() as Lt<'_>>::T)): NoSolution
--> src/test\run-pass\hrtb-fn-parameters.rs:23:5
|
23 | f(v);
|
This is a variation of #53420 aka #29997, but is more serious and we should fix this first to make it at least emit the real error.
The proper fix of this issue, is NOT to make the code above compile; instead, it should give ICE with proper messages instead of something irrelevant so that we ensure we can get useful information from ICEs all the time, and the ICE is to be fixed after #53420 aka #29997.
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Closures (`|…| { … }`)Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(unboxed_closures)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.