about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
AgeCommit message (Collapse)AuthorLines
2024-03-07Use was_invoked_from_cargo method instead of hand-written oneUrgau-1/+1
2024-03-07Add early-return when checking if a path is localUrgau-2/+4
2024-03-07Remove useless smallvec dependency in rustc_lint::non_local_defUrgau-12/+18
2024-03-07Auto merge of #122113 - matthiaskrgr:rollup-5d1jnwi, r=matthiaskrgrbors-1/+5
Rollup of 9 pull requests Successful merges: - #121958 (Fix redundant import errors for preload extern crate) - #121976 (Add an option to have an external download/bootstrap cache) - #122022 (loongarch: add frecipe and relax target feature) - #122026 (Do not try to format removed files) - #122027 (Uplift some feeding out of `associated_type_for_impl_trait_in_impl` and into queries) - #122063 (Make the lowering of `thir::ExprKind::If` easier to follow) - #122074 (Add missing PartialOrd trait implementation doc for array) - #122082 (remove outdated fixme comment) - #122091 (Note why we're using a new thread in `test_get_os_named_thread`) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-07Rollup merge of #122107 - Urgau:non_local_def-allow, r=WaffleLapkinMatthias Krüger-1/+2
Temporarily make allow-by-default the `non_local_definitions` lint T-lang [decided in their triage meeting](https://hackmd.io/U-CKiZx_RKiaANAPXtWf7g#non_local_definitions-common-issues-impl-for-ampLocal-FromltLocalgt-for-Global-%E2%80%A6-rust121621) to try to use a [better logic](https://github.com/rust-lang/rust/issues/121621#issuecomment-1976826895) for detecting non-local `impl` definitions given the [numerous reports](https://github.com/rust-lang/rust/issues/121621) we got. Until that is done and also because the beta cut is next week, switch the lint to allow-by-default until it's implemented. r? `@WaffleLapkin`
2024-03-06Temporarily make allow-by-default the non_local_definitions lintUrgau-1/+2
2024-03-06Rollup merge of #121382 - nnethercote:rework-untranslatable_diagnostic-lint, ↵Matthias Krüger-46/+128
r=davidtwco Rework `untranslatable_diagnostic` lint Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This PR changes it to check calls to any function with an `impl Into<{D,Subd}iagnosticMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. It also lets us add `#[rustc_lint_diagnostics]` to a number of functions that don't have an `impl Into<{D,Subd}iagnosticMessage>`, such as `Diag::span`. r? ``@davidtwco``
2024-03-06Fix redundant import errors for preload extern crateyukang-1/+5
2024-03-06Add MatchKind member to the Match expr for pretty printing & fmtRoss Smyth-2/+2
2024-03-06Rewrite the `untranslatable_diagnostic` lint.Nicholas Nethercote-46/+128
Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This commit changes it to check calls to any function with an `impl Into<{D,Subd}iagMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. The commit also adds `#[allow(rustc::untranslatable_diagnostic)`] attributes to places that need it that are caught by the improved lint. These places that might be easy to convert to translatable diagnostics. Finally, it also: - Expands and corrects some comments. - Does some minor formatting improvements. - Adds missing `DecorateLint` cases to `tests/ui-fulldeps/internal-lints/diagnostics.rs`.
2024-03-05Split refining_impl_trait lint into _reachable, _internal variantsTyler Mandry-0/+6
2024-03-06Auto merge of #122041 - matthiaskrgr:rollup-imsmdke, r=matthiaskrgrbors-20/+51
Rollup of 8 pull requests Successful merges: - #121202 (Limit the number of names and values in check-cfg diagnostics) - #121301 (errors: share `SilentEmitter` between rustc and rustfmt) - #121658 (Hint user to update nightly on ICEs produced from outdated nightly) - #121846 (only compare ambiguity item that have hard error) - #121961 (add test for #78894 #71450) - #121975 (hir_analysis: enums return `None` in `find_field`) - #121978 (Fix duplicated path in the "not found dylib" error) - #121991 (Merge impl_trait_in_assoc_types_defined_by query back into `opaque_types_defined_by`) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-05Use `ControlFlow` in AST visitors.Jason Newcomb-10/+8
2024-03-05Convert `TypeVisitor` and `DefIdVisitor` to use `VisitorResult`Jason Newcomb-4/+4
2024-03-05Move visitor utils to `rustc_ast_ir`Jason Newcomb-2/+2
2024-03-05Limit the number of names and values in check-cfg diagnosticsUrgau-20/+51
2024-03-05Auto merge of #121780 - nnethercote:diag-renaming2, r=davidtwcobors-91/+82
Diagnostic renaming 2 A sequel to #121489. r? `@davidtwco`
2024-03-05Rename `BuiltinLintDiagnostics` as `BuiltinLintDiag`.Nicholas Nethercote-51/+42
Not the dropping of the trailing `s` -- this type describes a single diagnostic and its name should be singular.
2024-03-05Rename `SubdiagnosticMessageOp` as `SubdiagMessageOp`.Nicholas Nethercote-12/+12
2024-03-05Rename `SubdiagnosticMessage` as `SubdiagMessage`.Nicholas Nethercote-1/+1
2024-03-05Rename `DiagnosticMessage` as `DiagMessage`.Nicholas Nethercote-29/+29
2024-03-05Auto merge of #120675 - oli-obk:intrinsics3.0, r=pnkfelixbors-1/+1
Add a scheme for moving away from `extern "rust-intrinsic"` entirely All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic. This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic. cc https://github.com/rust-lang/rust/issues/63585 follow-up to #120500 MCP at https://github.com/rust-lang/compiler-team/issues/720
2024-03-04Rollup merge of #121969 - nnethercote:ParseSess-cleanups, r=wesleywiserMatthias Krüger-11/+9
`ParseSess` cleanups The main change here is to rename all `ParseSess` values as `psess`. Plus a few other small cleanups. r? `@wesleywiser`
2024-03-05Rename all `ParseSess` variables/fields/lifetimes as `psess`.Nicholas Nethercote-11/+9
Existing names for values of this type are `sess`, `parse_sess`, `parse_session`, and `ps`. `sess` is particularly annoying because that's also used for `Session` values, which are often co-located, and it can be difficult to know which type a value named `sess` refers to. (That annoyance is the main motivation for this change.) `psess` is nice and short, which is good for a name used this much. The commit also renames some `parse_sess_created` values as `psess_created`.
2024-03-04Add `is_intrinsic` helperOli Scherer-1/+1
2024-03-03Rollup merge of #121749 - jieyouxu:issue-45127-fix, r=petrochenkovMatthias Krüger-0/+5
Don't lint on executable crates with `non_snake_case` names Revives #111130, cc `@GilShoshan94.` Closes #45127.
2024-03-01Hoist only-executables check above producing crate ident许杰友 Jieyou Xu (Joe)-3/+5
2024-03-01Rollup merge of #121580 - Suyashtnt:issue-121502-fix, r=michaelwoeristerMatthias Krüger-1/+1
make unused_imports less assertive in test modules closes #121502 This is a fairly small change and I used the fix suggested in the example expected error message. Not sure if I should've rather used the alternatives but this one seems the most descriptive. Some alternatives: - if this is meant to be a test module, add `#[cfg(test)]` to the containing module - try adding #[cfg(test)] to this test module - consider adding #[allow(unused_imports)] if you want to silent the lint on the unused import - consider removing the unused import
2024-03-01Auto merge of #121728 - tgross35:f16-f128-step1-ty-updates, r=compiler-errorsbors-0/+2
Add stubs in IR and ABI for `f16` and `f128` This is the very first step toward the changes in https://github.com/rust-lang/rust/pull/114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary. These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`. The next steps will probably be AST support with parsing and the feature gate. r? `@compiler-errors` cc `@Nilstrieb` suggested breaking the PR up in https://github.com/rust-lang/rust/pull/120645#issuecomment-1925900572
2024-02-29Rollup merge of #121326 - ↵Matthias Krüger-9/+16
fmease:detect-empty-leading-where-clauses-on-ty-aliases, r=compiler-errors Detect empty leading where clauses on type aliases 1. commit: refactor the AST of type alias where clauses * I could no longer bear the look of `.0.1` and `.1.0` * Arguably moving `split` out of `TyAlias` into a substruct might not make that much sense from a semantic standpoint since it reprs an index into `TyAlias.predicates` but it's alright and it cleans up the usage sites of `TyAlias` 2. commit: fix an oversight: An empty leading where clause is still a leading where clause * semantically reject empty leading where clauses on lazy type aliases * e.g., on `#![feature(lazy_type_alias)] type X where = ();` * make empty leading where clauses on assoc types trigger lint `deprecated_where_clause_location` * e.g., `impl Trait for () { type X where = (); }`
2024-02-29Detect empty leading where-clauses on type aliasesLeón Orell Valerian Liehr-9/+16
2024-02-29Mark some once-again-unreachable paths as unreachable.Nicholas Nethercote-9/+5
This undoes the changes from #121482 and #121586, now that stashed errors will trigger more early aborts.
2024-02-28Auto merge of #121489 - nnethercote:diag-renaming, r=davidtwcobors-122/+120
Diagnostic renaming Renaming various diagnostic types from `Diagnostic*` to `Diag*`. Part of https://github.com/rust-lang/compiler-team/issues/722. There are more to do but this is enough for one PR. r? `@davidtwco`
2024-02-28Add `f16` and `f128` to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`Trevor Gross-0/+2
Make changes necessary to support these types in the compiler.
2024-02-28Don't lint snake-case on executable crate nameGil Shoshan-1/+4
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2024-02-28Remove the `UntranslatableDiagnosticTrivial` lint.Nicholas Nethercote-87/+1
It's a specialized form of the `UntranslatableDiagnostic` lint that is deny-by-default. Now that `UntranslatableDiagnostic` has been changed from allow-by-default to deny-by-default, the trivial variant is no longer needed.
2024-02-28Rename `DiagnosticStyledString` as `DiagStyledString`.Nicholas Nethercote-4/+4
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-119/+117
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-26Auto merge of #121516 - RalfJung:platform-intrinsics-begone, r=oli-obkbors-4/+1
remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics `@Amanieu` `@workingjubilee` I don't think there is any reason these need to be "special"? The [original RFC](https://rust-lang.github.io/rfcs/1199-simd-infrastructure.html) indicated eventually making them stable, but I think that is no longer the plan, so seems to me like we can clean this up a bit. Blocked on https://github.com/rust-lang/stdarch/pull/1538, https://github.com/rust-lang/rust/pull/121542.
2024-02-26Auto merge of #120586 - ShE3py:exprkind-err, r=fmeasebors-1/+1
Add `ErrorGuaranteed` to `ast::ExprKind::Err` See #119967 for context ``` \ \ _~^~^~_ \) / o o \ (/ '_ - _' / '-----' \ ``` r? fmease
2024-02-26Rollup merge of #120840 - ↵Guillaume Gomez-8/+42
HTGAzureX1212:HTGAzureX1212/unicode-identifier-types, r=fmease,Manishearth Split Diagnostics for Uncommon Codepoints: Add Individual Identifier Types This pull request further modifies the `uncommon_codepoints` lint, adding the individual identifier types of `Technical`, `Not_NFKC`, `Exclusion` and `Limited_Use` to the diagnostic message. Example rendered diagnostic: ``` error: identifier contains a Unicode codepoint that is not used in normalized strings: 'ij' --> $DIR/lint-uncommon-codepoints.rs:6:4 | LL | fn dijkstra() {} | ^^^^^^^ = note: this character is included in the Not_NFKC Unicode general security profile ``` Second step of #120228.
2024-02-26separate messages for individual categoriesHTGAzureX1212.-8/+42
2024-02-25Add `ErrorGuaranteed` to `ast::ExprKind::Err`Lieselotte-1/+1
2024-02-25Auto merge of #120393 - Urgau:rfc3373-non-local-defs, r=WaffleLapkinbors-0/+264
Implement RFC 3373: Avoid non-local definitions in functions This PR implements [RFC 3373: Avoid non-local definitions in functions](https://github.com/rust-lang/rust/issues/120363).
2024-02-25Rollup merge of #121586 - gurry:121532-ice-unwrap-on-none, r=cjgillotMatthias Krüger-5/+9
Don't use `unwrap()` in `ArrayIntoIter` lint when typeck fails Fixes #121532
2024-02-25Rollup merge of #121060 - clubby789:bool-newtypes, r=cjgillotMatthias Krüger-1/+1
Add newtypes for bool fields/params/return types Fixed all the cases of this found with some simple searches for `*/ bool` and `bool /*`; probably many more
2024-02-25Don't use `unwrap()` in `ArrayIntoIter` lint when typeck failsGurinder Singh-5/+9
2024-02-25make non-PartialEq-typed consts as patterns a hard errorRalf Jung-0/+5
2024-02-25make unused_imports less assertive in test modulesSuyashtnt-1/+1
closes #121502
2024-02-25remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsicsRalf Jung-4/+1