about summary refs log tree commit diff
path: root/clippy_utils/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2024-01-05Update clippy for hir::Guard removalMatthew Jasper-2/+2
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-8/+8
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-12-01Merge commit 'f0cdee4a3f094416189261481eae374b76792af1' into clippy-subtree-syncPhilipp Krones-2/+1
2023-11-29Add `never_patterns` feature gateNadrieril-0/+1
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-3/+3
cleanup
2023-11-17rename bound region instantiationlcnr-2/+2
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased` - `replace_late_bound_regions_X` -> `instantiate_bound_regions_X`
2023-11-16Merge commit 'edb720b199083f4107b858a8761648065bf38d86' into clippyupPhilipp Krones-73/+355
2023-11-02Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyupPhilipp Krones-57/+79
2023-10-21Merge commit '2b030eb03d9e5837440b1ee0b98c50b97c0c5889' into clippyupPhilipp Krones-37/+77
2023-10-06Merge commit 'b105fb4c39bc1a010807a6c076193cef8d93c109' into clippyupPhilipp Krones-16/+15
2023-10-05Add more diagnostic items for clippyJason Newcomb-1/+1
2023-09-27Auto merge of #116163 - compiler-errors:lazyness, r=oli-obkbors-1/+1
Don't store lazyness in `DefKind::TyAlias` 1. Don't store lazyness of a type alias in its `DefKind`, but instead via a query. 2. This allows us to treat type aliases as lazy if `#[feature(lazy_type_alias)]` *OR* if the alias contains a TAIT, rather than having checks for both in separate parts of the codebase. r? `@oli-obk` cc `@fmease`
2023-09-26Don't store lazyness in DefKindMichael Goulet-1/+1
2023-09-25Merge commit '7671c283a50b5d1168841f3014b14000f01dd204' into clippyupPhilipp Krones-1/+28
2023-09-21Record asyncness span in HIRMichael Goulet-3/+3
2023-09-21rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::ConstRalf Jung-3/+3
2023-09-12Merge commit '98363cbf6a7c3f8b571a7d92a3c645bb4376e4a6' into clippyupPhilipp Krones-1/+3
2023-08-15Rollup merge of #114819 - estebank:issue-78124, r=compiler-errorsMatthias Krüger-1/+1
Point at return type when it influences non-first `match` arm When encountering code like ```rust fn foo() -> i32 { match 0 { 1 => return 0, 2 => "", _ => 1, } } ``` Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`. Fix #78124.
2023-08-14Move scrutinee `HirId` into `MatchSource::TryDesugar`Esteban Küber-1/+1
2023-08-14Use `{Local}ModDefId` in many queriesNilstrieb-4/+4
2023-08-08Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, ↵Matthias Krüger-1/+1
r=oli-obk Store the laziness of type aliases in their `DefKind` Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not. With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*: Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates. As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions. --- This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold. `@rustbot` label F-lazy_type_alias r? `@oli-obk`
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-1/+1
2023-08-04Improve spans for indexing expressionsNilstrieb-2/+2
Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.
2023-07-31Merge commit '5436dba826191964ac1d0dab534b7eb6d4c878f6' into clippyupPhilipp Krones-6/+276
2023-07-28Make Clippy understand generic const itemsLeón Orell Valerian Liehr-1/+1
2023-07-20XSimplifiedType to SimplifiedType::Xlcnr-25/+22
2023-07-17Merge commit 'd9c24d1b1ee61f276e550b967409c9f155eac4e3' into clippyupPhilipp Krones-10/+55
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-5/+5
2023-07-02Merge commit '37f4c1725d3fd7e9c3ffd8783246bc5589debc53' into clippyupPhilipp Krones-5/+18
2023-06-02Merge commit '30448e8cf98d4754350db0c959644564f317bc0f' into clippyupPhilipp Krones-1/+1
2023-05-20Merge commit '435a8ad86c7a33bd7ffb91c59039943408d3b6aa' into clippyupPhilipp Krones-20/+30
2023-05-05Merge commit '371120bdbf58a331db5dcfb2d9cddc040f486de8' into clippyupPhilipp Krones-37/+14
2023-04-11Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyupPhilipp Krones-5/+67
2023-04-06Make elaborator genericMichael Goulet-1/+1
2023-03-29Stabilize a portion of 'once_cell'Trevor Gross-1/+0
Move items not part of this stabilization to 'lazy_cell' or 'once_cell_try'
2023-03-26Don't elaborate non-obligations into obligationsMichael Goulet-1/+0
2023-03-14Auto merge of #104833 - Swatinem:async-identity-future, r=compiler-errorsbors-10/+1
Remove `identity_future` indirection 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. Fixes https://github.com/rust-lang/rust/issues/104826.
2023-03-10Merge commit '3c06e0b1ce003912f8fe0536d3a7fe22558e38cf' into clippyupPhilipp Krones-1/+1
2023-03-08Remove `identity_future` indirectionArpad Borsos-10/+1
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.
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-2/+2
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-2/+2
2023-02-14Add `of_trait` to DefKind::Impl.Camille GILLOT-1/+1
2023-01-28Auto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkinbors-7/+4
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-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-5/+3
2023-01-28Take a LocalDefId in hir::Visitor::visit_fn.Camille GILLOT-2/+1
2023-01-27Remove from librustdoc and clippy tooScott McMurray-1/+0
2023-01-27Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyupPhilipp Krones-0/+4
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-3/+3
EarlyBinder to fn_sig in metadata