summaryrefslogtreecommitdiffstats
path: root/tests/ui/deprecation/suggestion.rs
blob: 9dc2eaf25550710b4b945dc66a5170ccf248d366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// run-rustfix

#![feature(staged_api)]
#![feature(deprecated_suggestion)]

#![stable(since = "1.0.0", feature = "test")]

#![deny(deprecated)]
#![allow(dead_code)]

struct Foo;

impl Foo {
    #[deprecated(
        since = "1.0.0",
        note = "replaced by `replacement`",
        suggestion = "replacement",
    )]
    #[stable(since = "1.0.0", feature = "test")]
    fn deprecated(&self) {}

    fn replacement(&self) {}
}

mod bar {
    #[deprecated(
    since = "1.0.0",
    note = "replaced by `replacement`",
    suggestion = "replacement",
    )]
    #[stable(since = "1.0.0", feature = "test")]
    pub fn deprecated() {}

    pub fn replacement() {}
}

fn main() {
    let foo = Foo;

    foo.deprecated(); //~ ERROR use of deprecated

    bar::deprecated(); //~ ERROR use of deprecated
}