-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
schneiderfelipe
Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.