about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
AgeCommit message (Collapse)AuthorLines
2022-10-23Rollup merge of #103123 - compiler-errors:early-binder-iter, r=cjgillotMatthias Krüger-7/+5
Introduce `subst_iter` and `subst_iter_copied` on `EarlyBinder` Makes working with bounds lists a bit easier, which I seem to do a lot. Specifically, means that we don't need to do `.transpose_iter().map(|(pred, _)| *pred)` every time we want to iterate through an `EarlyBinder<&'tcx [(Predicate, Span)]>` (and even then, still have to call `subst` later), which was a very awkward idiom imo.
2022-10-23Auto merge of #102660 - camsteffen:uninhabited-perf, r=oli-obkbors-41/+5
Remove ParamEnv from uninhabited query
2022-10-23Fix wrapped valid-range handling in ty_find_init_errorJosh Triplett-1/+4
Rust's niche handling allows for wrapping valid ranges with end < start; for instance, a valid range with start=43 and end=41 means a niche of 42. Most places in the compiler handle this correctly, but ty_find_init_error assumed that `lo > 0` means the type cannot contain a zero. Fix it to handle wrapping ranges. Add a test to cover this case.
2022-10-22Introduce InhabitedPredicateCameron Steffen-41/+5
2022-10-22Change `unknown_lint` applicability to `MaybeIncorrect`Samuel Moelius-1/+1
2022-10-22Rollup merge of #102602 - WaffleLapkin:linty_action, r=estebankDylan DPC-38/+40
Slightly tweak comments wrt `lint_overflowing_range_endpoint` From the review: https://github.com/rust-lang/rust/pull/101986#discussion_r975610611 It _seemed_ that the lint was not emitted when the `if` check failed, but _actually_ this happens already in a special case and the lint is emitted outside of this function, if this function doesn't. I've cleared up the code/comments a bit, so it's more obvious :) r? ```@estebank```
2022-10-22Introduce subst_iter and subst_iter_copied on EarlyBinderMichael Goulet-7/+5
2022-10-21Rollup merge of #103260 - cuviper:needs-asm-support, r=fee1-deadDylan DPC-0/+1
Fixup a few tests needing asm support
2022-10-21Rollup merge of #103051 - davidtwco:translation-tidying-up, r=compiler-errorsDylan DPC-23/+2
translation: doc comments with derives, subdiagnostic-less enum variants, more derive use - Adds support for `doc` attributes in the diagnostic derives so that documentation comments don't result in the derive failing. - Adds support for enum variants in the subdiagnostic derive to not actually correspond to an addition to a diagnostic. - Made use of the derive in more places in the `rustc_ast_lowering`, `rustc_ast_passes`, `rustc_lint`, `rustc_session`, `rustc_infer` - taking advantage of recent additions like eager subdiagnostics, multispan suggestions, etc. cc #100717
2022-10-21Fix unreachable_pub suggestion for enum with fieldsKitsu-2/+6
2022-10-20Elaborate supertrait bounds when triggering unused_must_use on impl TraitMichael Goulet-2/+6
2022-10-19Fixup a few tests needing asm supportJosh Stone-0/+1
2022-10-17lint: use derive moreDavid Wood-23/+2
Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-16Rollup merge of #102953 - WaffleLapkin:better_docs_for_decorate_param, ↵Matthias Krüger-0/+23
r=RalfJung Improve docs for `struct_lint_level` function. r? ``@RalfJung`` Does this answer your questions?
2022-10-14more dupe word typosRageking8-1/+1
2022-10-12link lint function with `decorate` function param to `struct_lint_level`Maybe Waffle-0/+23
2022-10-10errors: `AddToDiagnostic::add_to_diagnostic_with`David Wood-3/+12
`AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8KiDylan DPC-1/+1
Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type` Thanks `@camsteffen` for catching this in ast too, cc https://github.com/rust-lang/rust/pull/102829#issuecomment-1272649247
2022-10-10Rename AssocItemKind::TyAlias to AssocItemKind::TypeMichael Goulet-1/+1
2022-10-09adopt to building infcxMaybe Waffle-24/+21
2022-10-09adopt to new rustc lint apiMaybe Waffle-15/+13
2022-10-09fixup lint nameMaybe Waffle-8/+8
2022-10-09fix `for_loop_over_fallibles` lint docsMaybe Waffle-22/+10
2022-10-09remove an infinite loopMaybe Waffle-2/+2
2022-10-09Edit documentation for `for_loop_over_fallibles` lintMaybe Waffle-23/+21
2022-10-09`for_loop_over_fallibles`: don't use `MachineApplicable`Maybe Waffle-1/+1
The loop could contain `break;` that won't work with an `if let`
2022-10-09`for_loop_over_fallibles`: fix suggestion for "remove `.next()`" caseMaybe Waffle-1/+1
if the iterator is used after the loop, we need to use `.by_ref()`
2022-10-09`for_loop_over_fallibles`: remove duplication from the messageMaybe Waffle-3/+1
2022-10-09`for_loop_over_fallibles`: suggest using `?` in some casesMaybe Waffle-3/+65
2022-10-09`for_loop_over_fallibles`: suggest `while let` loopMaybe Waffle-0/+10
2022-10-09`for_loop_over_fallibles`: Suggest removing `.next()`Maybe Waffle-11/+38
2022-10-09Use structured suggestions for `for_loop_over_fallibles` lintMaybe Waffle-8/+14
2022-10-09Start uplifting `clippy::for_loops_over_fallibles`Maybe Waffle-0/+102
I refactored the code: - Removed handling of methods, as it felt entirely unnecessary - Removed clippy utils (obviously...) - Used some shiny compiler features (let-else is very handy for lints :eyes:) - I also renamed the lint to `for_loop_over_fallibles` (note: no `s`). I'm not sure what's the naming convention here, so maybe I'm wrong.
2022-10-07Auto merge of #102091 - RalfJung:const_err, r=oli-obkbors-0/+5
make const_err a hard error This lint has been deny-by-default with future incompat wording since [Rust 1.51](https://github.com/rust-lang/rust/pull/80394) and the stable release of this week starts showing it in cargo's future compat reports. I can't wait to finally get rid of at least some of the mess in our const-err-reporting-code. ;) r? `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/71800 Fixes https://github.com/rust-lang/rust/issues/100114
2022-10-07make const_err a hard errorRalf Jung-0/+5
2022-10-07Change InferCtxtBuilder from enter to buildCameron Steffen-89/+83
2022-10-06Rollup merge of #102725 - nnethercote:rm-Z-time, r=davidtwcoMatthias Krüger-8/+11
Remove `-Ztime` Because it has a lot of overlap with `-Ztime-passes` but is generally less useful. Plus some related cleanups. Best reviewed one commit at a time. r? `@davidtwco`
2022-10-06Remove `-Ztime` option.Nicholas Nethercote-8/+11
The compiler currently has `-Ztime` and `-Ztime-passes`. I've used `-Ztime-passes` for years but only recently learned about `-Ztime`. What's the difference? Let's look at the `-Zhelp` output: ``` -Z time=val -- measure time of rustc processes (default: no) -Z time-passes=val -- measure time of each rustc pass (default: no) ``` The `-Ztime-passes` description is clear, but the `-Ztime` one is less so. Sounds like it measures the time for the entire process? No. The real difference is that `-Ztime-passes` prints out info about passes, and `-Ztime` does the same, but only for a subset of those passes. More specifically, there is a distinction in the profiling code between a "verbose generic activity" and an "extra verbose generic activity". `-Ztime-passes` prints both kinds, while `-Ztime` only prints the first one. (It took me a close reading of the source code to determine this difference.) In practice this distinction has low value. Perhaps in the past the "extra verbose" output was more voluminous, but now that we only print stats for a pass if it exceeds 5ms or alters the RSS, `-Ztime-passes` is less spammy. Also, a lot of the "extra verbose" cases are for individual lint passes, and you need to also use `-Zno-interleave-lints` to see those anyway. Therefore, this commit removes `-Ztime` and the associated machinery. One thing to note is that the existing "extra verbose" activities all have an extra string argument, so the commit adds the ability to accept an extra argument to the "verbose" activities.
2022-10-05Use proper subdiagnosticMichael Goulet-15/+9
2022-10-05Fix opaque_hidden_inferred_bound lint ICEMichael Goulet-18/+37
2022-10-04Rollup merge of #102568 - compiler-errors:lint-unsatisfied-opaques, r=oli-obkDylan DPC-0/+159
Lint against nested opaque types that don't satisfy associated type bounds See the test failures for examples of places where this lint would fire. r? `@oli-obk`
2022-10-04We are able to resolve methods even if they need substMichael Goulet-6/+0
2022-10-04Normalize substs before resolving instance in NoopMethodCall lintMichael Goulet-5/+6
2022-10-02Slightly tweak comments wrt `lint_overflowing_range_endpoint`Maybe Waffle-38/+40
2022-10-02Add example to opaque_hidden_inferred_bound lintMichael Goulet-6/+37
2022-10-02Make it a lint for all opaque typesMichael Goulet-146/+128
2022-10-02Lint for unsatisfied nested opaquesMichael Goulet-0/+146
2022-10-01Add sanity Drop impl.Camille GILLOT-0/+8
2022-10-01Add FIXME.Camille GILLOT-0/+1
2022-10-01Replace retain with assertion.Camille GILLOT-2/+6