about summary refs log tree commit diff
path: root/src/test/ui/lint
AgeCommit message (Collapse)AuthorLines
2018-12-29update tests line numbersMatthias Krüger-13/+13
2018-12-28remove remaining copyright headersMatthias Krüger-8/+0
2018-12-25Remove licensesMark Rousskov-1869/+850
2018-12-24make non_camel_case_types an early lintAndy Russell-13/+13
2018-12-19suggest similar lint names for unknown lintsAndy Russell-24/+35
2018-12-16Rollup merge of #56439 - JohnGinger:master, r=nikomatsakisMazdak Farrokhzad-0/+1
Clearer error message for dead assign I'm not that this is the right place for this (if it needs an RFC or not). I had the problem where I misunderstood the compiler lint message https://github.com/rust-lang/rust/issues/56436 and other people seem to have had the same problem https://www.reddit.com/r/rust/comments/8cy9p4/value_assigned_to_is_never_read/. I think this new wording might be slightly clearer (and help out beginners like me). I'm very new though, so there might be some nuance I'm missing that would make this more confusing or a bad idea for other reasons. I thought I would create a PR to make it easy to change the code if the consensus was that it would make sense to make a change. If this is the wrong place for this sort of thing I'll happily delete/move it.
2018-12-15Rollup merge of #56738 - turboladen:fix-private_no_mangle_fns-message, ↵Pietro Albini-2/+2
r=zackmdavis Fix private_no_mangle_fns message grammar Simply changes "an warning" to "a warning" in the `private_no_mangle_fns` warning. I started getting this in some code after upgrading to 1.31.0.
2018-12-11Fix private_no_mangle_fns message grammarSteve Loveless-2/+2
2018-12-11std: Depend directly on crates.io cratesAlex Crichton-1/+1
Ever since we added a Cargo-based build system for the compiler the standard library has always been a little special, it's never been able to depend on crates.io crates for runtime dependencies. This has been a result of various limitations, namely that Cargo doesn't understand that crates from crates.io depend on libcore, so Cargo tries to build crates before libcore is finished. I had an idea this afternoon, however, which lifts the strategy from #52919 to directly depend on crates.io crates from the standard library. After all is said and done this removes a whopping three submodules that we need to manage! The basic idea here is that for any crate `std` depends on it adds an *optional* dependency on an empty crate on crates.io, in this case named `rustc-std-workspace-core`. This crate is overridden via `[patch]` in this repository to point to a local crate we write, and *that* has a `path` dependency on libcore. Note that all `no_std` crates also depend on `compiler_builtins`, but if we're not using submodules we can publish `compiler_builtins` to crates.io and all crates can depend on it anyway! The basic strategy then looks like: * The standard library (or some transitive dep) decides to depend on a crate `foo`. * The standard library adds ```toml [dependencies] foo = { version = "0.1", features = ['rustc-dep-of-std'] } ``` * The crate `foo` has an optional dependency on `rustc-std-workspace-core` * The crate `foo` has an optional dependency on `compiler_builtins` * The crate `foo` has a feature `rustc-dep-of-std` which activates these crates and any other necessary infrastructure in the crate. A sample commit for `dlmalloc` [turns out to be quite simple][commit]. After that all `no_std` crates should largely build "as is" and still be publishable on crates.io! Notably they should be able to continue to use stable Rust if necessary, since the `rename-dependency` feature of Cargo is soon stabilizing. As a proof of concept, this commit removes the `dlmalloc`, `libcompiler_builtins`, and `libc` submodules from this repository. Long thorns in our side these are now gone for good and we can directly depend on crates.io! It's hoped that in the long term we can bring in other crates as necessary, but for now this is largely intended to simply make it easier to manage these crates and remove submodules. This should be a transparent non-breaking change for all users, but one possible stickler is that this almost for sure breaks out-of-tree `std`-building tools like `xargo` and `cargo-xbuild`. I think it should be relatively easy to get them working, however, as all that's needed is an entry in the `[patch]` section used to build the standard library. Hopefully we can work with these tools to solve this problem! [commit]: https://github.com/alexcrichton/dlmalloc-rs/commit/28ee12db813a3b650a7c25d1c36d2c17dcb88ae3
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-07Change to give a help messageJohn Ginger-1/+1
2018-12-03Fix stderr file (unused variable)John Ginger-0/+1
2018-11-19Test for #[must_use] on traitsvarkor-0/+36
2018-11-15Rollup merge of #55852 - varkor:dotdotequals-lint, r=zackmdavisPietro Albini-0/+18
Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint Fixes https://github.com/rust-lang/rust/issues/51043.
2018-11-11Rollup merge of #55799 - ↵Pietro Albini-202/+52
pnkfelix:remove-useless-revisions-marker-from-lint-unused-mut-variables, r=davidtwco Removed unneeded instance of `// revisions` from a lint test Removed an unneeded instance of `// revisions`; the compare-mode=nll shows the output is identical now. cc #54528
2018-11-11Rollup merge of #55687 - alexreg:fix-24010, r=scalexmPietro Albini-46/+0
Take supertraits into account when calculating associated types Fixes #24010 and #23856. Applies to trait aliases too. As a by-product, this PR also makes repeated bindings of the same associated item in the same definition a hard error. This was previously a warning with a note about it becoming a hard error in the future. See #50589 for more info. I talked about this with @nikomatsakis recently, but only very superficially, so this shouldn't stop anyone from assigning it to themself to review and r+. N.B. The "WIP" commits represent imperfect attempts to solve the problem just for trait objects, but I've left them in for reference for the sake of whomever is reviewing this. CC @carllerche @theemathas @durka @mbrubeck
2018-11-10Use non-short suggestion for parenthesised ..=varkor-1/+1
2018-11-10Rewrite `...` as `..=` as a MachineApplicable 2018 idiom lintvarkor-0/+18
2018-11-09Removed an unneeded instance of `// revisions`; the compare-mode NLL shows ↵Felix S. Klock II-202/+52
the output is identical now.
2018-11-07Only do check for trait objects, not trait or trait alias definitions.Alexander Regueiro-46/+0
2018-11-07work around deviation in diagnostic output for opt-level=0 by forcing `-O`.Felix S. Klock II-1/+1
2018-11-07Update output of `lint-type-overflow2.stderr` to reflect its output from ↵Felix S. Klock II-8/+2
`rustc -O`. (The fact that output differs under `opt-level=0` is an instance of #55757.)
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