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

Lifetime resolution in generic assoc types makes rustc panic #46793

Closed
mcobzarenco opened this issue Dec 17, 2017 · 7 comments
Closed

Lifetime resolution in generic assoc types makes rustc panic #46793

mcobzarenco opened this issue Dec 17, 2017 · 7 comments
Labels
A-associated-items Area: Associated items (types, constants & functions) A-GATs Area: Generic associated types (GATs) A-lifetimes Area: Lifetimes / regions 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

@mcobzarenco
Copy link

I wanted to try out the new lifetime resolution in generic associated types merged in #46706.

#![feature(generic_associated_types)]

pub trait Tokenizer {
    type TokenIter<'a>: Iterator<Item = &'a str>;
}

The above makes rustc panic

error: internal compiler error: /checkout/src/librustc/ty/subst.rs:424: Region parameter out of range when substituting in region 'a (root type=Some(&'a str)) (index=1)

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.24.0-nightly (3bee2b44c 2017-12-16) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:449:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

(rustc version above)

Is this expected behaviour for now?

@arielb1 arielb1 changed the title Lifetime resolution in assoc types makes rustc panic Lifetime resolution in generic assoc types makes rustc panic Dec 18, 2017
@kamyuentse
Copy link

cc @sunjay
Is this feature available now? Or any example usage for the current stage?

@sunjay
Copy link
Member

sunjay commented Dec 23, 2017

Hi,
This feature is still being developed and is not ready to be used yet. We can parse generic associated types and resolve names and lifetimes, but they won't work correctly until the implementation is complete. Subscribe to the tracking issue for updates on our progress. :)

@kamyuentse
Copy link

Thanks a lot.

@mcobzarenco Seems this issue can be closed?

@Boddlnagg
Copy link
Contributor

Boddlnagg commented Dec 29, 2017

I just ran into the same issue. I think it should not be closed until it's actually fixed 😉
(For reference, here is my reduced testcase: https://play.rust-lang.org/?gist=368fe46eed85670e35b876bf1c4c95d3&version=nightly, but I don't know if this should compile successfully. It just shouldn't ICE.)

@fafhrd91
Copy link

I got same error trying to compile openssl crate with beta compiler

Compiling openssl v0.9.23
error: internal compiler error: /checkout/src/librustc/ty/subst.rs:424: Region parameter out of range when substituting in region 'a (root type=Some(unsafe fn(*mut <Self as foreign_types::ForeignTypeRef>::CType) -> &'a mut Self {<Self as foreign_types::ForeignTypeRef>::from_ptr_mut::<'a>})) (index=1)
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.24.0-beta.2 (a19122cfa 2018-01-10) running on x86_64-unknown-linux-gnu
thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:451:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `openssl`.

@pietroalbini pietroalbini added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-associated-items Area: Associated items (types, constants & functions) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. A-lifetimes Area: Lifetimes / regions labels Jan 30, 2018
@ia0
Copy link
Contributor

ia0 commented Feb 1, 2018

In case it's not exactly the same issue, I have the same kind of error but with a type parameter instead of a lifetime parameter: https://play.rust-lang.org/?gist=368fe46eed85670e35b876bf1c4c95d3&version=nightly

#![feature(generic_associated_types)]
trait Foo { type Bar<T>; }
struct Lol;
impl Foo for Lol { type Bar<T> = T; }

@pietroalbini
Copy link
Member

Duplicate of #47309. Closing this one.

@Centril Centril added the F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs label Aug 5, 2019
@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-associated-items Area: Associated items (types, constants & functions) A-GATs Area: Generic associated types (GATs) A-lifetimes Area: Lifetimes / regions 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

9 participants