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

min_type_alias_impl_trait doesn't report an error when impl Trait is used in a struct field #86732

Closed
nikomatsakis opened this issue Jun 29, 2021 · 3 comments
Labels
F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-needs-decision Issue: In need of a decision. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

This example (playground):

#![feature(min_type_alias_impl_trait)]
type X = impl Iterator<Item = u64> + Unpin;

struct Foo(X);
impl Foo {
    fn new(z: Vec<u64>) -> Self {
        Foo(z.into_iter())
    }
}

should report an error because the use of X in that position is not permitted with min_type_alias_impl_trait. But it does not.

(Spun out from #64445)

@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Jun 29, 2021

Also we should test in enum fields

#![feature(type_alias_impl_trait)]

type Foo = impl Copy;

enum Wrapper {
    First(Foo),
    Second
}

@oli-obk oli-obk added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` and removed F-min_type_alias_impl_trait labels Mar 30, 2022
@oli-obk oli-obk added the I-needs-decision Issue: In need of a decision. label May 3, 2022
@oli-obk
Copy link
Contributor

oli-obk commented May 3, 2022

I think we should just keep allowing this.

@oli-obk oli-obk closed this as completed May 12, 2022
@nikomatsakis
Copy link
Contributor Author

Decision: This works well now! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` I-needs-decision Issue: In need of a decision. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Development

Successfully merging a pull request may close this issue.

2 participants