about summary refs log tree commit diff
path: root/src/test/ui/lint
AgeCommit message (Collapse)AuthorLines
2020-06-20Add clashing-extern-fn.rs stderr.jumbatm-0/+121
2020-06-20Add ClashingExternDecl test case.jumbatm-0/+162
2020-06-19Rollup merge of #73300 - crlf0710:crate_level_only_check, r=petrochenkovManish Goregaokar-0/+84
Implement crate-level-only lints checking. This implements a crate_level_only flag on lints, and when it is true, it becomes an error when user tries to specify this flag upon nodes other than crate node. This also turns on this flag for all non_ascii_ident lints.
2020-06-19ty: simplify `transparent_newtype_field`David Wood-0/+24
This commit removes the normalization from `transparent_newtype_field` - turns out it wasn't necessary and that makes it a bunch simpler - particularly when handling projections. Signed-off-by: David Wood <david@davidtw.co>
2020-06-19lint: prohibit fields with opaque typesDavid Wood-0/+116
Opaque types cannot be used in extern declarations, and normally cannot exist in fields - except with type aliases to `impl Trait` and projections which normalize to them. Signed-off-by: David Wood <david@davidtw.co>
2020-06-19ty: projections in `transparent_newtype_field`David Wood-0/+42
This commit modifies `transparent_newtype_field` so that it handles projections with generic parameters, where `normalize_erasing_regions` would ICE. Signed-off-by: David Wood <david@davidtw.co>
2020-06-18Implement crate level only lints checking.Charles Lew-0/+84
2020-06-15Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakisbors-7/+6
Clean up type alias impl trait implementation - Removes special case for top-level impl trait - Removes associated opaque types - Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types. - Handle lifetimes in type alias impl trait more uniformly with other parameters cc #69323 cc #63063 Closes #57188 Closes #62988 Closes #69136 Closes #73061
2020-06-12Rollup merge of #73178 - petrochenkov:explint, r=varkorDylan DPC-0/+83
expand: More precise locations for expansion-time lints First commit: a macro expansion doesn't have a `NodeId` associated with it, but it has a parent `DefId` which we can use for linting. The observable effect is that lints associated with macro expansions can now be `allow`ed at finer-grained level than whole crate. Second commit: each macro definition has a `NodeId` which we can use for linting, unless that macro definition was decoded from other crate.
2020-06-11Stop special casing top level TAITMatthew Jasper-7/+6
2020-06-09Add tests for modifying lint levels for lints reported at expansion timeVadim Petrochenkov-0/+83
2020-06-09lint: transitive FFI-safety for transparent typesDavid Wood-21/+2
This commit ensures that if a `repr(transparent)` newtype's only non-zero-sized field is FFI-safe then the newtype is also FFI-safe. Previously, ZSTs were ignored for the purposes of linting FFI-safety in transparent structs - thus, only the single non-ZST would be checked for FFI-safety. However, if the non-zero-sized field is a generic parameter, and is substituted for a ZST, then the type would be considered FFI-unsafe (as when every field is thought to be zero-sized, the type is considered to be "composed only of `PhantomData`" which is FFI-unsafe). In this commit, for transparent structs, the non-zero-sized field is identified (before any substitutions are applied, necessarily) and then that field's type (now with substitutions) is checked for FFI-safety (where previously it would have been skipped for being zero-sized in this case). To handle the case where the non-zero-sized field is a generic parameter, which is substituted for `()` (a ZST), and is being used as a return type - the `FfiUnsafe` result (previously `FfiPhantom`) is caught and silenced. Signed-off-by: David Wood <david@davidtw.co>
2020-06-09lint: check for unit ret type after normalizationDavid Wood-15/+5
This commit moves the check that skips unit return types to after where the return type has been normalized - therefore ensuring that FFI-safety lints are not emitted for types which normalize to unit. Signed-off-by: David Wood <david@davidtw.co>
2020-06-09improper_ctypes: add test for #66202David Wood-0/+46
This commit adds a test of the improper ctypes lint, checking that return type are normalized bethat return types are normalized before being checked for FFI-safety, and that transparent newtype wrappers are FFI-safe if the type being wrapped is FFI-safe. Signed-off-by: David Wood <david@davidtw.co>
2020-05-27expand unaligned_references testRalf Jung-11/+34
2020-05-25rename lintRalf Jung-40/+40
2020-05-25more test ref-to-packed testsRalf Jung-1/+19
2020-05-25remove some unused types from the testsRalf Jung-7/+2
2020-05-25add a lint against references to packed fieldsRalf Jung-0/+48
2020-05-15Fix {:#?} representation of proc_macro::LiteralDavid Tolnay-1/+1
Before: TokenStream [ Ident { ident: "name", span: #0 bytes(37..41), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(42..43), }, Literal { lit: Lit { kind: Str, symbol: "SNPP", suffix: None }, span: Span { lo: BytePos(44), hi: BytePos(50), ctxt: #0 } }, Punct { ch: ',', spacing: Alone, span: #0 bytes(50..51), }, Ident { ident: "owner", span: #0 bytes(56..61), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(62..63), }, Literal { lit: Lit { kind: Str, symbol: "Canary M Burns", suffix: None }, span: Span { lo: BytePos(64), hi: BytePos(80), ctxt: #0 } }, ] After: TokenStream [ Ident { ident: "name", span: #0 bytes(37..41), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(42..43), }, Literal { kind: Str, symbol: "SNPP", suffix: None, span: #0 bytes(44..50), }, Punct { ch: ',', spacing: Alone, span: #0 bytes(50..51), }, Ident { ident: "owner", span: #0 bytes(56..61), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(62..63), }, Literal { kind: Str, symbol: "Canary M Burns", suffix: None, span: #0 bytes(64..80), }, ]
2020-05-14Rollup merge of #71910 - mibac138:necessary-paren, r=cuviperDylan DPC-0/+23
Fix unused_parens false positive when using binary operations Fixes #71290 r? @cuviper who provided instructions
2020-05-09Rollup merge of #71947 - mibac138:dead-code, r=cramertjDylan DPC-2/+54
Dead-code pass highlights too much of impl functions Fixes #66627. Previous diagnostic: ``` error: method is never used: `unused_impl_fn_3` --> src/main.rs:28:5 | 28 | / fn unused_impl_fn_3( 29 | | var: i32, 30 | | ) { 31 | | println!("bar {}", var); 32 | | } | |_____^ ``` New diagnostic: ``` error: associated function is never used: `unused_impl_fn_3` --> $DIR/lint-dead-code-6.rs:13:8 | LL | fn unused_impl_fn_3( | ^^^^^^^^^^^^^^^^ ``` This makes associated functions in line with free-standing functions.
2020-05-08Fix some tests failing in `--pass check` modeVadim Petrochenkov-5/+5
2020-05-07reword "possible candidate" import suggestionAndy Russell-2/+2
2020-05-06Dead-code pass highlights too much of impl functionsmibac138-2/+54
2020-05-05Ignore SGX on a few ui testsMohsen Zohrevandi-53/+54
2020-05-06Fix unused_parens nested binary op false positivemibac138-0/+5
2020-05-05Update src/test/ui/lint/issue-71290-unused-paren-binop.rsMichael-0/+1
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-05-05Fix unused_parens false positive when using binary operationsmibac138-0/+17
2020-05-03Rollup merge of #71663 - jumbatm:caller-handles-validation-error, r=RalfJungDylan DPC-180/+197
Fix exceeding bitshifts not emitting for assoc. consts (properly this time, I swear!) Fixes #69021 and fixes #71353. As described in https://github.com/rust-lang/rust/issues/71353#issuecomment-617901923, this PR: - adds a variant of `try_validation!` called `try_validation_pat!` that allows specific failures to be turned into validation failures (but returns the rest, unchanged), and - allows `InvalidProgram` to be returned out of validation r? @RalfJung
2020-05-03Implement `confusable_idents` lint.Charles Lew-0/+26
2020-05-01Update stderrs.jumbatm-75/+75
2020-05-01Partially unrevert #70566.jumbatm-111/+128
This partially reverts commit 4b5b6cbe60a8dd1822cfa46c41cf1ad58c113e18, reversing some changes made to 62b362472dbf8bdf43b252ac5ea53b527a8dbee3.
2020-04-26Rollup merge of #70043 - mark-i-m:def-kind-more, r=eddybDylan DPC-8/+8
Add all remaining `DefKind`s. r? @eddyb or @Centril ~~I'm not sure if this is what you were thinking of. There are also a few places where I'm not sure what the correct choice is because I don't fully understand the meaning of some variants.~~ ~~In general, it feels a bit odd to add some of these as `DefKind`s (e.g. `Arm`) because they don't feel like definitions. Are there things that it makes sense not to add?~~
2020-04-24adjust testsRalf Jung-129/+111
2020-04-24Remove redundant `descr`/`descriptive_variant` methods from HIR.Eduard-Mihai Burtescu-8/+8
2020-04-19Rollup merge of #71324 - petrochenkov:passcheck2, r=RalfJungDylan DPC-1/+1
Fix some tests failing in `--pass check` mode r? @RalfJung
2020-04-19Fix some tests failing in `--pass check` modeVadim Petrochenkov-1/+1
2020-04-19test for false "never constructed" warnings for `Self::` variant pathsjakubadamw-1/+21
2020-04-15Update stderrs after rebase.jumbatm-0/+6
2020-04-15Amend exceeding-bitshifts test case for #69021.jumbatm-113/+125
- Change to warnings so that all lints are emitted - Expect build-pass - Change placeholder FIXME to WARN.
2020-04-12Rollup merge of #67766 - sapir:fix-unused-in-or-pattern-warning, r=matthewjasperDylan DPC-18/+172
Fix warning for unused variables in or pattern (issue #67691) Is this a good way to fix it? Also, the tests fail, the "fixed" code output says `{ i, j }` instead of `{ i, j: _ }`, how can I fix that?
2020-04-11rustc: Add a warning count upon completionRoccoDev-15/+51
2020-04-10Replace run-rustfix for issue 67691 test with a FIXMEsapir-93/+9
2020-04-10Replace non-shorthand variables with _, not _varsapir-6/+6
2020-04-10Try to fix warning for unused variables in or patterns, issue #67691sapir-23/+87
2020-04-10Add tests for issue #67691sapir-0/+174
2020-04-09Rollup merge of #70822 - jonas-schievink:curse-of-the-recursion, ↵Mazdak Farrokhzad-0/+18
r=ecstatic-morse Don't lint for self-recursion when the function can diverge Fixes https://github.com/rust-lang/rust/issues/54444
2020-04-07remove false positives of unused_bracesBastian Kauschke-22/+49
2020-04-06Don't lint for self-recursion when the function can divergeJonas Schievink-0/+18