Skip to content

GAT's and broken LLVM #68642

Closed
Closed

Description

I know GAT's are far from complete, but I've played around with them for a bit, and found some fun ICE's and LLVM errors.

The following code produces wrong LLVM output:

#![feature(generic_associated_types)]

trait Fun {
    type F<'a>: Fn() -> u32;
    
    fn callme<'a>(f: Self::F<'a>) -> u32 {
        f()
    }
}

impl <T> Fun for T {
    type F<'a> = Self;
}

fn main() {
    <fn() -> usize>::callme(|| {1});
}

It produces

Function return type does not match operand type of return inst!
  ret i64 %4, !dbg !155
 i32in function _ZN10playground3Fun6callme17h68e94299655f2c3eE
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `playground`.

To learn more, run the command again with --verbose.
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