summary refs log tree commit diff
path: root/compiler/rustc_lint_defs/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-01-21Rollup merge of #106935 - TaKO8Ki:fix-104440, r=cjgillotMichael Goulet-1/+1
Fix `SingleUseLifetime` ICE Fixes #104440 cc: ``@matthiaskrgr``
2023-01-19Use UnordMap instead of FxHashMap in define_id_collections!().Michael Woerister-2/+3
2023-01-16fix #104440Takayuki Maeda-1/+1
2023-01-10create helper function for `rustc_lint_defs::Level` and remove it's ↵ozkanonur-0/+13
duplicated code r=ozkanonur Signed-off-by: ozkanonur <work@onurozkan.dev>
2022-10-07Rewrite representabilityCameron Steffen-0/+3
2022-10-01Compute `lint_levels` by definitionDeadbeef-5/+26
2022-09-22Revert "Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk"Camille GILLOT-26/+5
This reverts commit 2cb9a65684dba47c52de8fa938febf97a73e70a9, reversing changes made to 750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c.
2022-09-14Compute `lint_levels` by definitionDeadbeef-5/+26
2022-09-12Allow tool-lints to specify a feature-gate tooWim Looman-3/+7
2022-08-28Suggest calling when operator types mismatchMichael Goulet-1/+2
2022-08-22Tidyfinalchild-1/+1
2022-08-22Migrate deprecated_where_clause_location, forbidden_assoc_constraint, ↵finalchild-2/+2
keyword_lifetime, invalid_label, invalid_visibility
2022-08-22Use DiagnosticMessage for BufferedEarlyLint.msgfinalchild-4/+4
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-02Improve position named arguments lint underline and formatting namesPreston From-1/+13
For named arguments used as implicit position arguments, underline both the opening curly brace and either: * if there is formatting, the next character (which will either be the closing curl brace or the `:` denoting the start of formatting args) * if there is no formatting, the entire arg span (important if there is whitespace like `{ }`) This should make it more obvious where the named argument should be. Additionally, in the lint message, emit the formatting argument names without a dollar sign to avoid potentially confusion. Fixes #99907
2022-07-25Generate correct suggestion with named arguments used positionallyPreston From-1/+1
Address issue #99265 by checking each positionally used argument to see if the argument is named and adding a lint to use the name instead. This way, when named arguments are used positionally in a different order than their argument order, the suggested lint is correct. For example: ``` println!("{b} {}", a=1, b=2); ``` This will now generate the suggestion: ``` println!("{b} {a}", a=1, b=2); ``` Additionally, this check now also correctly replaces or inserts only where the positional argument is (or would be if implicit). Also, width and precision are replaced with their argument names when they exists. Since the issues were so closely related, this fix for issue #99265 also fixes issue #99266. Fixes #99265 Fixes #99266
2022-07-20avoid a `Symbol` to `String` conversionTakayuki Maeda-1/+1
2022-07-15Only suggest if span is not erroneousMichael Goulet-1/+1
2022-07-13Emit warning when named arguments are used positionally in formatPreston From-0/+1
Addresses Issue 98466 by emitting a warning if a named argument is used like a position argument (i.e. the name is not used in the string to be formatted). Fixes rust-lang#98466
2022-07-07Rollup merge of #98507 - xFrednet:rfc-2383-manual-expectation-magic, ↵Dylan DPC-0/+7
r=wesleywiser Finishing touches for `#[expect]` (RFC 2383) This PR adds documentation and some functionality to rustc's lint passes, to manually fulfill expectations. This is needed for some lints in Clippy. Hopefully, it should be one of the last things before we can move forward with stabilizing this feature. As part of this PR, I've also updated `clippy::duplicate_mod` to showcase how this new functionality can be used and to ensure that it works correctly. --- changelog: [`duplicate_mod`]: Fixed lint attribute interaction r? `@wesleywiser` cc: https://github.com/rust-lang/rust/issues/97660, https://github.com/rust-lang/rust/issues/85549 And I guess that's it. Here have a magical unicorn :unicorn:
2022-07-06Add function to manually fulfill lint expectations (RFC 2383)xFrednet-0/+7
2022-06-22add "was" to pluralize macro and use itTakayuki Maeda-0/+3
2022-06-16Support lint expectations for `--force-warn` lints (RFC 2383)xFrednet-4/+10
2022-06-03Use serde_json for json error messagesbjorn3-1/+3
2022-05-20Lint single-use-lifetimes on the AST.Camille GILLOT-1/+15
2022-04-27Plumb through rustc_lint_defs::Level as enum rather than string.Jeremy Fitzhardinge-0/+7
2022-04-20Auto merge of #96082 - michaelwoerister:less_impl_stable_hash_via_hash, ↵bors-3/+2
r=compiler-errors incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it. Fixes https://github.com/rust-lang/rust/issues/96013.
2022-04-19Rollup merge of #96086 - jsgf:remove-extern-location, r=davidtwcoDylan DPC-9/+0
Remove `--extern-location` and all associated code `--extern-location` was an experiment to investigate the best way to generate useful diagnostics for unused dependency warnings by enabling a build system to identify the corresponding build config. While I did successfully use this, I've since been convinced the alternative `--json unused-externs` mechanism is the way to go, and there's no point in having two mechanisms with basically the same functionality. This effectively reverts https://github.com/rust-lang/rust/pull/72603
2022-04-19incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it.Michael Woerister-3/+2
2022-04-17Lint elided lifetimes in path on the AST.Camille GILLOT-0/+1
2022-04-15Remove `--extern-location` and all associated codeJeremy Fitzhardinge-9/+0
`--extern-location` was an experiment to investigate the best way to generate useful diagnostics for unused dependency warnings by enabling a build system to identify the corresponding build config. While I did successfully use this, I've since been convinced the alternative `--json unused-externs` mechanism is the way to go, and there's no point in having two mechanisms with basically the same functionality. This effectively reverts https://github.com/rust-lang/rust/pull/72603
2022-04-05span: move `MultiSpan`David Wood-1/+2
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-03-15Rollup merge of #94958 - est31:pluralize, r=oli-obkMatthias Krüger-0/+6
Support other types of pluralization in pluralize macro
2022-03-15Support other types of pluralization in pluralize macroest31-0/+6
2022-03-14Rollup merge of #94670 - xFrednet:rfc-2383-expect-impl-after-party, ↵Matthias Krüger-3/+5
r=flip1995,wesleywiser Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383) This PR updates unstable `ExpectationIds` in stashed diagnostics and adds some asserts to ensure that the stored expectations are really empty in the end. Additionally, it handles the `#[expect(unfulfilled_lint_expectations)]` case. According to the [Errors and lints docs](https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-levels) the `error` level should only be used _"when the compiler detects a problem that makes it unable to compile the program"_. As this isn't the case with `#[expect(unfulfilled_lint_expectations)]` I decided to only create a warning. To avoid adding a new lint only for this case, I simply emit a `unfulfilled_lint_expectations` diagnostic with an additional note. --- r? `@wesleywiser` I'm requesting a review from you since you reviewed the previous PR https://github.com/rust-lang/rust/pull/87835. You are welcome to reassign it if you're busy :upside_down_face: rfc: [RFC-2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html) tracking issue: https://github.com/rust-lang/rust/issues/85549 cc: `@flip1995` In case you're also interested in this :)
2022-03-07Fix typos in `LintExpectationId` docsxFrednet-3/+5
2022-03-05Change to lintJack Huey-0/+1
2022-03-05Improve unexpected_cfgs lint when their is no value expectedLoïc BRANSTETT-1/+1
2022-03-02Address review commentsxFrednet-2/+2
2022-03-02Reduced the size of `LintExpectationId` by 12 bytes (RFC-2383)xFrednet-5/+9
2022-03-02Test `expect` with `forbid` and fix doc errors (RFC-2383)xFrednet-7/+5
* Add test to expect and the forbid a lint (RFC 2383)
2022-03-02Expect each lint in attribute individually (RFC-2383)xFrednet-22/+38
2022-03-02Make `LintExpectationId` stable between compilation sessions (RFC-2383)xFrednet-18/+64
2022-03-02Set `LintExpectationId` in level and collect fulfilled ones (RFC-2383)xFrednet-2/+2
* Collect lint expectations and set expectation ID in level (RFC-2383) * Collect IDs of fulfilled lint expectations from diagnostics (RFC 2383)
2022-03-02Added `Expect` lint level and attribute (RFC-2383)xFrednet-2/+54
* Also added the `LintExpectationId` which will be used in future commits
2022-02-22Improve diagnostic of the unexpected_cfgs lintLoïc BRANSTETT-0/+1
2022-02-01update `FutureIncompatibilityReason`lcnr-0/+5
2022-01-23Remove deduplication of early lintsAaron Hill-5/+2
We already have a general mechanism for deduplicating reported lints, so there's no need to have an additional one for early lints specifically. This allows us to remove some `PartialEq` impls.
2021-12-21Rollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplettMatthias Krüger-1/+1
Suggest adding a `#[cfg(test)]` to to a test module closes #88138
2021-12-18Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726Matthias Krüger-1/+0
Lint bare traits in AstConv. Removing the lint from lowering allows to: - make lowering querification easier; - have the lint implementation in only one place. r? `@estebank`