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

impl-trait type alias is usable in impl blocks #65384

Closed
DutchGhost opened this issue Oct 13, 2019 · 1 comment · Fixed by #86688
Closed

impl-trait type alias is usable in impl blocks #65384

DutchGhost opened this issue Oct 13, 2019 · 1 comment · Fixed by #86688
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@DutchGhost
Copy link
Contributor

As requested in #53345 (comment), here's a follow up.

The following code below implements the trait MyTrait for an alias Bar, which is an alias to MyTrait. It doesnt really make sense to implement a trait...for that same trait.

type_alias_impl_trait doesn't mention anything about this, however the previous existential_type notes:

One last difference between existential type aliases and normal type aliases is that existential type aliases cannot be used in impl blocks

#![feature(type_alias_impl_trait)]

trait MyTrait {}

impl MyTrait for () {}

type Bar = impl MyTrait;

impl MyTrait for Bar {}

fn bazr() -> Bar { }

fn main() {}

Im not sure this should be allowed.

cc @Aaron1011 @nikomatsakis @Centril

@Centril Centril added C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. requires-nightly This issue requires a nightly compiler in some way. labels Oct 13, 2019
@jackh726
Copy link
Member

jackh726 commented Feb 3, 2021

This is fixed on master.

@jackh726 jackh726 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Feb 3, 2021
@bors bors closed this as completed in c5055b7 Jun 28, 2021
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. 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.

3 participants