about summary refs log tree commit diff
path: root/tests/ui/lint/unused
AgeCommit message (Collapse)AuthorLines
2025-09-21Changes to uitests for macro_export portJonathan Brouwer-12/+12
Co-authored-by: Anne Stijns <anstijns@gmail.com>
2025-09-10fixup no_{core,std} handling codeJana Dönszelmann-12/+12
2025-09-08fixup limit handling codeJana Dönszelmann-42/+45
2025-08-26Rollup merge of #145792 - scrabsha:push-umpytyxunpxq, r=jdonszelmannSamuel Tardieu-3/+15
Use attribute name in message for "outer attr used as inner attr" errors
2025-08-25Use attribute name in message for "outer attr used as inner attr" errorsSasha Pourcelot-3/+15
2025-08-24Regression test for attributes on macro callsJonathan Brouwer-15/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-24fix ICE on stable related to attrs on macrosJana Dönszelmann-0/+38
2025-08-24Port crate name to the new attribute systemJana Dönszelmann-60/+78
2025-08-24Support lints in early attribute parsingJana Dönszelmann-27/+40
2025-08-21split up context.rsJana Dönszelmann-21/+21
2025-08-21refactor target checking, move out of context.rs and rename MaybeWarn to PolicyJana Dönszelmann-1/+1
2025-08-20Rollup merge of #140794 - karolzwolak:allow-unused-doc-65464, r=davidtwcoJacob Pratt-2/+2
mention lint group in default level lint note ### Summary This PR updates lint diagnostics so that default-level notes now mention the lint group they belong to, if any. Fixes: rust-lang/rust#65464. ### Example ```rust fn main() { let x = 5; } ``` Before: ``` = note: `#[warn(unused_variables)]` on by default ``` After: ``` = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default ``` ### Unchanged Cases Messages remain the same when the lint level is explicitly set, e.g.: * Attribute on the lint `#[warn(unused_variables)]`: ``` note: the lint level is defined here LL | #[warn(unused_variables)] | ^^^^^^^^^^^^^^^^ ``` * Attribute on the group `#[warn(unused)]:`: ``` = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` ``` * CLI option `-W unused`: ``` = note: `-W unused-variables` implied by `-W unused` = help: to override `-W unused` add `#[allow(unused_variables)]` ``` * CLI option `-W unused-variables`: ``` = note: requested on the command line with `-W unused-variables` ```
2025-08-19bless tests with new lint messagesKarol Zwolak-2/+2
2025-08-19Update uitestsJonathan Brouwer-107/+212
2025-08-14Update uitestsJonathan Brouwer-27/+35
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-12Remove unused must_useMichael Goulet-32/+174
2025-08-06Changes to the tests for the `#[should_panic]` portJonathan Brouwer-13/+13
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-24Add test case for single boundBen Schulz-1/+35
2025-07-24Fix unused_parens false positiveBen Schulz-0/+9
2025-07-23Update uitest stderrsJonathan Brouwer-20/+20
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-17Specify of_trait in Target::Impl.Camille GILLOT-21/+23
2025-07-12Update uitest stderrsJonathan Brouwer-12/+12
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-10Remove uncessary parens in closure body with unused lintyukang-0/+136
2025-07-06Port `#[path]` to the new attribute parsing infrastructureJonathan Brouwer-19/+19
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-05Port `#[ignore]` to the new attribute parsing infrastructureJonathan Brouwer-12/+12
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-04Port `#[non_exhaustive]` to the new attribute parsing infrastructureJonathan Brouwer-12/+12
2025-07-03Port `#[no_implicit_prelude]` to the new attribute parsing infrastructureJonathan Brouwer-12/+12
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-02Rollup merge of #142237 - benschulz:unused-parens-fn, r=fee1-deadMatthias Krüger-6/+79
Detect more cases of unused_parens around types With this change, more unused parentheses around bounds and types nested within bounds are detected.
2025-07-01Detect more cases of unused_parens around typesBenjamin Schulz-6/+79
2025-06-30Rollup merge of #143196 - Periodic1911:link_section, r=oli-obkdianqk-1/+20
Port #[link_section] to the new attribute parsing infrastructure Ports link_section to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@oli-obk` cc `@JonathanBrouwer` `@jdonszelmann`
2025-06-29Port #[link_section] to the new attribute parsing infrastructureAnne Stijns-1/+20
2025-06-29Rollup merge of #143030 - Urgau:issue-143025, r=SparrowLiiGuillaume Gomez-0/+168
Fix suggestion spans inside macros for the `unused_must_use` lint This PR fixes the suggestion spans inside macros for the `unused_must_use` lint by trying to find the oldest ancestor span. Fixes https://github.com/rust-lang/rust/issues/143025
2025-06-28Port `#[link_name]` to the new attribute parsing infrastructureJonathan Brouwer-13/+13
Co-authored-by: Anne Stijns <anstijns@gmail.com> Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-27Port `#[used]` to new attribute parsing infrastructureJonathan Brouwer-12/+12
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-26Port `#[export_name]` to the new attribute parsing infrastructureJonathan Brouwer-13/+13
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-25Fix suggestion spans inside macros for the `unused_must_use` lintUrgau-0/+168
2025-06-24Rewrite #[track_caller]Jana Dönszelmann-12/+12
2025-06-22Port `#[no_mangle]` to new attribute parsing infrastructureJonathan Brouwer-12/+12
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-22Port `#[must_use]` to new attribute parsing infrastructureJonathan Brouwer-13/+13
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-06-20coldJana Dönszelmann-12/+12
2025-06-17make error codes reflect reality betterJana Dönszelmann-18/+18
2025-06-17fix bugs in inline/force_inline and diagnostics of all attr parsersJana Dönszelmann-18/+18
2025-06-07Rollup merge of #140560 - Urgau:test_attr-module-level, r=GuillaumeGomezGuillaume Gomez-10/+70
Allow `#![doc(test(attr(..)))]` everywhere This PR adds the ability to specify [`#![doc(test(attr(..)))]`](https://doc.rust-lang.org/nightly/rustdoc/write-documentation/the-doc-attribute.html#testattr) ~~at module level~~ everywhere in addition to allowing it at crate-root. This is motivated by a recent PR #140323 (by ````@tgross35)```` where we have to duplicate 2 attributes to every single `f16` and `f128` doctests, by allowing `#![doc(test(attr(..)))]` at module level (and everywhere else) we can omit them entirely and just have (in both module): ```rust #![doc(test(attr(feature(cfg_target_has_reliable_f16_f128))))] #![doc(test(attr(expect(internal_features))))] ``` Those new attributes are appended to the one found at crate-root or at a previous module. Those "global" attributes are compatible with merged doctests (they already were before). Given the small addition that this is, I'm proposing to insta-stabilize it, but I can feature-gate it if preferred. Best reviewed commit by commit. r? ````@GuillaumeGomez````
2025-06-03Use non-2015 edition paths in tests that do not test for their resolutionLukas Wirth-10/+10
This allows for testing these tests on editions other than 2015
2025-05-29Use `cfg_attr` AST placeholder AST `cfg_attr_trace` for diagnosticsEsteban Küber-2/+13
PR 138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix Issue 56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint. ``` warning: unused extern crate --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` help: remove the unused `extern crate` | LL - #[cfg_attr(test, macro_use)] LL - extern crate removing_extern_crate as foo; LL + | ```
2025-05-25Fix `unused_braces` lint suggestion when encountering attributesUrgau-0/+49
2025-05-22Allow `#![doc(test(attr(..)))]` at every levelUrgau-10/+70
2025-04-17Rollup merge of #138632 - clubby789:stabilize-cfg-boolean-lit, ↵Matthias Krüger-1/+1
r=davidtwco,Urgau,traviscross Stabilize `cfg_boolean_literals` Closes #131204 `@rustbot` labels +T-lang +I-lang-nominated This will end up conflicting with the test in #138293 so whichever doesn't land first will need updating -- # Stabilization Report ## General design ### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized? [RFC 3695](https://github.com/rust-lang/rfcs/pull/3695), none. ### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con. None ### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those? None ## Has a call-for-testing period been conducted? If so, what feedback was received? Yes; only positive feedback was received. ## Implementation quality ### Summarize the major parts of the implementation and provide links into the code (or to PRs) Implemented in [#131034](https://github.com/rust-lang/rust/pull/131034). ### Summarize existing test coverage of this feature - [Basic usage, including `#[cfg()]`, `cfg!()` and `#[cfg_attr()]`](https://github.com/rust-lang/rust/blob/6d71251cf9e40326461f90f8ff9a7024706aea87/tests/ui/cfg/true-false.rs) - [`--cfg=true/false` on the command line being accessible via `r#true/r#false`](https://github.com/rust-lang/rust/blob/6d71251cf9e40326461f90f8ff9a7024706aea87/tests/ui/cfg/raw-true-false.rs) - [Interaction with the unstable `#[doc(cfg(..))]` feature](https://github.com/rust-lang/rust/tree/6d71251/tests/rustdoc-ui/cfg-boolean-literal.rs) - [Denying `--check-cfg=cfg(true/false)`](https://github.com/rust-lang/rust/tree/6d71251/tests/ui/check-cfg/invalid-arguments.rs) - Ensuring `--cfg false` on the command line doesn't change the meaning of `cfg(false)`: `tests/ui/cfg/cmdline-false.rs` - Ensuring both `cfg(true)` and `cfg(false)` on the same item result in it being disabled: `tests/ui/cfg/both-true-false.rs` ### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking? The above mentioned issue; it should not block as it interacts with another unstable feature. ### What FIXMEs are still in the code for that feature and why is it ok to leave them there? None ### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization - `@clubby789` (RFC) - `@Urgau` (Implementation in rustc) ### Which tools need to be adjusted to support this feature. Has this work been done? `rustdoc`'s unstable`#[doc(cfg(..)]` has been updated to respect it. `cargo` has been updated with a forward compatibility lint to enable supporting it in cargo once stabilized. ## Type system and execution rules ### What updates are needed to the reference/specification? (link to PRs when they exist) A few lines to be added to the reference for configuration predicates, specified in the RFC.
2025-04-10replace `//@ compile-flags: --edition` with `//@ edition`Pietro Albini-1/+1
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-3/+3