-
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
Rustup to rust-lang/rust#64874 #4628
Conversation
ab95b45
to
65a52ba
Compare
Episode 1 - The simple cases
This also accidentally improved the spans of the suggestions
let cmt = unwrap_downcast_or_interior(cmt); | ||
|
||
if let mc::Categorization::Local(vid) = cmt.cat { | ||
self.moved_vars.insert(vid); | ||
} | ||
} | ||
|
||
fn non_moving_pat(&mut self, matched_pat: &Pat, cmt: &mc::cmt_<'tcx>) { |
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.
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.
Nothing is inserted to spans_need_deref
after this change, so the suggestions to add *
should be broken, but idk.
Anyway, Rust has gained default binding mode and this suggestion became useless. I think it's OK to remove it.
This comment has been minimized.
This comment has been minimized.
Update: I won't get to this until tomorrow. It would be great if someone could take over :) |
[1] Change // ...
match cx.tables.qpath_res(qp, fun.hir_id) {
def::Res::Def(DefKind::Variant, ..) | Res::Def(DefKind::Ctor(..), _) => true,
// Maybe consider `is_const_fn`, but there's less guarantee of cheapness there.
def::Ref::Def(DefKind::Fn, def_id) => cx.tcx.is_promotable_const_fn(def_id),
_ => false,
} [2] and [3] Looking into this lint some more, it's hopelessly broken and needs a rewrite. That said, to roughly keep the current behavior: [2]:
[3]: Unconditionally call |
FIXME: This doesn't work and probably needs a rewrite of the lint See rust-lang#4628 (comment)
Thanks a lot for the hints @matthewjasper! Oh nevermind...
u32::max_value() (and so on) is a DefKind::Method , not DefKind::Fn [1] That doesn't work, because the let _ = 1u32.checked_add(1).unwrap_or(u32::max_value());
I'm still curious about this though: What does
That's what I was afraid of. I propably won't have the time of doing a rewrite, so I'd suggest to just adapt the tests, since this only introduces FNs. We then can get a working Clippy faster and work on this later. cc @rust-lang/clippy [2]+[3] I did this is in b7d4735, but the result is, that all tests fail for this lint |
On another note: I think it's time to Nuke the clippy plugin interface
https://travis-ci.com/rust-lang/rust-clippy/jobs/242398220#L890-L896 |
As suggested in #4616 (comment) @bors treeclosed=10 p=10 |
I've had a look at this, moving the |
@@ -12,11 +12,5 @@ error: local variable doesn't need to be boxed here | |||
LL | pub fn new(_needs_name: Box<PeekableSeekable<&()>>) -> () {} | |||
| ^^^^^^^^^^^ | |||
|
|||
error: local variable doesn't need to be boxed here |
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.
This is the only remaining FN introduced in this PR now. So ping @rust-lang/clippy for review.
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.
file an issue for it and refer to it in the test file and we can land tis
@bors r+ p=10 |
📌 Commit 3d39379 has been approved by |
Rustup to rust-lang/rust#64874 TODO: - [x] replace `rvalue_promotable_map` in [1] - [ ] ~~fix [2] according to this comment rust-lang/rust#64874 (comment) this should be merged with `consume`, but I didn't figure out how to merge them, yet.~~ - [ ] ~~fix [3]; What to do with `LoanCause`?~~ [2]+[3] probably have to be resolved by a rewrite of the lint. #4628 (comment) [1] https://github.com/rust-lang/rust-clippy/blob/54bf4ffd626970e831bb80c037f804a3b3450835/clippy_lints/src/methods/mod.rs#L1292-L1299 [2] https://github.com/rust-lang/rust-clippy/blob/54bf4ffd626970e831bb80c037f804a3b3450835/clippy_lints/src/escape.rs#L126 [3] https://github.com/rust-lang/rust-clippy/blob/54bf4ffd626970e831bb80c037f804a3b3450835/clippy_lints/src/escape.rs#L166-L176 I could need some help with [1]. The purpose of this is to "don't lint for constant values". cc @matthewjasper For now I see what I can do with [2]. changelog: Temporary break `boxed_local` lint.
☀️ Test successful - checks-travis, status-appveyor |
@bors treeclosed- |
TODO:
rvalue_promotable_map
in [1]fix [2] according to this comment Simplify ExprUseVisitor rust#64874 (comment) this should be merged withconsume
, but I didn't figure out how to merge them, yet.fix [3]; What to do withLoanCause
?[2]+[3] probably have to be resolved by a rewrite of the lint. #4628 (comment)
[1]
rust-clippy/clippy_lints/src/methods/mod.rs
Lines 1292 to 1299 in 54bf4ff
[2]
rust-clippy/clippy_lints/src/escape.rs
Line 126 in 54bf4ff
[3]
rust-clippy/clippy_lints/src/escape.rs
Lines 166 to 176 in 54bf4ff
I could need some help with [1]. The purpose of this is to "don't lint for constant values". cc @matthewjasper
For now I see what I can do with [2].
changelog: Temporary break
boxed_local
lint.