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

ICE with impl_trait_in_bindings #69840

Closed
JohnTitor opened this issue Mar 8, 2020 · 3 comments · Fixed by #73646
Closed

ICE with impl_trait_in_bindings #69840

JohnTitor opened this issue Mar 8, 2020 · 3 comments · Fixed by #73646
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@JohnTitor
Copy link
Member

JohnTitor commented Mar 8, 2020

Code

This snippet is found in #60473.

Reduced:

#![feature(impl_trait_in_bindings)]
#![allow(incomplete_features)]

struct A<'a>(&'a ());

trait Trait<T> {}

impl<T> Trait<T> for () {}

pub fn foo<'a>() {
    let _x: impl Trait<A<'a>> = ();
}

fn main() {}

playground

playground (original)

Meta

rustc --version --verbose:

1.43.0-nightly (823ff8cf1 2020-03-07)

Error output

error: internal compiler error: opaque type with non-universal region substs
  --> src/main.rs:10:1
   |
10 | / pub fn foo<'a>() {
11 | |     let _x: impl Trait<A<'a>> = ();
12 | | }
   | |_^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:355:17
@JohnTitor JohnTitor added C-bug Category: This is a bug. 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. A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` requires-nightly This issue requires a nightly compiler in some way. labels Mar 8, 2020
@hellow554
Copy link
Contributor

hellow554 commented Mar 9, 2020

Nitpick: There's no need to put the two let _x into different functions, you can put them both in foo.

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 9, 2020
@CDirkx
Copy link
Contributor

CDirkx commented Apr 10, 2020

Like #70971, when using an anonymous binding (_), the above code compiles:

let _: impl Trait<A<'a>> = ();

@Alexendoo
Copy link
Member

No longer ICEs since #72080

@Alexendoo Alexendoo added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 17, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 23, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 24, 2020
@bors bors closed this as completed in 45de677 Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants