-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add a lint for certain suspicious trait object usage #264
Conversation
|
8ee6642
to
fc274e0
Compare
hir::ItemKind::Union(_, generics) => *generics, | ||
hir::ItemKind::Trait(_, _, generics, ..) => *generics, | ||
hir::ItemKind::Fn(_, generics, ..) => *generics, | ||
_ => return, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark as before.
Though, I'm surprised you can't leverage OpaqueTy somehow to induce this problem. Or can you and we already check that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpaqueTy
is unstable, it's TAIT stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather, using OpaqueTy in a turbofish or default type requires TAIT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh, I misread rustc's docs and lost the type Foo =
part, thought for some reason that all impl Trait
goes through it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh oh oh, so wait... wait... OpaqueTy
is a threat but it's currently syntactically inaccessible in this position, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure that struct
/enum
/type
/... are a threat in the first place. They're easy to check for and it feels like I almost got it working, so I figured I'd check for them.
But yeah, TraitAlias
is probably in the same position. I could put it here too, but this whole thing probably needs rethinking when those stabilize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've filed #270 about this kind of thing.
No description provided.