about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/builtin.rs
AgeCommit message (Collapse)AuthorLines
2023-12-15Don't pass lint back out of lint decoratorMichael Goulet-1/+1
2023-12-11Add spacing information to delimiters.Nicholas Nethercote-1/+1
This is an extension of the previous commit. It means the output of something like this: ``` stringify!(let a: Vec<u32> = vec![];) ``` goes from this: ``` let a: Vec<u32> = vec![] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![]; ```
2023-12-10remove redundant importssurechen-1/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-03Parse a pattern with no armNadrieril-2/+4
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-1/+1
cleanup
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-17/+17
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-18Remove --check-cfg checking of --cfg argsUrgau-25/+0
2023-11-14finish `RegionKind` renamelcnr-2/+2
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-10-20Adjust importsMichael Goulet-1/+1
2023-10-18Rollup merge of #116812 - ↵Ali MJ Al-Nasrawy-0/+5
rmehri01:missing_copy_implementations_non_exhaustive, r=petrochenkov Disable missing_copy_implementations lint on non_exhaustive types Fixes #116766
2023-10-17disable missing_copy_implementations lint on non_exhaustive typesRyan Mehri-0/+5
use is_variant_list_non_exhaustive/is_field_list_non_exhaustive remove unused tcx inline non_exhaustive def/variant check
2023-10-16Rename `ACTIVE_FEATURES` as `UNSTABLE_FEATURES`.Nicholas Nethercote-1/+1
It's a better name, and lets "active features" refer to the features that are active in a particular program, due to being declared or enabled by the edition. The commit also renames `Features::enabled` as `Features::active` to match this; I changed my mind and have decided that "active" is a little better thatn "enabled" for this, particularly because a number of pre-existing comments use "active" in this way. Finally, the commit renames `Status::Stable` as `Status::Accepted`, to match `ACCEPTED_FEATURES`.
2023-10-13Format all the let chains in compilerMichael Goulet-16/+21
2023-10-12Fix duplicate note on internal feature gateGurinder Singh-8/+4
The BuiltinInternalFeatures gate already has a struct level #[note] attribute. The additional note field in it caused a duplicate to be displayed when it was set to Some(...) which happened when the feature had an associated issue
2023-09-26Don't store lazyness in DefKindMichael Goulet-3/+3
2023-09-22make the reason: field mandatory for @future_incompatible lintsRalf Jung-3/+3
2023-09-21Record asyncness span in HIRMichael Goulet-2/+1
2023-09-03Emit unused doc comment warnings for pat and expr fieldsGurinder Singh-0/+14
2023-08-13Auto merge of #114723 - petrochenkov:noplugin2, r=davidtwcobors-1/+1
rustc: Move `features` from `Session` to `GlobalCtxt` Removes one more piece of mutable state. Follow up to #114622. The rule I used for passing feature in function signatures: - if a crate already depends on `rustc_middle`, then `Session` is replaced with `TyCtxt` - otherwise session and features are passed as a pair `sess: &Session, features: &Features` The code in `rustc_lint` is ultimately used for implementing a trait from `rustc_expand`, so it also doesn't use tcx despite the dependency on `rustc_middle`.
2023-08-11rustc: Move `features` from `Session` to `GlobalCtxt`Vadim Petrochenkov-1/+1
Removes two pieces of mutable state. Follow up to #114622.
2023-08-10downgrade internal_features to warnlcnr-2/+2
2023-08-05Rollup merge of #114248 - fmease:neg-copy-rules-out-missing-copy-impl, r=b-naberMatthias Krüger-0/+23
Make lint missing-copy-implementations honor negative `Copy` impls Fixes #101980. ``@rustbot`` label A-lint F-negative_impls
2023-08-05Auto merge of #113734 - cjgillot:no-crate-lint, r=petrochenkovbors-440/+23
Convert builtin "global" late lints to run per module The compiler currently has 4 non-incremental lints: 1. `clashing_extern_declarations`; 2. `missing_debug_implementations`; 3. ~`unnameable_test_items`;~ changed by https://github.com/rust-lang/rust/pull/114414 4. `missing_docs`. Non-incremental lints get reexecuted for each compilation, which is slow. Moreover, those lints are allow-by-default, so run for nothing most of the time. This PR attempts to make them more incremental-friendly. `clashing_extern_declarations` is moved to a standalone query. `missing_debug_implementation` can use `non_blanket_impls_for_ty` instead of recomputing it. `missing_docs` is harder as it needs to track if there is a `doc(hidden)` module surrounding. I hack around this using the lint level engine. That's easy to implement and allows to re-enable the lint for a re-exported module, while a more proper solution would reuse the same device as `unnameable_test_items`.
2023-08-04Auto merge of #112117 - bryangarza:track-caller-feature-gate, r=compiler-errorsbors-6/+6
Add separate feature gate for async fn track caller This patch adds a feature gate `async_fn_track_caller` that is separate from `closure_track_caller`. This is to allow enabling `async_fn_track_caller` separately. Fixes #110009
2023-08-04Fetch diagnostic item later.Camille GILLOT-2/+2
2023-08-04Make MissingDoc a module lint.Camille GILLOT-34/+1
2023-08-04Make MissingDebugImplementation a module lint.Camille GILLOT-18/+13
2023-08-04Querify clashing_extern_declarations lint.Camille GILLOT-386/+7
2023-08-04Auto merge of #114414 - cjgillot:early-unnameable-test, r=petrochenkovbors-77/+1
Make test harness lint about unnnameable tests. Implementation of https://github.com/rust-lang/rust/pull/113734#discussion_r1283073418 About the options suggested in https://github.com/rust-lang/rust/issues/36629#issuecomment-404753945: adding this case to unused_attribute was just more complicated. I'll try to understand a bit more what you had in mind in https://github.com/rust-lang/rfcs/pull/2471#issuecomment-397241123 This was just simpler to do in a standalone PR. I'll remove the corresponding changes from https://github.com/rust-lang/rust/pull/113734 later. r? `@petrochenkov`
2023-08-03Make test harness lint about unnnameable tests.Camille GILLOT-77/+1
2023-08-03Add `internal_features` lintNilstrieb-13/+46
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-08-03Make lint missing-copy-implementations honor negative Copy implsLeón Orell Valerian Liehr-0/+23
2023-08-02Add separate feature gate for async fn track callerBryan Garza-6/+6
This patch adds a feature gate `async_fn_track_caller` that is separate from `closure_track_caller`. This is to allow enabling `async_fn_track_caller` separately. Fixes #110009
2023-07-30Check lazy type aliases for well-formednessLeón Orell Valerian Liehr-7/+12
2023-07-28Lower generic const items to HIRLeón Orell Valerian Liehr-1/+2
2023-07-25inline format!() args from rustc_codegen_llvm to the end (4)Matthias Krüger-1/+1
r? @WaffleLapkin
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-21/+23
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-10/+9
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-3/+3
2023-07-03remove TypeWellFormedFromEnvMichael Goulet-2/+1
2023-06-29Rollup merge of #112670 - petrochenkov:typriv, r=eholkMatthias Krüger-6/+2
privacy: Type privacy lints fixes and cleanups See individual commits. Follow up to https://github.com/rust-lang/rust/pull/111801.
2023-06-26TypeWellFormedInEnvMichael Goulet-1/+2
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-16/+7
2023-06-22migrate inferred_outlives_of to ClauseMichael Goulet-4/+4
2023-06-19s/Clause/ClauseKindMichael Goulet-13/+13
2023-06-17Move ConstEvaluatable to ClauseMichael Goulet-2/+2
2023-06-17Move WF goal to clauseMichael Goulet-1/+1
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-2/+2
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-15privacy: Do not mark items reachable farther than their nominal visibilityVadim Petrochenkov-6/+2
This commit reverts a change made in #111425. It was believed that this change was necessary for implementing type privacy lints, but #111801 showed that it was not necessary. Quite opposite, the revert fixes some issues.
2023-06-13Fix explicit-outlives-requirements lint spanSam Ginnett-7/+12