about summary refs log tree commit diff
path: root/src/test/ui/lint
AgeCommit message (Collapse)AuthorLines
2022-08-03Auto merge of #100064 - RalfJung:disaligned, r=petrochenkovbors-1/+110
fix is_disaligned logic for nested packed structs https://github.com/rust-lang/rust/pull/83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests. Fixes https://github.com/rust-lang/rust/issues/99838
2022-08-03fix is_disaligned logic for nested packed structsRalf Jung-1/+110
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-6/+64
2022-08-02Add items to `DocAliasBadLocation` check error match armhdelc-2/+2
- Added `Impl`, `Closure`, ForeignMod` targets - `Target::name` changed for `Target::Impl` - Error output for `Target::ForeignMod` changed to "foreign module"
2022-07-29Fix after rebasingEric Holk-1/+1
2022-07-29Update to still be correct without drop trackingEric Holk-6/+33
2022-07-29Update must_not_suspend lint to traverse referencesEric Holk-6/+6
2022-07-29Add drop tracking version of must_not_suspend ref testEric Holk-0/+30
2022-07-28Remove guess_head_span.Camille GILLOT-7/+7
2022-07-22Rollup merge of #99393 - ↵Dylan DPC-2/+2
Logarithmus:feature/99255-omit-const-generic-suffixes, r=petrochenkov feat: omit suffixes in const generics (e.g. `1_i32`) Closes #99255
2022-07-20Rollup merge of #99485 - mdholloway:unused-qualifications-in-derive, r=oli-obkDylan DPC-0/+38
Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations Currently, the `#[derive]` attribute always injects an `#[allow(unused_qualifications)]` attribute in the generated implementation. This results in an error when a derive is used in combination with `#![forbid(unused_qualifications)]`, because the `forbid` rule by definition cannot be overridden by `allow`. It appears that the original issue that prompted the inclusion of `#[allow(unused_qualifications)]` (#19102) is no longer present in the current stable release, and the associated [test case](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-19102.rs) still passes, so the `allow` is simply removed here. Fixes #71898.
2022-07-18Don't add attribute to allow unused-qualifications to derive impl'sSamrat Man Singh-0/+38
Currently `#![forbid(unused_qualifications)]` is incompatible with all derive's because we add `#[allow(unused_qualifications)]` in all generated impl's.
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-2/+2
Closes #99255
2022-07-18Update invalid atomic ordering lintTomasz Miąsko-254/+57
The restriction that success ordering must be at least as strong as its failure ordering in compare-exchange operations was lifted in #98383.
2022-07-15Correctly handle path stability for 'use tree' itemsAaron Hill-2/+11
PR #5956 started checking the stability of path segments. However, this was not applied to 'use tree' items (e.g. 'use some::path::{ItemOne, ItemTwo}') due to the way that we desugar these items in HIR lowering. This PR modifies 'use tree' lowering to preserve resolution information, which is needed by stability checking.
2022-07-15add `#[must_use]` to `Box::from_raw`rhysd-0/+26
2022-07-14Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillotbors-3/+19
Support unstable moves via stable in unstable items part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of https://github.com/rust-lang/rust/pull/90328. The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge. This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.
2022-07-13Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddybDylan DPC-23/+21
`UnsafeCell` blocks niches inside its nested type from being available outside fixes #87341 This implements the plan by `@eddyb` in https://github.com/rust-lang/rust/issues/87341#issuecomment-886083646 Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527
2022-07-08Support unstable moves via stable in unstable itemsJane Lusby-3/+19
2022-07-07`UnsafeCell` now has no niches, ever.Oli Scherer-23/+21
2022-07-07Shorten span for closures.Camille GILLOT-1/+1
2022-07-06replace `guess_head_span` with `def_span`Takayuki Maeda-8/+8
2022-07-01Auto merge of #93967 - cjgillot:short-struct-span, r=petrochenkovbors-72/+38
Shorten def_span for more items. The `def_span` query only returns the signature span for functions. Struct/enum/union definitions can also have a very long body. This PR shortens the associated span.
2022-07-01Auto merge of #98767 - Dylan-DPC:rollup-j1gq5sr, r=Dylan-DPCbors-1/+1
Rollup of 6 pull requests Successful merges: - #97488 (Suggest blanket impl to the local traits) - #98585 (Make `ThinBox<T>` covariant in `T`) - #98644 (fix ICE with -Wrust-2021-incompatible-closure-captures) - #98739 (fix grammar in useless doc comment lint) - #98741 (Many small deriving cleanups) - #98756 (Use const instead of function and make it private) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-01Shorten def_span for more items.Camille GILLOT-72/+38
2022-07-01Rollup merge of #98739 - euclio:useless-comment-plural, r=Dylan-DPCDylan DPC-1/+1
fix grammar in useless doc comment lint
2022-07-01Auto merge of #98402 - cjgillot:undead, r=michaelwoeristerbors-68/+87
Rewrite dead-code pass to avoid fetching HIR. This allows to get a more uniform handling of spans, and to simplify the grouping of diagnostics for variants and fields.
2022-06-30fix grammar in useless doc comment lintAndy Russell-1/+1
2022-06-30For diagnostic information of Boolean, remind it as use the type: 'bool'Yiming Lei-6/+37
It helps programmers coming from other languages modified: compiler/rustc_resolve/src/late/diagnostics.rs modified: src/test/ui/lint/recommend-literal.rs modified: src/test/ui/lint/recommend-literal.stderr modified: compiler/rustc_resolve/src/late/diagnostics.rs modified: src/test/ui/lint/recommend-literal.rs modified: src/test/ui/lint/recommend-literal.stderr modified: compiler/rustc_resolve/src/late/diagnostics.rs modified: src/test/ui/lint/recommend-literal.rs modified: src/test/ui/lint/recommend-literal.stderr
2022-06-27Rollup merge of #97389 - m-ou-se:memory-ordering-diagnostics, r=estebankMatthias Krüger-228/+246
Improve memory ordering diagnostics Before: ![image](https://user-images.githubusercontent.com/783247/170234545-891cac30-eaa2-4186-847b-35cd51e00f2b.png) After: ![image](https://user-images.githubusercontent.com/783247/170239684-645f186f-5a02-4eb9-8651-2e5fe9591352.png) --- Before this change, the compiler suggests the failure ordering is too strong and suggests choosing a weaker ordering. After this change, it instead suggests the success ordering is not strong enough, and suggests chosing a stronger one. This is more likely to be correct. Also, before this change, the compiler suggested downgrading an invalid AcqRel failure ordering to Relaxed, without mentioning Acquire as an option.
2022-06-25bless remaining testsRalf Jung-0/+39
2022-06-22Rewrite dead-code pass to avoid fetching HIR.Camille GILLOT-30/+53
2022-06-22Uniform spans in dead code lint.Camille GILLOT-42/+38
2022-06-22Slightly tweak invalid atomic ordering lint messages.Mara Bos-180/+180
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-06-22Auto merge of #97853 - TaKO8Ki:emit-only-one-note-per-unused-struct-field, ↵bors-176/+262
r=estebank Collapse multiple dead code warnings into a single diagnostic closes #97643
2022-06-22Rollup merge of #98336 - fmease:remove-faulty-doc-hidden-lint, r=GuillaumeGomezYuki Okushi-177/+0
Remove the unused-`#[doc(hidden)]` logic from the `unused_attributes` lint Fixes #96890. It was found out that `#[doc(hidden)]` on trait impl items does indeed have an effect on the generated documentation (see the linked issue). In my opinion and the one of [others](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Validy.20checks.20for.20.60.23.5Bdoc.28hidden.29.5D.60/near/281846219), rustdoc's output is actually a bit flawed in that regard but that should be tracked in a new issue I suppose (I will open an issue for that in the near future). The check was introduced in #96008 which is marked to be part of version `1.62` (current `beta`). As far as I understand, this means that **this PR needs to be backported** to `beta` to fix #96890 on time. Correct me if I am wrong. CC `@dtolnay` (in case you would like to agree or disagree with my decision to fully remove this check) `@rustbot` label A-lint T-compiler T-rustdoc r? `@rust-lang/compiler`
2022-06-21Move some tests to more reasonable directoriesCaio-0/+34
2022-06-21Remove `#[doc(hidden)]` logic from `unused_attributes` lintLeón Orell Valerian Liehr-177/+0
2022-06-19collapse dead code warnings into a single diagnosticTakayuki Maeda-176/+262
add comments in `store_dead_field_or_variant` support multiple log level add a item ident label fix ui tests fix a ui test fix a rustdoc ui test use let chain refactor: remove `store_dead_field_or_variant` fix a tiny bug
2022-06-16 fix one more case of trailing spaceklensy-14/+14
2022-06-16diagnostics: fix trailing spaceklensy-82/+82
2022-06-16Rollup merge of #97757 - xFrednet:rfc-2383-expect-with-force-warn, ↵Matthias Krüger-0/+175
r=wesleywiser,flip1995 Support lint expectations for `--force-warn` lints (RFC 2383) Rustc has a `--force-warn` flag, which overrides lint level attributes and forces the diagnostics to always be warn. This means, that for lint expectations, the diagnostic can't be suppressed as usual. This also means that the expectation would not be fulfilled, even if a lint had been triggered in the expected scope. This PR now also tracks the expectation ID in the `ForceWarn` level. I've also made some minor adjustments, to possibly catch more bugs and make the whole implementation more robust. This will probably conflict with https://github.com/rust-lang/rust/pull/97718. That PR should ideally be reviewed and merged first. The conflict itself will be trivial to fix. --- r? `@wesleywiser` cc: `@flip1995` since you've helped with the initial review and also discussed this topic with me. :upside_down_face: Follow-up of: https://github.com/rust-lang/rust/pull/87835 Issue: https://github.com/rust-lang/rust/issues/85549 Yeah, and that's it.
2022-06-16Support lint expectations for `--force-warn` lints (RFC 2383)xFrednet-0/+175
2022-06-11Have the drop code suggestion not include `let _ =`Aaron Kofsky-4/+4
2022-06-11Reword suggestion messages.Aaron Kofsky-4/+4
2022-06-11Auto merge of #97903 - est31:unused_macro_rules_compile_error, r=petrochenkovbors-0/+113
Never regard macro rules with compile_error! invocations as unused The very point of compile_error! is to never be reached, and one of the use cases of the macro, currently also listed as examples in the documentation of compile_error, is to create nicer errors for wrong macro invocations. Thus, we should never warn about unused macro arms that contain invocations of compile_error. See also https://github.com/rust-lang/rust/pull/96150#issuecomment-1126599107 and the discussion after that. Furthermore, the PR also contains two commits to silence `unused_macro_rules` when a macro has an invalid rule, and to add a test that `unused_macros` does not behave badly in the same situation. r? `@petrochenkov` as I've talked to them about this
2022-06-10Rollup merge of #97718 - xFrednet:95540-delayed-good-path-ice-for-expect, ↵Yuki Okushi-0/+8
r=wesleywiser Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383) Fixes a small ICE with the `delayed_good_path_bug` check. --- r? ``@wesleywiser`` cc: ``@eddyb`` this might be interesting, since you've added a `FIXME` comment above the modified check which kind of discusses a case like this closes: https://github.com/rust-lang/rust/issues/95540 cc: https://github.com/rust-lang/rust/issues/85549
2022-06-09Test that the unused_macros lint works correctly if rules are malformedest31-0/+41
The unused_macro_rules lint had a bug where it would regard all rules of a macro as unused if one rule were malformed. This bug doesn't exist with the unused_macros lint. To ensure it doesn't appear in the future, we add a test for it.
2022-06-09Suppress the unused_macro_rules lint if malformed rules are encounteredest31-0/+19
Prior to this commit, if a macro had any malformed rules, all rules would be reported as unused, regardless of whether they were used or not. So we just turn off unused rule checking completely for macros with malformed rules.
2022-06-09Never regard macro rules with compile_error! invocations as unusedest31-0/+53
The very point of compile_error! is to never be reached, and one of the use cases of the macro, currently also listed as examples in the documentation of compile_error, is to create nicer errors for wrong macro invocations. Thus, we shuuld never warn about unused macro arms that contain invocations of compile_error.