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

TAITs with different args incorrectly assumed to be equal #122876

Closed
aliemjay opened this issue Mar 22, 2024 · 1 comment · Fixed by #123782
Closed

TAITs with different args incorrectly assumed to be equal #122876

aliemjay opened this issue Mar 22, 2024 · 1 comment · Fixed by #123782
Labels
C-bug Category: This is a bug. F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` 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.

Comments

@aliemjay
Copy link
Member

The following should not compile. Adapted from #115017.

#![feature(type_alias_impl_trait)]

type Opaque<'a> = impl Sized;

fn get_one<'a>(a: *mut &'a str) -> Opaque<'a> {
    a
}

fn get_iter<'a>() -> impl IntoIterator<Item = Opaque<'a>> {
    None::<Opaque<'static>>
}

This is a quick issue, I did not have the chance to look into it deeper but I guess it affects ATPIT as well.
cc @compiler-errors @oli-obk

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 22, 2024
@aliemjay aliemjay added C-bug Category: This is a bug. 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. F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 22, 2024
@aliemjay aliemjay changed the title TAIT accepts incorrect recursive definitions TAITs with different args incorrectly assumed to be equal Mar 22, 2024
@aliemjay
Copy link
Member Author

This used to be an error in #113661, but then incorrectly accepted in #115844.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jun 18, 2024
…r-errors

Test that opaque types can't have themselves as a hidden type with incompatible lifetimes

fixes rust-lang#122876

This PR used to add extra logic to prevent those cases, but after rust-lang#113169 this is implicitly rejected, because such usages are not defining.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jun 18, 2024
…r-errors

Test that opaque types can't have themselves as a hidden type with incompatible lifetimes

fixes rust-lang#122876

This PR used to add extra logic to prevent those cases, but after rust-lang#113169 this is implicitly rejected, because such usages are not defining.
jieyouxu added a commit to jieyouxu/rust that referenced this issue Jun 19, 2024
…r-errors

Test that opaque types can't have themselves as a hidden type with incompatible lifetimes

fixes rust-lang#122876

This PR used to add extra logic to prevent those cases, but after rust-lang#113169 this is implicitly rejected, because such usages are not defining.
fmease added a commit to fmease/rust that referenced this issue Jun 19, 2024
…r-errors

Test that opaque types can't have themselves as a hidden type with incompatible lifetimes

fixes rust-lang#122876

This PR used to add extra logic to prevent those cases, but after rust-lang#113169 this is implicitly rejected, because such usages are not defining.
@bors bors closed this as completed in f03bd96 Jun 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 19, 2024
Rollup merge of rust-lang#123782 - oli-obk:equal_tait_args, r=compiler-errors

Test that opaque types can't have themselves as a hidden type with incompatible lifetimes

fixes rust-lang#122876

This PR used to add extra logic to prevent those cases, but after rust-lang#113169 this is implicitly rejected, because such usages are not defining.
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-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` 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.
Projects
None yet
2 participants