about summary refs log tree commit diff
path: root/src/tools/clippy/clippy_lints
AgeCommit message (Collapse)AuthorLines
2023-02-09Introduce `-Zterminal-urls` to use OSC8 for error codesEsteban Küber-1/+2
Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-01-28Auto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkinbors-150/+178
Remove HirId -> LocalDefId map from HIR. Having this map in HIR prevents the creating of new definitions after HIR has been built. Thankfully, we do not need it. Based on https://github.com/rust-lang/rust/pull/103902
2023-01-28Auto merge of #107408 - matthiaskrgr:rollup-b5vz2ow, r=matthiaskrgrbors-2/+1
Rollup of 9 pull requests Successful merges: - #104012 (Improve unexpected close and mismatch delimiter hint in TokenTreesReader) - #104252 (Stabilize the const_socketaddr feature) - #105524 (Replace libc::{type} with crate::ffi::{type}) - #107096 (Detect references to non-existant messages in Fluent resources) - #107355 (Add regression test for #60755) - #107384 (Remove `BOOL_TY_FOR_UNIT_TESTING`) - #107385 (Use `FallibleTypeFolder` for `ConstInferUnifier` not `TypeRelation`) - #107391 (rustdoc: remove inline javascript from copy-path button) - #107398 (Remove `ControlFlow::{BREAK, CONTINUE}`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-28Rollup merge of #107398 - scottmcm:its-their-funeral, r=dtolnayMatthias Krüger-2/+1
Remove `ControlFlow::{BREAK, CONTINUE}` Libs-API decided to remove these in #102697. Follow-up to #107023, which removed them from `compiler/`, but a couple new ones showed up since that was merged. r? libs
2023-01-28Auto merge of #106916 - lukas-code:overlapping-substs, r=estebankbors-0/+4
Remove overlapping parts of multipart suggestions This PR adds a debug assertion that the parts of a single substitution cannot overlap, fixes a overlapping substitution from the testsuite, and fixes https://github.com/rust-lang/rust/issues/106870. Note that a single suggestion can still have multiple overlapping substitutions / possible edits, we just don't suggest overlapping replacements in a single edit anymore. I've also included a fix for an unrelated bug where rustfix for `explicit_outlives_requirements` would produce multiple trailing commas for a where clause.
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-6/+5
2023-01-28Take a LocalDefId in hir::Visitor::visit_fn.Camille GILLOT-145/+174
2023-01-27Remove from librustdoc and clippy tooScott McMurray-2/+1
2023-01-28Auto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obkbors-0/+1
Compute generator saved locals on MIR Generators are currently type-checked by introducing a `witness` type variable, which is unified with a `GeneratorWitness(captured types)` whose purpose is to ensure that the auto traits correctly migrate from the captured types to the `witness` type. This requires computing the captured types on HIR during type-checking, only to re-do it on MIR later. This PR proposes to drop the HIR-based computation, and only keep the MIR one. This is done in 3 steps. 1. During type-checking, the `witness` type variable is never unified. This allows to stall all the obligations that depend on it until the end of type-checking. Then, the stalled obligations are marked as successful, and saved into the typeck results for later verification. 2. At type-checking writeback, `witness` is replaced by `GeneratorWitnessMIR(def_id, substs)`. From this point on, all trait selection involving `GeneratorWitnessMIR` will fetch the MIR-computed locals, similar to what opaque types do. There is no lifetime to be preserved here: we consider all the lifetimes appearing in this witness type to be higher-ranked. 3. After borrowck, the stashed obligations are verified against the actually computed types, in the `check_generator_obligations` query. If any obligation was wrongly marked as fulfilled in step 1, it should be reported here. There are still many issues: - ~I am not too happy having to filter out some locals from the checked bounds, I think this is MIR building that introduces raw pointers polluting the analysis;~ solved by a check specific to static variables. - the diagnostics for captured types don't show where they are used/dropped; - I do not attempt to support chalk. cc `@eholk` `@jyn514` for the drop-tracking work r? `@oli-obk` as you warned me of potential unsoundness
2023-01-27Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyupPhilipp Krones-95/+437
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-0/+1
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-38/+38
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-38/+39
2023-01-26Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obkbors-3/+3
Move format_args!() into AST (and expand it during AST lowering) Implements https://github.com/rust-lang/compiler-team/issues/541 This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier. This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`. This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.
2023-01-23fix: use LocalDefId instead of HirId in trait resVincenzo Palazzo-3/+4
use LocalDefId instead of HirId in trait resolution to simplify the obligation clause resolution Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-21Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obkbors-30/+30
Use UnordMap and UnordSet for id collections (DefIdMap, LocalDefIdMap, etc) This PR changes the `rustc_data_structures::define_id_collections!` macro to use `UnordMap` and `UnordSet` instead of `FxHashMap` and `FxHashSet`. This should account for a large portion of hash-maps being used in places where they can cause trouble. The changes required are moderate but non-zero: - In some places the collections are extracted into sorted vecs. - There are a few instances where for-loops have been changed to extends. ~~Let's see what the performance impact is. With a bit more refactoring, we might be able to get rid of some of the additional sorting -- but the change set is already big enough. Unless there's a performance impact, I'd like to do further changes in subsequent PRs.~~ Performance does not seem to be negatively affected ([perf-run here](https://github.com/rust-lang/rust/pull/106977#issuecomment-1396776699)). Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533). r? `@ghost`
2023-01-20Auto merge of #105102 - compiler-errors:copy-impl-considering-regions, r=lcnrbors-2/+2
Check ADT fields for copy implementations considering regions Fixes #88901 r? `@ghost`
2023-01-20fix overlapping spans for `clippy::uninlined_format_args`Lukas Markeffsky-0/+4
2023-01-19Move `unchecked_duration_subtraction` to pedanticAlex Macleod-1/+1
2023-01-19Allow for more efficient sorting when exporting Unord collections.Michael Woerister-2/+2
2023-01-19Use UnordMap instead of FxHashMap in define_id_collections!().Michael Woerister-29/+29
2023-01-19Use UnordSet instead of FxHashSet in define_id_collections!().Michael Woerister-1/+1
2023-01-14change impl_trait_ref query to return EarlyBinder; remove ↵Kyle Matsuda-13/+13
bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata
2023-01-14change usages of impl_trait_ref to bound_impl_trait_refKyle Matsuda-18/+18
2023-01-13Check ADT fields for copy implementations considering regionsMichael Goulet-2/+2
2023-01-13Auto merge of #106776 - oli-obk:om_nom_nom_nom_nom, r=cjgillotbors-1/+1
Feed a bunch of queries instead of tracking fields on TyCtxt r? `@cjgillot` pulled out of https://github.com/rust-lang/rust/pull/105462
2023-01-12Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyupPhilipp Krones-215/+374
2023-01-12Feed the `features_query` instead of grabbing it from the session lazilyOli Scherer-1/+1
2023-01-12Update clippy for new format_args!() lang items.Mara Bos-3/+3
2023-01-04get_parent and find_parentMichael Goulet-13/+12
2023-01-04rename find_parent_node to opt_parent_idMichael Goulet-1/+1
2023-01-04rename get_parent_node to parent_idMichael Goulet-19/+19
2022-12-29Auto merge of #106266 - matthiaskrgr:rollup-cxrdbzy, r=matthiaskrgrbors-95/+467
Rollup of 9 pull requests Successful merges: - #104531 (Provide a better error and a suggestion for `Fn` traits with lifetime params) - #105899 (`./x doc library --open` opens `std`) - #106190 (Account for multiple multiline spans with empty padding) - #106202 (Trim more paths in obligation types) - #106234 (rustdoc: simplify settings, help, and copy button CSS by not reusing) - #106236 (docs/test: add docs and a UI test for `E0514` and `E0519`) - #106259 (Update Clippy) - #106260 (Fix index out of bounds issues in rustdoc) - #106263 (Formatter should not try to format non-Rust files) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-29Merge commit '4f3ab69ea0a0908260944443c739426cc384ae1a' into clippyupPhilipp Krones-95/+467
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-21/+21
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-17Merge commit '4bdfb0741dbcecd5279a2635c3280726db0604b5' into clippyupPhilipp Krones-179/+577
2022-12-14Remove TraitRef::newOli Scherer-3/+3
2022-12-14Ensure no one constructs `AliasTy`s themselvesOli Scherer-1/+1
2022-12-13Combine projection and opaque into aliasMichael Goulet-7/+7
2022-12-13squash OpaqueTy and ProjectionTy into AliasTyMichael Goulet-2/+2
2022-12-13ProjectionTy.item_def_id -> ProjectionTy.def_idMichael Goulet-3/+3
2022-12-13Use ty::OpaqueTy everywhereMichael Goulet-4/+4
2022-12-12Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkovbors-4/+4
Remove `token::Lit` from `ast::MetaItemLit`. Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time. r? `@petrochenkov`
2022-12-08Fix #10021Samuel Moelius-4/+2
2022-12-02Auto merge of #104963 - petrochenkov:noaddids2, r=cjgillotbors-42/+51
rustc_ast_lowering: Stop lowering imports into multiple items Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-02Add `StrStyle` to `ast::LitKind::ByteStr`.Nicholas Nethercote-4/+4
This is required to distinguish between cooked and raw byte string literals in an `ast::LitKind`, without referring to an adjacent `token::Lit`. It's a prerequisite for the next commit.
2022-12-01Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyupPhilipp Krones-612/+1034
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-5/+5
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-32/+41
2022-12-01rustc_hir: Relax lifetime requirements on `Visitor::visit_path`Vadim Petrochenkov-5/+5