-
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.
Auto merge of #114417 - chinedufn:fix-expect-unused-in-impl-block-rus…
…t-issue-114416, r=cjgillot Fix multiple `expect` attribs in impl block Closes #114416
- Loading branch information
Showing
2 changed files
with
69 additions
and
34 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
30 changes: 30 additions & 0 deletions
30
tests/ui/lint/rfc-2383-lint-reason/expect_unused_inside_impl_block.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,30 @@ | ||
// check-pass | ||
// incremental | ||
|
||
#![feature(lint_reasons)] | ||
#![warn(unused)] | ||
|
||
struct OneUnused; | ||
struct TwoUnused; | ||
|
||
impl OneUnused { | ||
#[expect(unused)] | ||
fn unused() {} | ||
} | ||
|
||
impl TwoUnused { | ||
#[expect(unused)] | ||
fn unused1(){} | ||
|
||
// This unused method has `#[expect(unused)]`, so the compiler should not emit a warning. | ||
// This ui test was added after a regression in the compiler where it did not recognize multiple | ||
// `#[expect(unused)]` annotations inside of impl blocks. | ||
// issue 114416 | ||
#[expect(unused)] | ||
fn unused2(){} | ||
} | ||
|
||
fn main() { | ||
let _ = OneUnused; | ||
let _ = TwoUnused; | ||
} |