summary refs log tree commit diff
path: root/compiler/rustc_lint_defs/src
AgeCommit message (Collapse)AuthorLines
2022-06-23Rollup merge of #98283 - TaKO8Ki:point-at-private-fields-in-struct-literal, ↵Michael Goulet-0/+3
r=compiler-errors Point at private fields in struct literal closes #95872
2022-06-22add "was" to pluralize macro and use itTakayuki Maeda-0/+3
2022-06-18Auto merge of #97652 - RalfJung:cenum_impl_drop_cast, r=nagisabors-3/+3
make cenum_impl_drop_cast deny-by-default Also make it show up as future breakage diagnostic. In https://github.com/rust-lang/rust/pull/96862 we are proposing to change behavior of those drops *again*, so this looks like a good opportunity to increase our pressure on getting them out of the ecosystem. Looking at the [tracking issue](https://github.com/rust-lang/rust/issues/73333), so far nobody spoke up in favor of this (accidental) feature. Cc https://github.com/rust-lang/rust/issues/73333 `@oli-obk`
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-06-02fix lint doctestsRalf Jung-2/+1
2022-06-02make cenum_impl_drop_cast deny-by-default and show up as future breakage ↵Ralf Jung-1/+2
diagnostic
2022-05-23Fix typoest31-1/+1
2022-05-20Lint single-use-lifetimes on the AST.Camille GILLOT-1/+15
2022-05-14Allow the unused_macro_rules lint for nowest31-1/+2
This makes the transition easier as e.g. allow directives won't fire the unknown lint warning once it is turned to warn by default in the future. This is especially important compared to other lints in the unused group because the _ prefix trick doesn't exist for macro rules, so allowing is the only option (either of unused_macro_rules, or of the entire unused group, but that is not as informative to readers). Allowing the lint also makes it possible to work on possible heuristics for disabling the macro in specific cases.
2022-05-12Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkovbors-0/+44
Implement a lint to warn about unused macro rules This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros. ```rust macro_rules! unused_empty { (hello) => { println!("Hello, world!") }; () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used } fn main() { unused_empty!(hello); } ``` Builds upon #96149 and #96156. Fixes #73576
2022-05-09Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errorsbors-6/+5
Remove `#[rustc_deprecated]` This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`. I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2022-05-07Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errorsbors-1/+2
Begin fixing all the broken doctests in `compiler/` Begins to fix #95994. All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are. There are also a few that I marked `ignore` that could maybe be made to work but seem less important. Each `ignore` has a rough "reason" for ignoring after it parentheses, with - `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax" - `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy. - `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR. - `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup. Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful. I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool
2022-05-06Auto merge of #96268 - ↵bors-35/+0
jackh726:remove-mutable_borrow_reservation_conflict-lint, r=nikomatsakis Remove mutable_borrow_reservation_conflict lint and allow the code pattern This was the only breaking issue with the NLL stabilization PR. Lang team decided to go ahead and allow this. r? `@nikomatsakis` Closes #59159 Closes #56254
2022-05-04Add unused_macro_rules lint definitionest31-0/+44
Not fired yet.
2022-05-02fix most compiler/ doctestsElliot Roberts-1/+2
2022-04-27Plumb through rustc_lint_defs::Level as enum rather than string.Jeremy Fitzhardinge-0/+7
2022-04-20Remove mutable_borrow_reservation_conflict lintJack Huey-35/+0
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-14make unaligned_reference warning visible in future compat reportRalf Jung-0/+1
2022-04-14Update error code docsJacob Pratt-1/+1
2022-04-14Error on `#[rustc_deprecated]`Jacob Pratt-5/+4
2022-04-14make unaligned_references lint deny-by-defaultRalf Jung-3/+1
2022-04-08Split `fuzzy_provenance_casts` into lossy and fuzzy, feature gate and test itniluxv-16/+72
* split `fuzzy_provenance_casts` into a ptr2int and a int2ptr lint * feature gate both lints * update documentation to be more realistic short term * add tests for these lints
2022-04-08WIP PROOF-OF-CONCEPT: Make the compiler complain about all int<->ptr casts.Aria Beingessner-0/+36
ALL OF THEM
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-30Spellchecking compiler commentsYuri Astrakhan-3/+3
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
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-10Rollup merge of #94274 - djkoloski:unknown_unstable_lints, r=tmandryDylan DPC-0/+23
Treat unstable lints as unknown This change causes unstable lints to be ignored if the `unknown_lints` lint is allowed. To achieve this, it also changes lints to apply as soon as they are processed. Previously, lints in the same set were processed as a batch and then all simultaneously applied. Implementation of https://github.com/rust-lang/compiler-team/issues/469
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-1/+1
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2022-03-08Fix docs, fix incorrect lint source in noteDavid Koloski-1/+1
2022-03-08Fill out documentation for new lintDavid Koloski-2/+15
2022-03-08Switch the primary diagnostic to `unknown_lints`David Koloski-0/+1
This also affects the `non_exhaustive_omitted_patterns` and `must_not_suspend` lints as they are not stable. This also changes the diagnostic level to pull from `unknown_lints` instead of always being allow or deny.
2022-03-08Treat unstable lints as unknownDavid Koloski-0/+9
This change causes unstable lints to be ignored if the `unknown_lints` lint is allowed. To achieve this, it also changes lints to apply as soon as they are processed. Previously, lints in the same set were processed as a batch and then all simultaneously applied. Implementation of https://github.com/rust-lang/compiler-team/issues/469
2022-03-07Fix typos in `LintExpectationId` docsxFrednet-3/+5
2022-03-05Change to lintJack Huey-0/+35
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)