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

Regression of TAIT with generics #114909

Closed
xxchan opened this issue Aug 16, 2023 · 2 comments · Fixed by #114914
Closed

Regression of TAIT with generics #114909

xxchan opened this issue Aug 16, 2023 · 2 comments · Fixed by #114914
Assignees
Labels
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.

Comments

@xxchan
Copy link
Contributor

xxchan commented Aug 16, 2023

I tried this code:

#![feature(type_alias_impl_trait)]

struct Foo;

impl Trait for Foo {}
pub trait Trait {}

pub type TAIT<T> = impl Trait;

async fn foo<T>() -> TAIT<T> {
    Foo
}

It failed with a confusing error message. (error: concrete type differs from previous defining opaque type use, at the same location)

error: concrete type differs from previous defining opaque type use
  --> src/main.rs:11:5
   |
11 |     Foo
   |     ^^^ expected `TAIT<T>`, got `Foo`
   |
note: previous use here
  --> src/main.rs:10:30
   |
10 |   async fn foo<T>() -> TAIT<T> {
   |  ______________________________^
11 | |     Foo
12 | | }
   | |_^

I'm trying to minimize #114727, and found the problem.

nightly-2023-06-17 compiles, but nightly-2023-06-18 fails. Although not 100% sure, I think it's caused by the same problem as #114727 (regression caused by #108860)

@xxchan xxchan added the C-bug Category: This is a bug. label Aug 16, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 16, 2023
@xxchan
Copy link
Contributor Author

xxchan commented Aug 16, 2023

cc @oli-obk

@compiler-errors
Copy link
Member

I can work on this, and then I can test if it fixes the other issue too.

@compiler-errors compiler-errors self-assigned this Aug 16, 2023
@compiler-errors compiler-errors added 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. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 16, 2023
@bors bors closed this as completed in 39e0749 Aug 20, 2023
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)]` T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants