about summary refs log tree commit diff
path: root/src/test/ui/lint
AgeCommit message (Collapse)AuthorLines
2018-11-07Removed `#[rustc_error]` from tests that are all `// compile-pass`.Felix S. Klock II-63/+31
I also added `// skip-codegen` to each one, to address potential concerns that this change would otherwise slow down our test suite spending time generating code for files that are really just meant to be checks of compiler diagnostics. (However, I will say: My preference is to not use `// skip-codegen` if one can avoid it. We can use all the testing of how we drive LLVM that we can get...) (Updated post rebase.)
2018-10-29don't lint `unused_parens` on `if (break _)`Andre Bogus-0/+9
2018-10-27wherein the status of empty and reason-only lint attributes is clarifiedZack M. Davis-0/+17
We avoid an ICE by checking for an empty meta-item list before we index into the meta-items, and leave commentary about where we'd like to issue unused-attributes lints in the future. Note that empty lint attributes are already accepted by the stable compiler; generalizing this to weird reason-only lint attributes seems like the conservative/consilient generalization.
2018-10-27in which lint reasons are restricted to come last in the attributeZack M. Davis-5/+27
Vadim Petrochenkov suggested this in review ("an error? just to be conservative"), and it turns out to be convenient from the implementer's perspective: in the initial proposed implementation (or `HEAD~2`, as some might prefer to call it), we were doing an entire whole iteration over the meta items just to find the reason (before iterating over them to set the actual lint levels). This way, we can just peek at the end rather than adding that extra loop (or restructuring the existing code). The RFC doesn't seem to take a position on this, and there's some precedent for restricting things to be at the end of a sequence (we only allow `..` at the end of a struct pattern, even if it would be possible to let it appear anywhere in the sequence).
2018-10-27feature-gate lint reasonsZack M. Davis-11/+17
We take stability seriously, so we shy away from making even seemingly "trivial" features insta-stable.
2018-10-27introducing lint reason annotations (RFC 2383)Zack M. Davis-0/+153
This is just for the `reason =` name-value meta-item; the `#[expect(lint)]` attribute also described in the RFC is a problem for another day. The place where we were directly calling `emit()` on a match block (whose arms returned a mutable reference to a diagnostic-builder) was admittedly cute, but no longer plausibly natural after adding the if-let to the end of the `LintSource::Node` arm. This regards #54503.
2018-10-25Rollup merge of #55138 - zackmdavis:the_paren_trap, r=pnkfelixPietro Albini-7/+7
in which unused-parens suggestions heed what the user actually wrote Aaron Hill pointed out that unnecessary parens around a macro call (paradigmatically, `format!`) yielded a suggestion of hideous macro-expanded code. `span_to_snippet` is fallable as far as the type system is concerned, so the pretty-printing can live on in the oft-neglected `else` branch. Resolves #55109.
2018-10-18Make warnings into errorsvarkor-0/+3
2018-10-17Don't warn about parentheses on `match (return)`varkor-0/+6
2018-10-16in which unused-parens suggestions heed what the user actually wroteZack M. Davis-7/+7
Aaron Hill pointed out that unnecessary parens around a macro call (paradigmatically, `format!`) yielded a suggestion of hideous macro-expanded code. (The slightly unusual choice of using the pretty-printer to compose suggestions was quite recently commented on in the commit message for 1081bbbfc ("abolish ICE when pretty-printing async block"), but without any grounds to condemn it as a 𝘣𝘢𝘥 choice. Hill's report provides the grounds.) `span_to_snippet` is fallable as far as the type system is concerned (because, who knows, macros or something), so the pretty-printing can live on in the oft-neglected `else` branch. Resolves #55109.
2018-10-15Rollup merge of #55081 - sinkuu:dedup_test, r=ManishearthManish Goregaokar-103/+0
Deduplicate tests * [`ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4`](https://github.com/rust-lang/rust/blob/0c665e20db6c61de8f741bca3ca7660e679885c0/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs) and [`ex3-both-anon-regions-both-are-structs-3`](https://github.com/rust-lang/rust/blob/0c665e20db6c61de8f741bca3ca7660e679885c0/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs) * [`ui/lint/lint-group-style`](https://github.com/rust-lang/rust/blob/0c665e20db6c61de8f741bca3ca7660e679885c0/src/test/ui/lint/lint-group-style.rs) and [`lint-group-nonstandard-style`](https://github.com/rust-lang/rust/blob/0c665e20db6c61de8f741bca3ca7660e679885c0/src/test/ui/lint/lint-group-nonstandard-style.rs)
2018-10-15Rollup merge of #54820 - kleimkuhler:issue-54538-unused_patterns-lint, ↵Manish Goregaokar-0/+80
r=nikomatsakis Closes #54538: `unused_patterns` lint Closes #54538 r? @nikomatsakis
2018-10-15Deduplicate testsShotaro Yamada-103/+0
* `ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4` and `ex3-both-anon-regions-both-are-structs-3` * `ui/lint/lint-group-style` and `lint-group-nonstandard-style`
2018-10-14Unused result warning: "X which must" ↦ "X that must"varkor-23/+23
2018-10-09Fix Range warning and improve testsKevin Leimkuhler-36/+32
2018-10-09Simply unused_parens check and add testsKevin Leimkuhler-0/+84
2018-10-08Fix handling of #[must_use] on unit and uninhabited typesvarkor-0/+37
2018-10-07Auto merge of #54810 - 1aim:unused-impl-trait, r=oli-obkbors-1/+11
Fix dead code lint for functions using impl Trait Fixes https://github.com/rust-lang/rust/issues/54754 This is a minimal fix that doesn't add any new queries or touches unnecessary code. Please nominate for beta backport if wanted.
2018-10-06rustc: Allow `#[no_mangle]` anywhere in a crateAlex Crichton-91/+51
This commit updates the compiler to allow the `#[no_mangle]` (and `#[export_name]` attributes) to be located anywhere within a crate. These attributes are unconditionally processed, causing the compiler to always generate an exported symbol with the appropriate name. After some discussion on #54135 it was found that not a great reason this hasn't been allowed already, and it seems to match the behavior that many expect! Previously the compiler would only export a `#[no_mangle]` symbol if it were *publicly reachable*, meaning that it itself is `pub` and it's otherwise publicly reachable from the root of the crate. This new definition is that `#[no_mangle]` *is always reachable*, no matter where it is in a crate or whether it has `pub` or not. This should make it much easier to declare an exported symbol with a known and unique name, even when it's an internal implementation detail of the crate itself. Note that these symbols will persist beyond LTO as well, always making their way to the linker. Along the way this commit removes the `private_no_mangle_functions` lint (also for statics) as there's no longer any need to lint these situations. Furthermore a good number of tests were updated now that symbol visibility has been changed. Closes #54135
2018-10-04Fix dead code lint for functions using impl TraitJonas Schievink-1/+11
2018-09-27Update ui linesJosh Stone-30/+30
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-2/+0
2018-09-19Auto merge of #54101 - osa1:issue_54099, r=nikomatsakisbors-12/+18
Fix camel case type warning for types with trailing underscores Fixes #54099
2018-09-12Fix camel case type warning for types with trailing underscoresÖmer Sinan Ağacan-12/+18
Fixes #54099
2018-09-11stabalize infer outlives requirements (RFC 2093).toidiu-23/+25
Co-authored-by: nikomatsakis
2018-09-07Rollup merge of #53550 - brson:recurring, r=estebankkennytm-56/+56
librustc_lint: In recursion warning, change 'recurring' to 'recursing' The existing wording seems incorrect. Aside: This warning, 'function cannot return without recursing' is not perfectly clear - it implies that the function _can_ return, it's just got to recurse. But really the fn cannot return period. Clearer wording: 'function recurses infinitely; it cannot return'; or 'function is infinitely self-recursive; it cannot return, and this is probably an error'. I like that.
2018-09-04Introduce Custom Test FrameworksJohn Renner-8/+8
2018-08-29Replace usages of 'bad_style' with 'nonstandard_style'.Corey Farwell-25/+25
`bad_style` is being deprecated in favor of `nonstandard_style`: - https://github.com/rust-lang/rust/issues/41646
2018-08-24Add/update tests for 2015, 2018, rustfixMark Mansi-56/+0
2018-08-24Rollup merge of #53559 - Dylan-DPC:fix/missing-doc-lint, r=kennytmkennytm-5/+38
add macro check for lint Fixes #53537
2018-08-23fix testcasedylan_DPC-5/+18
2018-08-23add warning for missing docsdylan_DPC-4/+5
2018-08-22add testcase to existing macro testcasedylan_DPC-3/+22
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-1/+1
Fix typos found by codespell.
2018-08-20librustc_lint: In recursion warning, change 'recurring' to 'recursing'Brian Anderson-56/+56
2018-08-19Stabilize macro_vis_matcherJakub Kozlowski-2/+2
2018-08-19Fix typos found by codespell.Matthias Krüger-1/+1
2018-08-14Merged migrated compile-fail tests and ui tests. Fixes #46841.David Wood-0/+9628
2018-08-01`Applicability`-ify librustc_lintZack M. Davis-1/+1
Andrew Chin recently pointed out (rust-lang/cargo#5846) that it's surprising that `cargo fix` (now shipping with Cargo itself!) doesn't fix very common lint warnings, which is as good of a reminder as any that we should finish #50723.
2018-07-17rustc: Polish off `in_external_macro`Alex Crichton-0/+79
This commit polishes off this new function to compile on newer rustc as well as update and add a suite of test cases to work with this new check for lints.
2018-07-03Auto merge of #51450 - estebank:inner-fn-test, r=@pnkfelixbors-0/+45
Add lint warning for inner function marked as `#[test]` Fix #36629.
2018-06-30private no-mangle lints: help hint note if visibility modifier is `pub`Zack M. Davis-28/+47
If the item is `pub`, one imagines users being confused as to why it's not reachable/exported; a code suggestion is beyond our local knowledge here, but we can at least offer a prose hint. (Thanks to Vadim Petrochenkov for shooting down the present author's original bad idea for the note text.) While we're here, use proper HELP expectations instead of ad hoc comments to communicate (and now, enforce) the expected suggestions in test/ui/lint/suggestions.rs.
2018-06-30private no-mangle lints: issue suggestion for restricted visibilityZack M. Davis-6/+28
This is probably quite a lot less likely to come up in practice than the "inherited" (no visibility keyword) case, but now that we have visibility spans in the HIR, we can do this, and it presumably doesn't hurt to be exhaustive. (Who can say but that the attention to detail just might knock someone's socks off, someday, somewhere?) This is inspired by #47383.
2018-06-30unreachable_pub lint: grab `pub` span from HIR rather than inferring itZack M. Davis-10/+16
This is a true fix for #50455, superior to the mere bandage offered in #50476.
2018-06-26rename lint to `unnameable-test-functions`Esteban Küber-6/+6
2018-06-26Lint inner fn marked as `#[test]`Esteban Küber-0/+45
2018-06-26inclusive range syntax lint (`...` → `..=`)Zack M. Davis-0/+58
Our implementation ends up changing the `PatKind::Range` variant in the AST to take a `Spanned<RangeEnd>` instead of just a `RangeEnd`, because the alternative would be to try to infer the span of the range operator from the spans of the start and end subexpressions, which is both hideous and nontrivial to get right (whereas getting the change to the AST right was a simple game of type tennis). This is concerning #51043.
2018-06-23in which the trivial-casts word to the wise is tucked into a help noteZack M. Davis-0/+95
The top level message shouldn't be too long; the replaced-by-coercion/temporary-variable advice can live in a note. Also, don't mention type ascription when it's not actually available as a real thing. (The current state of discussion on the type ascription tracking issue #23416 makes one rather suspect it will never be a stable thing in its current form, but that's not for us to adjudicate in this commit.) While we're here, yank out the differentiating parts of the numeric/other conditional and only have one codepath emitting the diagnostic.
2018-05-23Auto merge of #50682 - F001:issue-50589, r=petrochenkovbors-0/+46
Add lint for multiple associated types Fix https://github.com/rust-lang/rust/issues/50589. cc @abonander
2018-05-23inverting speculative flagF001-0/+11