-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support the
#[expect]
attribute on fn parameters (RFC-2383)
- Loading branch information
Showing
8 changed files
with
78 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// check-pass | ||
#![feature(lint_reasons)] | ||
|
||
#[warn(unused_variables)] | ||
|
||
/// This should catch the unused_variables lint and not emit anything | ||
fn check_fulfilled_expectation(#[expect(unused_variables)] unused_value: u32) {} | ||
|
||
fn check_unfulfilled_expectation(#[expect(unused_variables)] used_value: u32) { | ||
//~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations] | ||
//~| NOTE `#[warn(unfulfilled_lint_expectations)]` on by default | ||
println!("I use the value {used_value}"); | ||
} | ||
|
||
fn main() {} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/lint/rfc-2383-lint-reason/expect_on_fn_params.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
warning: this lint expectation is unfulfilled | ||
--> $DIR/expect_on_fn_params.rs:9:43 | ||
| | ||
LL | fn check_unfulfilled_expectation(#[expect(unused_variables)] used_value: u32) { | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(unfulfilled_lint_expectations)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters