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

TAIT: concrete types may differ by normalization #112691

Open
aliemjay opened this issue Jun 16, 2023 · 0 comments
Open

TAIT: concrete types may differ by normalization #112691

aliemjay opened this issue Jun 16, 2023 · 0 comments
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@aliemjay
Copy link
Member

The following should compile:

#![feature(type_alias_impl_trait)]

trait Trait {
    type Gat<'lt>;
}

impl Trait for u8 {
    type Gat<'lt> = ();
}

fn dyn_hoops<T: Trait>(_: T) -> *const dyn FnOnce(T::Gat<'_>) {
    loop {}
}

type Opaque = impl Sized;

fn define() -> Opaque {
    dyn_hoops::<_>(0)
    //~^ ERROR concrete type differs from previous defining opaque type use
    // expected `*const (dyn FnOnce(()) + 'static)`,
    // got      `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
}

There are multiple places where we compare concrete types for equality. A regression test for this issue should cover them all:

#![feature(type_alias_impl_trait)]

trait Trait {
    type Gat<'lt>;
}

impl Trait for u8 {
    type Gat<'lt> = ();
}

fn dyn_hoops<T: Trait>(_: T) -> *const dyn FnOnce(T::Gat<'_>) {
    loop {}
}

mod typeof_1 {
    use super::*;
    type Opaque = impl Sized;
    fn define() -> Opaque {
        dyn_hoops::<_>(0)
    }
}

mod typeof_2 {
    use super::*;
    type Opaque = impl Sized;
    fn define_1() -> Opaque { dyn_hoops::<_>(0) }
    fn define_2() -> Opaque { dyn_hoops::<u8>(0) }
}

mod typeck {
    use super::*;
    type Opaque = impl Sized;
    fn define() -> Option<Opaque> {
        let _: Opaque = dyn_hoops::<_>(0);
        let _: Opaque = dyn_hoops::<u8>(0);
        None
    }
}

mod borrowck {
    use super::*;
    type Opaque = impl Sized;
    fn define() -> Option<Opaque> {
        let _: Opaque = dyn_hoops::<_>(0);
        None
    }
}

fn main() {}
@aliemjay aliemjay added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` T-types Relevant to the types team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jun 16, 2023
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jun 24, 2023
…ompiler-errors

[-Ztrait-solver=next, mir-typeck] instantiate hidden types in the root universe

Fixes an ICE in the test `member-constraints-in-root-universe`.

Main motivation is to make rust-lang#112691 pass under the new solver.

r? `@compiler-errors`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jun 24, 2023
…ompiler-errors

[-Ztrait-solver=next, mir-typeck] instantiate hidden types in the root universe

Fixes an ICE in the test `member-constraints-in-root-universe`.

Main motivation is to make rust-lang#112691 pass under the new solver.

r? ``@compiler-errors``
@jackh726 jackh726 added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants