summary refs log tree commit diff
path: root/compiler/rustc_lint/src
AgeCommit message (Collapse)AuthorLines
2022-02-11Take in account the unreachable! macro in the non_fmt_panic lintLoïc BRANSTETT-3/+22
2022-02-09Rollup 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
2021-12-21Rollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplettMatthias Krüger-1/+9
Suggest adding a `#[cfg(test)]` to to a test module closes #88138
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-20/+19
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-19Rollup merge of #91956 - notriddle:notriddle/unused-parens-range, r=nagisaMatthias Krüger-1/+4
fix(rustc_lint): better detect when parens are necessary Fixes #90807
2021-12-18Rollup merge of #92032 - petrochenkov:extblockpath, r=oli-obkMatthias Krüger-2/+2
hir: Do not introduce dummy type names for `extern` blocks in def paths Use a separate nameless `DefPathData` variant instead. Extracted from https://github.com/rust-lang/rust/pull/91795.
2021-12-18hir: Do not introduce dummy type names for `extern` blocks in def pathsVadim Petrochenkov-2/+2
Use a separate nameless `DefPathData` variant instead
2021-12-18Rollup merge of #91818 - camelid:unused-result-type, r=jackh726Matthias Krüger-1/+3
Show the unused type for `unused_results` lint I think it's helpful to know what type was unused when looking at these warnings. The type will likely determine whether the result *should* be used, or whether it should just be ignored. Including the type also matches the behavior of the `must_use` lint: unused `SomeType` that must be used.
2021-12-18Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726Matthias Krüger-10/+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-17fix(rustc_lint): mark the parens around `(1..loop {})` as unusedMichael Howell-1/+1
2021-12-16suggest adding a `#[cfg(test)]` to test modulesTakayuki Maeda-1/+9
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-15fix(rustc_lint): better detect when parens are necessaryMichael Howell-1/+4
Fixes #90807
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-14/+13
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-6/+6
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-15Rollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcmMatthias Krüger-1/+0
Stabilize `iter::zip` Hello all! As the tracking issue (#83574) for `iter::zip` completed the final commenting period without any concerns being raised, I hereby submit this stabilization PR on the issue. As the pull request that introduced the feature (#82917) states, the `iter::zip` function is a shorter way to zip two iterators. As it's generally a quality-of-life/ergonomic improvement, it has been integrated into the codebase without any trouble, and has been used in many places across the rust compiler and standard library since March without any issues. For more details, I would refer to `@cuviper's` original PR, or the [function's documentation](https://doc.rust-lang.org/std/iter/fn.zip.html).
2021-12-15Rollup merge of #90939 - estebank:wg-af-polish, r=tmandryMatthias Krüger-1/+1
Tweak errors coming from `for`-loop, `?` and `.await` desugaring * Suggest removal of `.await` on non-`Future` expression * Keep track of obligations introduced by desugaring * Remove span pointing at method for obligation errors coming from desugaring * Point at called local sync `fn` and suggest making it `async` ``` error[E0277]: `()` is not a future --> $DIR/unnecessary-await.rs:9:10 | LL | boo().await; | -----^^^^^^ `()` is not a future | | | this call returns `()` | = help: the trait `Future` is not implemented for `()` help: do not `.await` the expression | LL - boo().await; LL + boo(); | help: alternatively, consider making `fn boo` asynchronous | LL | async fn boo () {} | +++++ ``` Fix #66731.
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-12-13Keep info on pre-desugaring expression for better "incorrect `.await`" ↵Esteban Kuber-1/+1
suggestion Keep the `HirId` of `.await`ed expressions so in the case of a `fn` call on on a sync `fn`, we can suggest maybe turning it into an `async fn`.
2021-12-12Address review feedbackAmanieu d'Antras-1/+0
2021-12-12Stabilize asm! and global_asm!Amanieu d'Antras-5/+3
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-11Show the unused type for `unused_results` lintNoah Lev-1/+3
I think it's helpful to know what type was unused when looking at these warnings. The type will likely determine whether the result *should* be used, or whether it should just be ignored. Including the type also matches the behavior of the `must_use` lint: unused `SomeType` that must be used.
2021-12-11Remove useless variant.Camille GILLOT-20/+1
2021-12-09Remove redundant [..]sest31-1/+1
2021-12-04Lint bare traits in AstConv.Camille GILLOT-10/+0
2021-12-03Use let_else in some more places in rustc_lintest31-69/+52
2021-12-02Rollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbiniMatthias Krüger-1/+0
Bump stage0 compiler r? `@pietroalbini` (or anyone else)
2021-12-01Auto merge of #91255 - b-naber:normalization-ice, r=jackh276bors-1/+3
Implement version of normalize_erasing_regions that allows for normalization failure Fixes https://github.com/rust-lang/rust/issues/59324 Fixes https://github.com/rust-lang/rust/issues/67684 Fixes https://github.com/rust-lang/rust/issues/69398 Fixes https://github.com/rust-lang/rust/issues/71113 Fixes https://github.com/rust-lang/rust/issues/82079 Fixes #85103 Fixes https://github.com/rust-lang/rust/issues/88856 Fixes #91231 Fixes https://github.com/rust-lang/rust/issues/91234 Previously we called `normalize_erasing_regions` inside `layout_of`. `normalize_erasing_regions` assumes that the normalization succeeds. Since some `layout_of` calls happen before typecheck has finished, we introduce a new variant that allows for returning an error.
2021-12-01implement version of normalize_erasing_regions that doesn't assume value is ↵b-naber-1/+3
normalizable
2021-12-01Rollup merge of #90985 - camsteffen:diag-name-usage, r=jackh726Matthias Krüger-48/+52
Use `get_diagnostic_name` more
2021-11-30Emit a warning on generic parameters with doc commentsJoshua Nelson-0/+4
2021-11-30Apply cfg-bootstrap switchMark Rousskov-1/+0
2021-11-28Take a LocalDefId in expect_*item.Camille GILLOT-1/+1
2021-11-16Use get_diagnostic_name moreCameron Steffen-48/+52
2021-11-15Stabilize format_args_captureJosh Triplett-1/+1
Works as expected, and there are widespread reports of success with it, as well as interest in it.
2021-11-12rustc_feature: Convert `BuiltinAttribute` from tuple to a structVadim Petrochenkov-6/+5
2021-11-07Auto merge of #90668 - matthiaskrgr:clippy_nov7, r=jyn514bors-67/+53
more clippy fixes
2021-11-07more clippy fixesMatthias Krüger-67/+53
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-5/+4
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-04Optimize literal, doc comment lint as well, extract function.Hans Kratz-10/+6
2021-11-01Auto merge of #90463 - matthiaskrgr:rollup-eljk9vo, r=matthiaskrgrbors-1/+0
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/+0
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-1/+202
Address CVE-2021-42574.
2021-10-28Revert "Add rustc lint, warning when iterating over hashmaps"Mark Rousskov-65/+6
2021-10-24Rollup merge of #89558 - lcnr:query-stable-lint, r=estebankMatthias Krüger-6/+65
Add rustc lint, warning when iterating over hashmaps r? rust-lang/wg-incr-comp
2021-10-22Rollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwcoYuki Okushi-2/+1
Don't mark for loop iter expression as desugared We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at https://github.com/rust-lang/rust-clippy/pull/7789#issuecomment-939289501.
2021-10-21ignore `potential_query_instability` in rustdoclcnr-0/+15
2021-10-18Rollup merge of #89987 - pierwill:fix-85526-docs-hidden-assoc, r=GuillaumeGomezMatthias Krüger-0/+18
Check implementing type for `#[doc(hidden)]` Closes #85526.
2021-10-17Check implementing type for `#[doc(hidden)]`pierwill-0/+18
Closes #85526.
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-1/+1
2021-10-15Don't mark for loop head span with desugaringCameron Steffen-2/+1