-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 lint could_be_unsized
#8526
base: master
Are you sure you want to change the base?
Conversation
r? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
cc6107b
to
6949e70
Compare
5e3277b
to
9b016d9
Compare
This should be mostly done now. Just need to take another pass through the code and clean things up. Linting types can wait for another PR, but everything else is linted. There is a false positive when adding constraints to trait associated types. e.g. trait Assoc {
type Type: ?Sized;
}
fn foo<T: Assoc<Type = T>>(x: &T) -> &T::Assoc where T::Assoc: Sized { ... } This will suggest add I'd like to keep it opt-in right now due to the possibility of ICE's. It runs successfully on all the crates in lintcheck, but I'd like better testing before enabling it by default. |
5e8c596
to
f0877c7
Compare
I think it's ready now. It can remain in the nursery for a bit. |
☔ The latest upstream changes (presumably #8576) made this pull request unmergeable. Please resolve the merge conflicts. |
8f737f3
to
362b205
Compare
@rust-lang/clippy ping to whoever wants to take this one. |
☔ The latest upstream changes (presumably #10415) made this pull request unmergeable. Please resolve the merge conflicts. |
362b205
to
2eda113
Compare
r? clippy |
Overall structure looks good but I don't have the time for a thorough review. r? @blyxyas you might find this one fun |
Could not assign reviewer from: |
I'll take a look r? blyxyas |
☔ The latest upstream changes (presumably #12259) made this pull request unmergeable. Please resolve the merge conflicts. |
Hey @blyxyas, this is a ping from triage. Would you mind taking a look at this PR if you have the time? Otherwise, you can reassign it, by commenting |
Yeah, I had the intention of looking at it because it has been been rolled like 3 times. But with how many reviews I get assigned, + the performance stuff, I simply son't see any time to review this. r? clippy |
Guess I can take this one on. @Jarcho would you mind rebasing? Then we can also see a better lintcheck sample size :D |
r? xFrednet |
This is still on my todo list, but I didn't have the time to take a look at it in the last month. The next week will also be full, but then I'll hopefully have time to review this :) |
fixes: #1368
fixes: #2308
Worklist of things still to do:
Finish checking types for constraints. e.g.dyn Iterator<Item = T>
would requireT
beSized
Actually resolve dependencies. e.g.T: Foo<U>
need to check the constraint fromFoo
to determine whetherT
andU
need to beSized
impl
bodies for types. e.g.struct Foo<T>(..)
should considerimpl<T> Foo<T> {..}
to determine itT
could be?Sized
(will be done in a future PR)Checkimpl
bodes for traits. e.g.impl<T> Foo<T> for Bar<T> {..}
could beT: ?Sized
changelog: Add lint
could_be_unsized