Skip to content

Broken LLVM with GAT #74684

Closed
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions