-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Update Clippy #109566
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
Update Clippy #109566
Conversation
This was previously needed because the indirection used to hide some unexplained lifetime errors, which it turned out were related to the `min_choice` algorithm. Removing the indirection also solves a couple of cycle errors, large moves and makes async blocks support the `#[track_caller]` annotation.
Update changelog for beta-accepted labels Roses are red Violets are blue r? `@xFrednet` is better at this I can't rhyme. rust-lang/rust-clippy#10423 rust-lang/rust-clippy#10265 changelog: none
Don't lint `manual_clamp` in const contexts. fixes rust-lang#10474 Probably worth including in the sync. r? `@flip1995` changelog: [`manual_clamp`]: Don't lint in const contexts.
Update Clippy r? `@Manishearth` cc `@m-ou-se` This sync also includes rust-lang/rust-clippy#10275
Add more license annotations This PR updates the `.reuse/dep5` file to include more accurate licensing data for everything in the repository (*excluding* submodules and dependencies). Some decisions were made in this PR: * The standard copyright attribution for files maintained by us is "The Rust Project Developers (see https://thanks.rust-lang.org)", to avoid having to maintain an in-tree `AUTHORS` file. * For files that have specific licensing terms, we added the terms to the `.reuse/dep5` rather than adding SPDX comments in the files themselves. * REUSE picks up any comment/text line with `Copyright` on it, so I had to sprinkle around `REUSE-IgnoreStart` and `REUSE-IgnoreEnd` comments. The rendered `COPYRIGHT` file is available at https://gist.github.com/pietroalbini/efb81103f69596d39758114f3f6a8688. r? `@pnkfelix`
…errors Directly construct Inherited in typeck. Using `InheritedBuilder` + a closure does not seem necessary any more. + a few opportunistic simplifications to typeck entry point.
Improve diagnostic of `no_mangle_with_rust_abi` fixes rust-lang#10409 Pending rust-lang/rustfmt#5701 This rewords the message to focus on the error being an implicit ABI, rather than the `Rust` ABI. Also downgrades the suggestion to `MaybeIncorrect` and changes the suggestion span to better highlight the change. --- changelog: None <!-- changelog_checked -->
Remove `snippet_with_macro_callsite` `snippet_with_context` is used instead to support nested macro calls. changelog: None
Add utility macros to help with writing tests. Adds two utility macros to help with testing: * `external` expands to it's argument tokens, but makes them appear to come from an external macro. Helps make tests for `in_external_macro` much more readable. * `inline_macros` is an attribute macro which allows the use of a pseudo `inline!` macro which expands to it's argument tokens, but makes them appear to be from a crate-local macro expansion. This removes the need to write `macro_rules` boilerplate when testing how lints interact with macros. --- `external`'s usage is simple. `external!(struct Foo { x: u32});` will make the struct appear as though it came from an external macro. Individual tokens can be escaped if needed. `external!($x + 0 / 10)` will make everything except `x` appear as though it came from an external macro. Can also use `$literal` and `$(tokens...)` as well. --- `inline_macros` is more complicated due to compiler constraints. Given: ```rust #[inline_macros] fn foo() { inline!(5 + 5 / 10); } ``` `inline!(5 + 5 / 10)` will be replace with a call to a generated macro which expands to the contained tokens. Tokens can be escaped by prefixing them with `$`: ```rust #[inline_macros] fn foo() { let x = 5; inline!($x + 5 / $10); } ``` This will pass `x` as an `ident` argument and `10` as a `literal` argument. Token sequences can also be passed with `$(...)`: ```rust #[inline_macros] fn foo() { let mut x = 5; inline!(if $(x >= 5) { $x = 5; }); } ``` This will pass `x >= 5` as `tt` arguments, and `x` as an `ident` argument. --- Not 100% sure `inline_macros` is actually worth having. It does make the tests a little easier to read once you're used to it and it becomes more useful once there are multiple macro tests. The verbosity of declaring single use macros starts to hurt at that point. changelog: None
Strengthen state tracking in const-prop Some/many of the changes are replicated between both the const-prop lint and the const-prop optimization. Behaviour changes: - const-prop opt does not give a span to propagated values. This was useless as that span's primary purpose is to diagnose evaluation failure in codegen. - we remove the `OnlyPropagateInto` mode. It was only used for function arguments, which are better modeled by a write before entry. - the tracking of assignments and discriminants make clearer that we do nothing in `NoPropagation` mode or on indirect places.
…ieb,est31 Remove `box_syntax` r? `@Nilstrieb` This removes the feature `box_syntax`, which allows the use of `box <expr>` to create a Box, and finalises removing use of the feature from the compiler. `box_patterns` (allowing the use of `box <pat>` in a pattern) is unaffected. It also removes `ast::ExprKind::Box` - the only way to create a 'box' expression now is with the rustc-internal `#[rustc_box]` attribute. As a temporary measure to help users move away, `box <expr>` now parses the inner expression, and emits a `MachineApplicable` lint to replace it with `Box::new` Closes rust-lang#49733
…r-errors a general type system cleanup removes the helper functions `traits::fully_solve_X` as they add more complexity then they are worth. It's confusing which of these helpers should be used in which context. changes the way we deal with overflow to always add depth in `evaluate_predicates_recursively`. It may make sense to actually fully transition to not have `recursion_depth` on obligations but that's probably a bit too much for this PR. also removes some other small - and imo unnecessary - helpers. r? types
Do not propose to remove `async move` if variables are captured by ref Fixes rust-lang#10482 changelog: FP [`redundant_async_block`] Do not propose to remove `async move` if variables are captured by ref
Do not propose to simplify a not expression coming from a macro Fixes rust-lang#10523 changelog: FP [`nonminimal_bool`]: do not propose to change code coming from a macro
The lint is very slow as it doesn't cache the deeply nested check for the attribute. If we cache it, we can reduce the time spent on checking `rustc_borrowck` from 28s to 9s, which is a nice improvement. In the profile, the time inside `has_sig_drop_attr` goes from 66% to 0.2%, which is a lot more reasonable. See the PR for nice graphs.
Updates `interpret`, `codegen_ssa`, and `codegen_cranelift` to consume the new cast instead of the intrinsic. Includes `CastTransmute` for custom MIR building, to be able to test the extra UB.
Significantly optimize `significant_drop_tightening` The lint is very slow as it doesn't cache the deeply nested check for the attribute. If we cache it, we can reduce the time spent on checking `rustc_borrowck` from 28s to 9s, which is a nice improvement. In the profile, the time inside `has_sig_drop_attr` goes from 66% to 0.2%, which is a lot more reasonable. <details> <summary>Flame graphs</summary> Before (all the tall `clippy` towers are `has_sig_drop_attr`):  After:  </details> Fixes rust-lang#10532 changelog: [`significant_drop_tightening`]: significantly optimized
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#108541 (Suppress `opaque_hidden_inferred_bound` for nested RPITs) - rust-lang#109137 (resolve: Querify most cstore access methods (subset 2)) - rust-lang#109380 (add `known-bug` test for unsoundness issue) - rust-lang#109462 (Make alias-eq have a relation direction (and rename it to alias-relate)) - rust-lang#109475 (Simpler checked shifts in MIR building) - rust-lang#109504 (Stabilize `arc_into_inner` and `rc_into_inner`.) - rust-lang#109506 (make param bound vars visibly bound vars with -Zverbose) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Add `CastKind::Transmute` to MIR ~~Nothing actually produces it in this commit, so I don't know how to test it, but it also means it shouldn't be possible for it to break anything.~~ Includes lowering `transmute` calls to it, so it's used. Zulip Conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Good.20first.20isssue/near/321849610>
New lint: detect unnecessary struct building Fixes rust-lang#10476. Running this lint on the top 500 crates produced one hit (in `rust-lang/rust-bindgen`) and [a PR has been submitted there](rust-lang/rust-bindgen#2440). changelog: [`unnecessary_struct_initialization`]: new lint
Rustup r? `@ghost` changelog: none
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
@bors r+ p=1 |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (80a9330): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
r? @Manishearth
One day late, sorry 😐