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 C-bug E-needs-test F-impl_trait_in_bindings glacier I-ICE requires-nightly T-compiler

Comments

@JohnTitor
Copy link
Member

@JohnTitor 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 I-ICE T-compiler A-impl-trait F-impl_trait_in_bindings requires-nightly labels Mar 8, 2020
@hellow554
Copy link
Contributor

@hellow554 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 label Mar 9, 2020
@CDirkx
Copy link
Contributor

@CDirkx 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

@Alexendoo Alexendoo commented Jun 17, 2020

No longer ICEs since #72080

@Alexendoo Alexendoo added the E-needs-test 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 C-bug E-needs-test F-impl_trait_in_bindings glacier I-ICE requires-nightly T-compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants