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: opaque type with non-universal region args #111906

Closed
lcnr opened this issue May 24, 2023 · 4 comments · Fixed by #116891
Closed

ICE: opaque type with non-universal region args #111906

lcnr opened this issue May 24, 2023 · 4 comments · Fixed by #116891
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented May 24, 2023

all of the following examples result in the same ICE and should imo all be added as test cases once this is fixed:

this one should pass

fn foo<'a: 'a>() -> impl Sized {
    let _: () = foo::<'a>();
    loop {}
}

this one should error afaik

fn foo<'a: 'a>() -> impl Sized {
    let _: *mut &'a () = foo::<'a>();
    loop {}
}

this one should pass

fn foo<'a: 'a>() -> impl Sized + 'a {
    let _: *mut &'a () = foo::<'a>();
    loop {}
}

this one should error

trait Trait<'a, 'b> {}
impl<'a, 'b, T> Trait<'a, 'b> for T {}

fn foo<'a: 'a, 'b: 'b>() -> impl Trait<'a, 'b> {
    let _: *mut &'a () = foo::<'a, 'b>();
    let _: *mut &'b () = foo::<'a, 'b>();
    loop {}
}

they all ICE with

rror: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: opaque type with non-universal region substs
 --> src/lib.rs:2:12
  |
2 |     let _: () = foo::<'a>();
  |            ^^
  |
  = note: delayed at compiler/rustc_borrowck/src/region_infer/opaque_types.rs:94:35
@lcnr lcnr added 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. C-bug Category: This is a bug. A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. labels May 24, 2023
@matthiaskrgr
Copy link
Member

Will this be fixed by #110844 ?

@aliemjay
Copy link
Member

This is a regression of #103491. Cc @cjgillot.

The error variants should be changed to make the lifetime invariant. Otherwise we would infer 'static:

fn foo<'a: 'a>() -> impl Sized {
-    let _: &'a () = foo::<'a>();
+    let _: *mut &'a () = foo::<'a>();
    loop {}
}

zirconium-n added a commit to zirconium-n/rust that referenced this issue May 30, 2023
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 11, 2023
@matthiaskrgr matthiaskrgr changed the title ICE: opaque type with non-universal region substs ICE: opaque type with non-universal region args Jul 16, 2023
@matthiaskrgr
Copy link
Member

Right now ( rustc 1.73.0-nightly (6ef7d16 2023-08-19) ) it seems that 1 and 3 still ICE and 2 and 4 error.
@rustbot prioritize since this affects stable

@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Aug 20, 2023
@matthiaskrgr matthiaskrgr added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Aug 20, 2023
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Aug 21, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 19, 2023
…2, r=<try>

rework opaque type region inference

fixes rust-lang#113971 Pass -> Error

fixes rust-lang#111906 ICE -> Pass
fixes rust-lang#110623 ==
fixes rust-lang#109059 ==

fixes rust-lang#112841 Pass -> Error

fixes rust-lang#110726 ICE->Error

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 21, 2023
…2, r=<try>

rework opaque type region inference

fixes rust-lang#113971 Pass -> Error

fixes rust-lang#111906 ICE -> Pass
fixes rust-lang#110623 ==
fixes rust-lang#109059 ==

fixes rust-lang#112841 Pass -> Error

fixes rust-lang#110726 ICE->Error

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 23, 2023
…2, r=<try>

rework opaque type region inference

fixes rust-lang#113971 Pass -> Error

fixes rust-lang#111906 ICE -> Pass
fixes rust-lang#110623 ==
fixes rust-lang#109059 ==

fixes rust-lang#112841 Pass -> Error

fixes rust-lang#110726 ICE->Error

fixes rust-lang#111935 Pass -> Error
fixes rust-lang#113916 ==

r? `@ghost`
@bors bors closed this as completed in 551abd6 Mar 28, 2024
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. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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.

6 participants