forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#97715 - xFrednet:97650-expect-in-fuction-ar…
…g, r=wesleywiser Support the `#[expect]` attribute on fn parameters (RFC-2383) A small PR to allow the `#[expect]` attribute on function parameters. Nothing more to say, I hope everyone reading this has a lovely day. --- r? `@wesleywiser` closes: rust-lang#97650 cc: rust-lang#85549
- 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