about summary refs log tree commit diff
path: root/compiler/rustc_lint_defs/src
AgeCommit message (Collapse)AuthorLines
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)
2022-03-02Added `unfulfilled_lint_expectations` lint for (RFC-2383)xFrednet-0/+34
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-16Implement --check-cfg option (RFC 3013)Loïc BRANSTETT-0/+38
Co-authored-by: Urgau <lolo.branstett@numericable.fr> Co-authored-by: Marcelina Kościelnicka <mwk@0x04.net>
2022-02-01implement lint for suspicious auto trait implslcnr-0/+35
2022-02-01update `FutureIncompatibilityReason`lcnr-0/+13
2022-01-28Rollup merge of #92611 - Amanieu:asm-reference, r=m-ou-seMatthias Krüger-0/+4
Add links to the reference and rust by example for asm! docs and lints These were previously removed in #91728 due to broken links. cc ``@ehuss`` since this updates the rust-by-example submodule
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.
2022-01-21Reject unsupported naked functionsTomasz Miąsko-47/+0
Transition unsupported naked functions future incompatibility lint into an error: * Naked functions must contain a single inline assembly block. Introduced as future incompatibility lint in 1.50 #79653. Change into an error fixes a soundness issue described in #32489. * Naked functions must not use any forms of inline attribute. Introduced as future incompatibility lint in 1.56 #87652.
2022-01-19Add links to the reference and rust by example for asm! docs and lintsAmanieu d'Antras-0/+4
2022-01-13Fix lints documentshafeoz-5/+37
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`
2021-12-16Rollup merge of #91172 - Ethiraric:ethiraric/fix90979, r=petrochenkovMatthias Krüger-0/+30
Warn when a `#[test]`-like built-in attribute macro is present multiple times. Fixes #90979.
2021-12-16suggest adding a `#[cfg(test)]` to test modulesTakayuki Maeda-1/+1
remove a empty line import `module_to_string` use `contains("test")` show a suggestion in case module starts_with/ends_with "test" replace `parent` with `containing`
2021-12-15Add a lint for duplicated attributes.Ethiraric-0/+30
2021-12-14Disable asm lint example tests since they only work on x86_64Amanieu d'Antras-2/+2
2021-12-14Fix lint examples on non-x86_64Amanieu d'Antras-0/+2
2021-12-12Stabilize asm! and global_asm!Amanieu d'Antras-37/+9
They are also removed from the prelude as per the decision in https://github.com/rust-lang/rust/issues/87228. stdarch and compiler-builtins are updated to work with the new, stable asm! and global_asm! macros.
2021-12-11Remove useless variant.Camille GILLOT-1/+0
2021-12-07Future compatibility warning on cfg_attr on crate_type and crate_namebjorn3-0/+36
2021-12-04Lint bare traits in AstConv.Camille GILLOT-1/+0
2021-11-05Properly register text_direction_codepoint_in_comment lint.Hans Kratz-0/+1
2021-11-01Auto merge of #90463 - matthiaskrgr:rollup-eljk9vo, r=matthiaskrgrbors-1/+3
Rollup of 8 pull requests Successful merges: - #89826 (Feature gate + make must_not_suspend allow-by-default) - #89929 (Handling submodule update failures more gracefully from x.py) - #90333 (rustdoc: remove flicker during page load) - #90349 (Fix rare ICE during typeck in rustdoc scrape_examples) - #90398 (Document `doc(keyword)` unstable attribute) - #90441 (Test that promotion follows references when looking for drop) - #90450 (Remove `rustc_hir::hir_id::HirIdVec`) - #90452 (Remove unnecessary `Option` from `promote_candidate` return type) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-31Feature gate and make must_not_suspend allow-by-defaultGus Wynn-1/+3
This lint is not yet ready for stable use, primarily due to false positives in edge cases; we want to test it out more before stabilizing.
2021-10-31Lint against RTL unicode codepoints in literals and commentsEsteban Küber-0/+29
Address CVE-2021-42574.
2021-10-18Make all proc-macro back-compat lints deny-by-defaultAaron Hill-2/+2
The affected crates have had plenty of time to update. By keeping these as lints rather than making them hard errors, we ensure that downstream crates will still be able to compile, even if they transitive depend on broken versions of the affected crates. This should hopefully discourage anyone from writing any new code which relies on the backwards-compatibility behavior.
2021-10-08Add feature gate to non_exhaustive_omitted_patterns lintDevin Ragotzy-0/+4
Actually add the feature to the lints ui test Add tracking issue to the feature declaration Rename feature gate to non_exhaustive_omitted_patterns_lint Add more omitted_patterns lint feature gate
2021-10-07Rollup merge of #89461 - crlf0710:dyn_upcasting_lint, r=nikomatsakisGuillaume Gomez-0/+46
Add `deref_into_dyn_supertrait` lint. Initial implementation of #89460. Resolves #89190. Maybe also worth a beta backport if necessary. r? `@nikomatsakis`
2021-10-04Make `proc_macro_derive_resolution_fallback` a future-breakage lintAaron Hill-0/+1
When `cargo report future-incompatibilities` is stabilized (see #71249), this will cause dependencies that trigger this lint to be included in the report.
2021-10-03Add `deref_into_dyn_supertrait` lint.Charles Lew-0/+46
2021-09-22Auto merge of #88865 - guswynn:must_not_suspend, r=oli-obkbors-0/+39
Implement `#[must_not_suspend]` implements #83310 Some notes on the impl: 1. The code that searches for the attribute on the ADT is basically copied from the `must_use` lint. It's not shared, as the logic did diverge 2. The RFC does specify that the attribute can be placed on fn's (and fn-like objects), like `must_use`. I think this is a direct copy from the `must_use` reference definition. This implementation does NOT support this, as I felt that ADT's (+ `impl Trait` + `dyn Trait`) cover the usecase's people actually want on the RFC, and adding an imp for the fn call case would be significantly harder. The `must_use` impl can do a single check at fn call stmt time, but `must_not_suspend` would need to answer the question: "for some value X with type T, find any fn call that COULD have produced this value". That would require significant changes to `generator_interior.rs`, and I would need mentorship on that. `@eholk` and I are discussing it. 3. `@estebank` do you know a way I can make the user-provided `reason` note pop out? right now it seems quite hidden Also, I am not sure if we should run perf on this r? `@nikomatsakis`
2021-09-20Adjust documentation for compatibility with 2021Mark Rousskov-2/+4
This also adjusts the lint docs generation to accept (and ignore) an allow attribute, rather than expecting the documentation to be immediately followed by the lint name.
2021-09-15factor into struct, and commentsGus Wynn-3/+3