Pass precise HirId when calling check_stability
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
//@ check-pass
|
||||
struct Point {
|
||||
#[deprecated = "x is deprecated"]
|
||||
_x: i32,
|
||||
_y: i32,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let p = Point { _x: 1, _y: 2 }; //~ WARNING use of deprecated field `Point::_x`
|
||||
// Before fix, it report an warning
|
||||
let Point { #[expect(deprecated)]_x, .. } = p;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
warning: use of deprecated field `Point::_x`: x is deprecated
|
||||
--> $DIR/check-struct-pat-fields-stability-issue-138319.rs:9:21
|
||||
|
|
||||
LL | let p = Point { _x: 1, _y: 2 };
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
39
tests/ui/stability-attribute/check-stability-issue-138319.rs
Normal file
39
tests/ui/stability-attribute/check-stability-issue-138319.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
//@ check-pass
|
||||
fn _foo() {
|
||||
_Bar { //~ WARNING use of deprecated struct `_Bar`: reason
|
||||
#[expect(deprecated)]
|
||||
foo: 0,
|
||||
};
|
||||
}
|
||||
|
||||
#[deprecated = "reason"]
|
||||
struct _Bar {
|
||||
foo: u32,
|
||||
}
|
||||
|
||||
fn _foo2() {
|
||||
#[expect(deprecated)]
|
||||
_Bar2 {
|
||||
foo2: 0,
|
||||
};
|
||||
}
|
||||
|
||||
#[deprecated = "reason"]
|
||||
struct _Bar2 {
|
||||
foo2: u32,
|
||||
}
|
||||
|
||||
fn _foo3() {
|
||||
_Bar3 {
|
||||
#[expect(deprecated)]
|
||||
foo3: 0,
|
||||
};
|
||||
}
|
||||
|
||||
struct _Bar3 {
|
||||
#[deprecated = "reason"]
|
||||
foo3: u32,
|
||||
}
|
||||
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,10 @@
|
||||
warning: use of deprecated struct `_Bar`: reason
|
||||
--> $DIR/check-stability-issue-138319.rs:3:5
|
||||
|
|
||||
LL | _Bar {
|
||||
| ^^^^
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
Reference in New Issue
Block a user