summary refs log tree commit diff
path: root/compiler/rustc_lint/src
AgeCommit message (Collapse)AuthorLines
2022-12-27Switch `#[track_caller]` back to a no-op unless feature gate is enabledBryan Garza-1/+72
This patch fixes a regression, in which `#[track_caller]`, which was previously a no-op, was changed to actually turn on the behavior. This should instead only happen behind the `closure_track_caller` feature gate. Also, add a warning for the user to understand how their code will compile depending on the feature gate being turned on or not. Fixes #104588
2022-12-07Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obkMatthias Krüger-1/+1
Don't ICE in ExprUseVisitor on FRU for non-existent struct Fixes #104613 Fixes #105202
2022-12-07Auto merge of #105291 - nnethercote:remove-LintPassObjects, r=cjgillotbors-100/+51
Remove `{Early,Late}LintPassObjects`. `EarlyContextAndPass` wraps a single early lint pass. We aggregate multiple passes into that single pass by using `EarlyLintPassObjects`. This commit removes `EarlyLintPassObjects` by changing `EarlyContextAndPass` into `EarlyContextAndPasses`. I.e. it just removes a level of indirection. This makes the code simpler and slightly faster. The commit does likewise for late lints. r? `@cjgillot`
2022-12-06Rollup merge of #105004 - TaKO8Ki:fix-104897, r=wesleywiserMatthias Krüger-5/+26
Fix `emit_unused_delims_expr` ICE Fixes #104897 This is also related to #104433.
2022-12-06Rollup merge of #104898 - oli-obk:group_all_the_things, r=wesleywiserMatthias Krüger-1/+1
Put all cached values into a central struct instead of just the stable hash cc `@nnethercote` this allows re-use of the type for Predicate without duplicating all the logic for the non-hash cached fields
2022-12-05Remove `{Early,Late}LintPassObjects`.Nicholas Nethercote-100/+51
`EarlyContextAndPass` wraps a single early lint pass. We aggregate multiple passes into that single pass by using `EarlyLintPassObjects`. This commit removes `EarlyLintPassObjects` by changing `EarlyContextAndPass` into `EarlyContextAndPasses`. I.e. it just removes a level of indirection. This makes the code simpler and slightly faster. The commit does likewise for late lints.
2022-12-04drive-by: move field_index to typeck resultsMichael Goulet-1/+1
2022-12-02Auto merge of #104863 - nnethercote:reduce-lint-macros, r=cjgillotbors-336/+157
Reduce macro usage for lints r? `@cjgillot`
2022-12-02return when expr has errorTakayuki Maeda-5/+26
fmt add a comment
2022-12-02Inline and remove `early_lint_node`.Nicholas Nethercote-35/+12
It has a single call site.
2022-12-02Merge `builtins` into `EarlyLintPassObjects`.Nicholas Nethercote-15/+4
This avoids calling `early_lint_node` twice. Note: one `early_lint_node` call had `!pre_expansion` for the second argument and the other had `false`. The new single call just has `!pre_expansion`. This results in a reduction of duplicate error messages in some `ui-fulldeps` tests. The order of some `ui-fulldeps` output also changes, but that doesn't matter.
2022-12-02Remove some unnecessary `Send` bounds.Nicholas Nethercote-3/+2
Required to get the parallel compiler building again.
2022-12-02Inline and remove `late_lint_pass_crate`.Nicholas Nethercote-14/+9
It has a single call site.
2022-12-02Inline and remove `late_lint_mod_pass`.Nicholas Nethercote-17/+8
It has a single call site.
2022-12-02Merge `builtins` into `LateLintPassObjects`.Nicholas Nethercote-13/+7
This avoids calling the `late_lint_{mod_pass,pass_crate}` twice.
2022-12-02Remove six macros relating to lint definitions.Nicholas Nethercote-119/+103
These were enabled by the removal of `-Zno-interleave-lints`.
2022-12-02Remove `-Zno-interleave-lints`.Nicholas Nethercote-108/+24
Because it complicates lint implementation greatly.
2022-12-02Eliminate four unnecessary lint macros.Nicholas Nethercote-40/+16
The lint definitions use macros heavily. This commit merges some of them that are split unnecessarily. I find the reduced indirection makes it easier to imagine what the generated code will look like.
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-1/+1
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: Relax lifetime requirements on `Visitor::visit_path`Vadim Petrochenkov-3/+3
2022-11-30Update documentationOli Scherer-1/+1
2022-11-29Make inferred_outlives_crate return ClauseSantiago Pastorino-12/+8
2022-11-29Rollup merge of #104951 - Swatinem:async-kind, r=compiler-errorsMatthias Krüger-4/+1
Simplify checking for `GeneratorKind::Async` Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Simplify checking for `GeneratorKind::Async`Arpad Borsos-4/+1
Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Rename `NestedMetaItem::[Ll]iteral` as `NestedMetaItem::[Ll]it`.Nicholas Nethercote-2/+2
We already use a mix of `Literal` and `Lit`. The latter is better because it is shorter without causing any ambiguity.
2022-11-27Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillotMatthias Krüger-1/+1
Prefer doc comments over `//`-comments in compiler Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errorsbors-6/+2
Separate lifetime ident from lifetime resolution in HIR Drive-by: change how suggested generic args are computed. Fixes https://github.com/rust-lang/rust/issues/103815 I recommend reviewing commit-by-commit.
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-1/+1
2022-11-27Auto merge of #103917 - oli-obk:layout_math, r=RalfJung,lcnrbors-63/+97
Various cleanups around scalar layout restrictions Pulled out of https://github.com/rust-lang/rust/pull/103724
2022-11-26Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errorsGuillaume Gomez-2/+2
Use the power of adding helper function to simplify code w/ `Mutability` r? `@compiler-errors`
2022-11-25Use "must be init" instead of "must not be uninit" everywhereOli Scherer-5/+3
2022-11-25Add a `because` to errors derived from fieldsOli Scherer-22/+21
2022-11-25Don't show fields from other cratesOli Scherer-1/+3
2022-11-25Reinstate the previous compact form of "in this field" errorsOli Scherer-4/+12
2022-11-25Don't try to compute the layout of generic types.Oli Scherer-23/+23
2022-11-25Compute layout instead of manually procesisng the layout restriction attributesOli Scherer-31/+36
2022-11-25Print a trace through types to show how to get to the problematic typeOli Scherer-42/+64
2022-11-25Introduce PredicateKind::ClauseSantiago Pastorino-18/+26
2022-11-24Auto merge of #104845 - matthiaskrgr:rollup-tckj956, r=matthiaskrgrbors-0/+1
Rollup of 11 pull requests Successful merges: - #104514 (Use node_ty_opt to avoid ICE in visit_ty) - #104704 (Allow power10-vector feature in PowerPC) - #104747 (resolve: Don't use constructor def ids in the map for field names) - #104773 (OpaqueCast projections are always overlapping, they can't possibly be disjoint) - #104774 (Document split{_ascii,}_whitespace() for empty strings) - #104780 (make `error_reported` check for delayed bugs) - #104782 (Bump the const eval step limit) - #104792 (rustdoc: simplify `.search-results-title` CSS) - #104796 (lint: do not warn unused parens around higher-ranked function pointers) - #104820 (Remove normalize_projection_type) - #104822 (with_query_mode -> new) Failed merges: - #104716 (move 2 candidates into builtin candidate) - #104841 (Assert that we don't capture escaping bound vars in `Fn` trait selection) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-24Rollup merge of #104796 - notriddle:notriddle/unused-issue-104397, r=oli-obkMatthias Krüger-0/+1
lint: do not warn unused parens around higher-ranked function pointers Fixes #104397
2022-11-24Auto merge of #103693 - HKalbasi:master, r=oli-obkbors-3/+5
Make rustc_target usable outside of rustc I'm working on showing type size in rust-analyzer (https://github.com/rust-lang/rust-analyzer/pull/13490) and I currently copied rustc code inside rust-analyzer, which works, but is bad. With this change, I would become able to use `rustc_target` and `rustc_index` directly in r-a, reducing the amount of copy needed. This PR contains some feature flag to put nightly features behind them to make crates buildable on the stable compiler + makes layout related types generic over index type + removes interning of nested layouts.
2022-11-24Fix rustc_pass_by_value.Camille GILLOT-1/+1
2022-11-24Auto merge of #104321 - Swatinem:async-gen, r=oli-obkbors-1/+14
Avoid `GenFuture` shim when compiling async constructs Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through. --- Given this demo code: ```rust pub async fn a(arg: u32) -> Backtrace { let bt = b().await; let _arg = arg; bt } pub async fn b() -> Backtrace { Backtrace::force_capture() } ``` I would get the following with the latest stable compiler (on Windows): ``` 4: async_codegen::b::async_fn$0 at .\src\lib.rs:10 5: core::future::from_generator::impl$1::poll<enum2$<async_codegen::b::async_fn_env$0> > at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91 6: async_codegen::a::async_fn$0 at .\src\lib.rs:4 7: core::future::from_generator::impl$1::poll<enum2$<async_codegen::a::async_fn_env$0> > at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91 ``` whereas now I get a much cleaner stack trace: ``` 3: async_codegen::b::async_fn$0 at .\src\lib.rs:10 4: async_codegen::a::async_fn$0 at .\src\lib.rs:4 ```
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-1/+1
2022-11-24move some layout logic to rustc_target::abi::layouthkalbasi-2/+4
2022-11-24Avoid `GenFuture` shim when compiling async constructsArpad Borsos-1/+14
Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.
2022-11-23lint: do not warn unused parens around higher-ranked function pointersMichael Howell-0/+1
Fixes #104397
2022-11-23Depend on `Mutability` orderingMaybe Waffle-2/+2
2022-11-23Separate lifetime ident from resolution in HIR.Camille GILLOT-6/+2
2022-11-23Use nicer spans for `deref_into_dyn_supertrait`Maybe Waffle-3/+10