about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-11-22add iter_kv_map to msrv configMatthias Richter-1/+2
2023-11-22Auto merge of #112380 - jieyouxu:useless-bindings-lint, r=WaffleLapkinbors-2/+88
Add allow-by-default lint for unit bindings ### Example ```rust #![warn(unit_bindings)] macro_rules! owo { () => { let whats_this = (); } } fn main() { // No warning if user explicitly wrote `()` on either side. let expr = (); let () = expr; let _ = (); let _ = expr; //~ WARN binding has unit type let pat = expr; //~ WARN binding has unit type let _pat = expr; //~ WARN binding has unit type // No warning for let bindings with unit type in macro expansions. owo!(); // No warning if user explicitly annotates the unit type on the binding. let pat: () = expr; } ``` outputs ``` warning: binding has unit type `()` --> $DIR/unit-bindings.rs:17:5 | LL | let _ = expr; | ^^^^-^^^^^^^^ | | | this pattern is inferred to be the unit type `()` | note: the lint level is defined here --> $DIR/unit-bindings.rs:3:9 | LL | #![warn(unit_bindings)] | ^^^^^^^^^^^^^ warning: binding has unit type `()` --> $DIR/unit-bindings.rs:18:5 | LL | let pat = expr; | ^^^^---^^^^^^^^ | | | this pattern is inferred to be the unit type `()` warning: binding has unit type `()` --> $DIR/unit-bindings.rs:19:5 | LL | let _pat = expr; | ^^^^----^^^^^^^^ | | | this pattern is inferred to be the unit type `()` warning: 3 warnings emitted ``` This lint is not triggered if any of the following conditions are met: - The user explicitly annotates the binding with the `()` type. - The binding is from a macro expansion. - The user explicitly wrote `let () = init;` - The user explicitly wrote `let pat = ();`. This is allowed for local lifetimes. ### Known Issue It is known that this lint can trigger on some proc-macro generated code whose span returns false for `Span::from_expansion` because e.g. the proc-macro simply forwards user code spans, and otherwise don't have distinguishing syntax context compared to non-macro-generated code. For those kind of proc-macros, I believe the correct way to fix them is to instead emit identifers with span like `Span::mixed_site().located_at(user_span)`. Closes #71432.
2023-11-22Auto merge of #11844 - ↵bors-7/+44
GuillaumeGomez:manual_non_exhaustive-rm-underscore-check, r=flip1995 Remove underscore check for `manual_non_exhaustive` lint Fixes https://github.com/rust-lang/rust-clippy/issues/10550. As indicated in https://github.com/rust-lang/rust-clippy/pull/10559, the underscore check should be removed. changelog: remove underscore check for `manual_non_exhaustive` lint r? `@blyxyas`
2023-11-22x fmt library/stdChris Denton-3/+2
2023-11-22redundant_slicingChris Denton-1/+1
2023-11-22cmp_nullChris Denton-2/+2
comparing with null is better expressed by the `.is_null()` method
2023-11-22manual_range_containsChris Denton-2/+2
2023-11-22internal: simplify the removal of dulicate workspaces.roife-7/+4
refactor: replace multiple steps with `positions` in `fetch_workspaces` for clarity.
2023-11-22op_refChris Denton-1/+1
taken reference of right operand
2023-11-22manual_mapChris Denton-5/+3
manual implementation of `Option::map`
2023-11-22unnecessary_lazy_evaluationsChris Denton-1/+1
unnecessary closure used with `bool::then`
2023-11-22redundant_closureChris Denton-4/+4
2023-11-22duration_subsecChris Denton-1/+1
calling `subsec_micros()` is more concise than this calculation
2023-11-22unnecessary_castChris Denton-9/+9
casting to the same type is unnecessary
2023-11-22needless_borrowChris Denton-8/+8
this expression creates a reference which is immediately dereferenced by the compiler
2023-11-22needless_borrows_for_generic_argsChris Denton-2/+2
the borrowed expression implements the required traits
2023-11-22manual_slice_size_calculationChris Denton-1/+1
2023-11-22unnecessary_mut_passedChris Denton-4/+4
This is where our Windows API bindings previously (and incorrectly) used `*mut` instead of `*const` pointers. Now that the bindings have been corrected, the mutable references (which auto-convert to `*mut`) are unnecessary and we can use shared references.
2023-11-22useless_conversionChris Denton-1/+1
2023-11-22needless_returnChris Denton-1/+1
unneeded `return` statement
2023-11-22Stabilize RFC3324 dyn upcasting coercionUrgau-347/+97
Aka trait_upcasting feature. And also adjust the `deref_into_dyn_supertrait` lint.
2023-11-22Remove underscore check for `manual_non_exhaustive` lintGuillaume Gomez-7/+44
2023-11-22Auto merge of #118086 - nnethercote:queries-cleanups, r=bjorn3bors-59/+47
Queries cleanups r? `@bjorn3`
2023-11-22Auto merge of #11849 - GuillaumeGomez:add-more-transmute_ref_to_ref-tests, ↵bors-1/+57
r=blyxyas Add tests for issues #10285, #10286, #10289, #10287 Fixes #10285. Fixes #10286. Fixes #10289. Fixes #10287. This PR simply adds tests for the listed issues as they're already implemented so we can close them. r? `@blyxyas` changelog:none
2023-11-22condense llvm licensing into a single itemJonathan Pallant (Ferrous Systems)-12/+116
2023-11-22Improve -win7-windows-msvc documentationroblabla-9/+45
2023-11-22Add i686-win7-windows-msvc targetroblabla-0/+34
2023-11-22Add new x86_64-win7-windows-msvc targetroblabla-0/+65
2023-11-22Auto merge of #118125 - nnethercote:custom_encodable, r=compiler-errorsbors-34/+83
Make some `newtype_index!` derived impls opt-in instead of opt-out Opt-in is the standard Rust way of doing things, and avoids some unnecessary dependencies on the `rustc_serialize` crate. r? `@lcnr`
2023-11-22Auto merge of #15894 - schrieveslaach:cancelable-initialization, r=Veykrilbors-14/+188
Cancelable Initialization This commit provides additional initialization methods to Connection in order to support CTRL + C sigterm handling. In the process of adding LSP to Nushell (see https://github.com/nushell/nushell/pull/10941) this gap has been identified.
2023-11-22Document `newtype_index` attributes.Nicholas Nethercote-2/+13
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-4/+43
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-28/+27
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-22print query map for deadlock when using parallel front endSparrowLii-6/+12
2023-11-22Auto merge of #118071 - Urgau:check-cfg-cargo-feature, r=petrochenkovbors-19/+80
Remove `feature` from the list of well known check-cfg name This PR removes `feature` from the list of well known check-cfg. This is done for multiple reasons: - Cargo is the source of truth, rustc shouldn't have any knowledge of it - It creates a conflict between Cargo and rustc when there are no features defined. In this case Cargo won't pass any `--check-cfg` for `feature` since no feature will ever be passed, but rustc by having in it's list adds a implicit `cfg(feature, values(any()))` which is completely wrong. Having any cfg `feature` is unexpected not allow any `feature` value. While doing this, I took the opportunity to specialise the diagnostic a bit for the case above. r? `@petrochenkov`
2023-11-22make the 'abi_unadjusted' feature internalRalf Jung-1/+1
2023-11-22add a testRalf Jung-0/+54
2023-11-22move parentheses judge logic into builderYoung-Flash-16/+13
2023-11-22Auto merge of #117928 - nnethercote:rustc_ast_pretty, r=fee1-deadbors-240/+183
`rustc_ast_pretty` cleanups Some improvements I found while looking at this code. r? `@fee1-dead`
2023-11-22Auto merge of #11627 - y21:issue11616, r=giraffatebors-3/+64
[`needless_return_with_question_mark`]: don't lint if never type is used for coercion Fixes #11616 When we have something like ```rs let _x: String = { return Err(())?; }; ``` we shouldn't suggest removing the `return` because the `!`-ness of `return` is used to coerce the enclosing block to some other type. That will lead to a typeck error without a diverging expression like `return`. changelog: [`needless_return_with_question_mark`]: don't lint if `return`s never typed-ness is used for coercion
2023-11-22Allow defining opaques in check_coroutine_obligationsMichael Goulet-5/+36
2023-11-21Add allocation test and a bit more documentationCelina G. Val-0/+126
2023-11-21Add support to get virtual table allocationCelina G. Val-3/+54
2023-11-21Add support to global allocation to stable-mirCelina G. Val-24/+150
2023-11-22Auto merge of #117582 - compiler-errors:uplift-canonical-var, r=jackh726bors-165/+322
Uplift `CanonicalVarInfo` and friends into `rustc_type_ir` Depends on #117580 and #117578 Uplift `CanonicalVarInfo` and friends into `rustc_type_ir` so they can be consumed by an interner-agnostic `Canonicalizer` implementation for the new trait solver ❤️ r? `@ghost`
2023-11-22Separate `PatStack` and `MatrixRow`Nadrieril-42/+90
This disentangles the row-specific tracking of `parent_row` etc from the logical operation of specialization. This means `wildcard_row` doesn't need to provide dummy values for `parent_row` etc anymore.
2023-11-22Clarify the `Wildcard`/`Missing` situationNadrieril-43/+59
2023-11-22Cleanup span passingNadrieril-30/+31
2023-11-22Store wildcard row in the matrixNadrieril-39/+48
2023-11-22Fully rework the algorithm and its explanationNadrieril-665/+782