Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GAT : internal compiler error #66734

Closed
ZiCog opened this issue Nov 25, 2019 · 6 comments
Closed

GAT : internal compiler error #66734

ZiCog opened this issue Nov 25, 2019 · 6 comments
Labels
A-GATs Area: Generic associated types (GATs) A-NLL Area: Non-lexical lifetimes (NLL) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ZiCog
Copy link

ZiCog commented Nov 25, 2019

This code:

#![feature(generic_associated_types)]

trait Foo {
    type Bar<'a>;
    fn baz<'a>(&self, val: Self::Bar) -> Self::Bar;
}

struct Qux {
    x: i32,
    y: i32,
}

impl Foo for Qux {
    type Bar<'a> = &'a [u8];
    fn baz<'a>(&self, val: Self::Bar) -> Self::Bar {
        val
    }
}

fn main () {
}

Produces this compiler crash:

$ rustc junk.rs
warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
 --> junk.rs:1:12
  |
1 | #![feature(generic_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default

error: internal compiler error: src/librustc_mir/borrow_check/nll/universal_regions.rs:741: cannot convert `ReEarlyBound(0, 'a)` to a region vid

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:643:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error


note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.39.0-nightly (760226733 2019-08-22) running on x86_64-unknown-linux-gnu
@jonas-schievink jonas-schievink added A-NLL Area: Non-lexical lifetimes (NLL) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 25, 2019
@hellow554
Copy link
Contributor

Most likely a dup of #49362
What do you think @jonas-schievink

@jonas-schievink
Copy link
Contributor

Hmm, the message looks quite different. It looks very similar to #62521, actually, so maybe it's a dupe of that.

@hellow554
Copy link
Contributor

hellow554 commented Nov 25, 2019

Oh wow... I tried to reduce the code and missed that I encountered a different ICE. Sorry for that :/

Yep, looks very similar to #62521 except that Self::Bar is a parameter here, instead of the return value.

@ZiCog
Copy link
Author

ZiCog commented Nov 25, 2019

Sorry if this reporting a known issue.

Somebody on the rust-lang forum was trying to explain GAT to me and presented this code as an example:

trait Foo {
    type Bar<'a>;
    fn baz<'a>(&self, val: Self::Bar<'a>);
}
impl Foo for Qux {
    type Bar<'a> = &'a [u8];
    fn baz<'a>(&self, val: &'a [u8]) {}
}

That did not compile, complaining about <'a> in the wrong place so I started playing with it and ended up with what you see my report. Entirely my own creation in that respect.

@hellow554
Copy link
Contributor

Sorry if this reporting a known issue.

No worries. I'm sorry if I sounded rude to you.
I/we really appreciate that you reported the ICE so we can fix the issue (at some time).
It's just to keep the issue tracker clean, that's nothing against you at all.

@jonas-schievink
Copy link
Contributor

Yeah, no worries, we have so many open issues that it's hard to figure out whether something is a duplicate or not. In any case, closing this in favor of #62521.

@fmease fmease added the A-GATs Area: Generic associated types (GATs) label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-GATs Area: Generic associated types (GATs) A-NLL Area: Non-lexical lifetimes (NLL) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants