Closed
Description
I tried this code:
#![feature(generic_associated_types)]
trait Fun {
type F<'a>: ?Sized;
fn identity<'a>(t: &'a Self::F<'a>) -> &'a Self::F<'a> { t }
}
impl <T> Fun for T {
type F<'a> = i32;
}
fn bug<'a, T: ?Sized + Fun<F = [u8]>>(t: Box<T>) -> &'static T::F<'a> {
let a = [0; 1];
let x = T::identity(&a);
todo!()
}
fn main() {
let x = 10;
bug(Box::new(x));
}
I expected to see this happen: Throw a bunch of error becouse I wrote wrong types
Instead, this happened: LLVM ERROR: Broken function found, compilation aborted!
Meta
rustc --version --verbose
:
1.47.0-nightly (2020-07-22 bbebe7351fcd29af1eb9)
Backtrace
Invalid bitcast
%10 = bitcast { [0 x i8]*, i64 } %9 to i32*, !dbg !1289
in function _ZN10playground3bug17h799acfa1e8492d55E
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `playground`.
Note that this issue may be very similar to #68642, which has been solved