about summary refs log tree commit diff
path: root/compiler/rustc_lint_defs/src
AgeCommit message (Collapse)AuthorLines
2021-06-26Auto merge of #86637 - ehuss:spellings, r=dtolnaybors-1/+1
Fix a few misspellings.
2021-06-25Fix a few misspellings.Eric Huss-1/+1
2021-06-25Fix new lintsRyan Levick-2/+2
2021-06-25Add back missing docRyan Levick-0/+1
2021-06-25Address PR feedbackRyan Levick-7/+4
2021-06-25Change how edition based future compatibility warnings are handledRyan Levick-40/+39
2021-06-22Auto merge of #85707 - jam1garner:future_prelude_collision_lint, r=nikomatsakisbors-0/+50
Add `future_prelude_collision` lint Implements #84594. (RFC rust-lang/rfcs#3114 ([rendered](https://github.com/rust-lang/rfcs/blob/master/text/3114-prelude-2021.md))) Not entirely complete but wanted to have my progress decently available while I finish off the last little bits. Things left to implement: * [x] UI tests for lints * [x] Only emit lint for 2015 and 2018 editions * [ ] Lint name/message bikeshedding * [x] Implement for `FromIterator` (from best I can tell, the current approach as mentioned from [this comment](https://github.com/rust-lang/rust/issues/84594#issuecomment-847288288) won't work due to `FromIterator` instances not using dot-call syntax, but if I'm correct about this then that would also need to be fixed for `TryFrom`/`TryInto`)* * [x] Add to `rust-2021-migration` group? (See #85512) (added to `rust-2021-compatibility` group) * [ ] Link to edition guide in lint docs *edit: looked into it, `lookup_method` will also not be hit for `TryFrom`/`TryInto` for non-dotcall syntax. If anyone who is more familiar with typecheck knows the equivalent for looking up associated functions, feel free to chime in.
2021-06-15Add future_prelude_collision to 2021 compat groupjam1garner-1/+5
* Add to 2021 compatibility group * Set default to Allow
2021-06-14Improve documentation for `future_prelude_collision` lintjam1garner-3/+4
2021-06-14Add future_prelude_collision lintjam1garner-0/+45
2021-06-10Make OR_PATTERNS_BACK_COMPAT be a 2021 future-incompatible linthi-rustin-0/+4
2021-06-04Fix `deny(invalid_doc_attributes)`Joshua Nelson-0/+1
2021-06-03Rollup merge of #85852 - m-ou-se:machineapplicable-docs, r=nikomatsakisYuki Okushi-1/+5
Clarify meaning of MachineApplicable suggestions. This documents the meaning of MachineApplicable in case of multiple suggestions, as described in https://github.com/rust-lang/rust/issues/53934#issuecomment-831396123 r? ``@nikomatsakis``
2021-05-31Clarify meaning of MachineApplicable suggestions.Mara Bos-1/+5
2021-05-06Add additional migrations to handle auto-traits and clone traitsRoxane-7/+35
Combine all 2229 migrations under one flag name
2021-05-04Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakisbors-1/+5
Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021 This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition. r? `@estebank`
2021-04-20TypoOli Scherer-1/+1
2021-04-20Add an attribute to be able to configure the limitOli Scherer-1/+1
2021-04-20Implement a lint that highlights all moves larger than 1000 bytesOli Scherer-0/+34
2021-04-19fix few typosklensy-2/+2
2021-04-14Update docs for unsafe_op_in_unsafe_fn stability.Eric Huss-3/+4
2021-04-13Add compatibility info to lintsRyan Levick-1/+5
2021-04-10Add `bad_asm_style` to HardwiredLintsAmanieu d'Antras-0/+1
2021-04-03Fix rustc_lint_defs documentation typoBen Mezger-1/+1
2021-04-01add OR_PATTERNS_BACK_COMPAT linthi-rustin-0/+36
test: add more cases test: add comments refine msg
2021-03-27Auto merge of #83103 - petrochenkov:unilex, r=Aaron1011bors-1/+1
resolve: Partially unify early and late scope-relative identifier resolution Reuse `early_resolve_ident_in_lexical_scope` instead of a chunk of code in `resolve_ident_in_lexical_scope` doing the same job. `early_resolve_ident_in_lexical_scope`/`visit_scopes` had to be slightly extended to be able to 1) start from a specific module instead of the current parent scope and 2) report one deprecation lint. `early_resolve_ident_in_lexical_scope` still doesn't support walking through "ribs", that part is left in `resolve_ident_in_lexical_scope` (moreover, I'm pretty sure it's buggy, but that's a separate issue, cc https://github.com/rust-lang/rust/issues/52389 at least).
2021-03-27resolve: Partially unify early and late scope-relative ident resolutionVadim Petrochenkov-1/+1
2021-03-27make unaligned_refereces future-incompat lint warn-by-default, and remove ↵Ralf Jung-54/+11
the safe_packed_borrows lint that it replaces
2021-03-25Refactor #82270 as lint instead of an errorAmanieu d'Antras-0/+46
2021-03-14Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`Aaron Hill-1/+53
Now that future-incompat-report support has landed in nightly Cargo, we can start to make progress towards removing the various proc-macro back-compat hacks that have accumulated in the compiler. This PR introduces a new lint `proc_macro_back_compat`, which results in a future-incompat-report entry being generated. All proc-macro back-compat warnings will be grouped under this lint. Note that this lint will never actually become a hard error - instead, we will remove the special cases for various macros, which will cause older versions of those crates to emit some other error. I've added code to fire this lint for the `time-macros-impl` case. This is the easiest case out of all of our current back-compat hacks - the crate was renamed to `time-macros`, so seeing a filename with `time-macros-impl` guarantees that an older version of the parent `time` crate is in use. When Cargo's future-incompat-report feature gets stabilized, affected users will start to see future-incompat warnings when they build their crates.
2021-03-10Rollup merge of #79208 - LeSeulArtichaut:stable-unsafe_op_in_unsafe_fn, ↵Yuki Okushi-8/+1
r=nikomatsakis Stabilize `unsafe_op_in_unsafe_fn` lint This makes it possible to override the level of the `unsafe_op_in_unsafe_fn`, as proposed in https://github.com/rust-lang/rust/issues/71668#issuecomment-729770896. Tracking issue: #71668 r? ```@nikomatsakis``` cc ```@SimonSapin``` ```@RalfJung``` # Stabilization report This is a stabilization report for `#![feature(unsafe_block_in_unsafe_fn)]`. ## Summary Currently, the body of unsafe functions is an unsafe block, i.e. you can perform unsafe operations inside. The `unsafe_op_in_unsafe_fn` lint, stabilized here, can be used to change this behavior, so performing unsafe operations in unsafe functions requires an unsafe block. For now, the lint is allow-by-default, which means that this PR does not change anything without overriding the lint level. For more information, see [RFC 2585](https://github.com/rust-lang/rfcs/blob/master/text/2585-unsafe-block-in-unsafe-fn.md) ### Example ```rust // An `unsafe fn` for demonstration purposes. // Calling this is an unsafe operation. unsafe fn unsf() {} // #[allow(unsafe_op_in_unsafe_fn)] by default, // the behavior of `unsafe fn` is unchanged unsafe fn allowed() { // Here, no `unsafe` block is needed to // perform unsafe operations... unsf(); // ...and any `unsafe` block is considered // unused and is warned on by the compiler. unsafe { unsf(); } } #[warn(unsafe_op_in_unsafe_fn)] unsafe fn warned() { // Removing this `unsafe` block will // cause the compiler to emit a warning. // (Also, no "unused unsafe" warning will be emitted here.) unsafe { unsf(); } } #[deny(unsafe_op_in_unsafe_fn)] unsafe fn denied() { // Removing this `unsafe` block will // cause a compilation error. // (Also, no "unused unsafe" warning will be emitted here.) unsafe { unsf(); } } ```
2021-03-05Make invalid_doc_attribute lint pluralGuillaume Gomez-2/+2
2021-03-04Add extra check for #[doc(test(...)] attributeGuillaume Gomez-3/+6
2021-03-04Add new edition 2021 link: INVALID_DOC_ATTRIBUTEGuillaume Gomez-0/+27
2021-03-01Address review commentsJoshua Nelson-12/+0
- Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly - Update documentation This also takes the opportunity to make the `no-crate-level-doc-lint` test more specific.
2021-03-01Rename rustdoc lints to be a tool lint instead of built-in.Joshua Nelson-83/+0
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` - Ensure that the old lint names still work and give deprecation errors - Register lints even when running doctests Otherwise, all `rustdoc::` lints would be ignored. - Register all existing lints as removed This unfortunately doesn't work with `register_renamed` because tool lints have not yet been registered when rustc is running. For similar reasons, `check_backwards_compat` doesn't work either. Call `register_removed` directly instead. - Fix fallout + Rustdoc lints for compiler/ + Rustdoc lints for library/ Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for `rustdoc::intra_doc_link_resolution_failure`, since there was no time when the latter was valid.
2021-02-27Enable report_in_external_macro in unaligned_referencesTaiki Endo-0/+1
2021-02-18Add explanations and suggestions to `irrefutable_let_patterns` lintCamelid-5/+3
2021-02-18Stabilize `unsafe_op_in_unsafe_fn` lintLeSeulArtichaut-8/+1
2021-02-17replace if-let and while-let with `if let` and `while let`Takayuki Maeda-5/+5
2021-02-07Add `--extern-loc` to augment unused crate dependency diagnosticsJeremy Fitzhardinge-0/+9
This allows a build system to indicate a location in its own dependency specification files (eg Cargo's `Cargo.toml`) which can be reported along side any unused crate dependency. This supports several types of location: - 'json' - provide some json-structured data, which is included in the json diagnostics in a `tool_metadata` field - 'raw' - emit the provided string into the output. This also appears as a json string in `tool_metadata`. If no `--extern-location` is explicitly provided then a default json entry of the form `"tool_metadata":{"name":<cratename>,"path":<cratepath>}` is emitted.
2021-02-07expand/resolve: Turn `#[derive]` into a regular macro attributeVadim Petrochenkov-2/+49
2021-02-04Rollup merge of #81556 - nikomatsakis:forbidden-lint-groups-lint, r=pnkfelixMara Bos-0/+39
introduce future-compatibility warning for forbidden lint groups We used to ignore `forbid(group)` scenarios completely. This changed in #78864, but that led to a number of regressions (#80988, #81218). This PR introduces a future compatibility warning for the case where a group is forbidden but then an individual lint within that group is allowed. We now issue a FCW when we see the "allow", but permit it to take effect. r? ``@Mark-Simulacrum``
2021-02-03make const_err a future incompat lintRalf Jung-0/+4
2021-02-02introduce future-compatibility warning for forbidden lint groupsNiko Matsakis-0/+39
We used to ignore `forbid(group)` scenarios completely. This changed in #78864, but that led to a number of regressions (#80988, #81218). This PR introduces a future compatibility warning for the case where a group is forbidden but then an individual lint within that group is allowed. We now issue a FCW when we see the "allow", but permit it to take effect.
2021-02-01Mark the lint doc as compile_failAman Arora-1/+1
2021-01-31Add lint for 2229 migrationsAman Arora-0/+46
2021-01-28Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lintAaron Hill-0/+48
cc #79813 This PR adds an allow-by-default future-compatibility lint `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS`. It fires when a trailing semicolon in a macro body is ignored due to the macro being used in expression position: ```rust macro_rules! foo { () => { true; // WARN } } fn main() { let val = match true { true => false, _ => foo!() }; } ``` The lint takes its level from the macro call site, and can be allowed for a particular macro by adding `#[allow(semicolon_in_expressions_from_macros)]`. The lint is set to warn for all internal rustc crates (when being built by a stage1 compiler). After the next beta bump, we can enable the lint for the bootstrap compiler as well.
2021-01-22update const_err descriptionRalf Jung-26/+7
2021-01-15Don't mark `ineffective_unstable_trait_impl` as an internal lintJoshua Nelson-3/+24
It's not an internal lint: - It's not in the rustc::internal lint group - It's on unconditionally, because it actually lints `staged_api`, not the compiler This fixes a bug where `#[deny(rustc::internal)]` would warn that `rustc::internal` was an unknown lint.