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

non-defining use in defining scope: region params #74

Open
lcnr opened this issue Nov 6, 2023 · 1 comment
Open

non-defining use in defining scope: region params #74

lcnr opened this issue Nov 6, 2023 · 1 comment

Comments

@lcnr
Copy link
Contributor

lcnr commented Nov 6, 2023

#![feature(type_alias_impl_trait)]

type Tait<'a> = impl Sized;

fn define<'a>(x: &'a ()) -> Tait<'a> {
    ()
}

fn x<'a>(x: &'a (), t: Tait<'a>) -> Tait<'a> {
    t
}

This example fails with overflow in the new solver right now

error[E0275]: overflow evaluating the requirement `Tait<'a> <: Tait<'a>`
  --> src/main.rs:9:46
   |
9  |   fn x<'a>(x: &'a (), t: Tait<'a>) -> Tait<'a> {
   |  ______________________________________________^
10 | |     t
11 | | }
   | |_^

Changing alias relate or the way we define opaque types can cause this to result in ambiguity instead. Fundamentally we want exists<'0, '1> alias-relate(Tait<'0>, Tait<'1>) to hold inside of the defining scope of Tait, regardless of whether we actually define Tait.

@lcnr
Copy link
Contributor Author

lcnr commented Sep 27, 2024

fixed by our decision in rust-lang/rust#117861 to forbid non-defining uses. Needs test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant