summaryrefslogtreecommitdiffstats
path: root/src/test/ui/deprecation/suggestion.fixed
blob: d9fa2b56eeef705b94a316842252e34c1234600f (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.replacement(); //~ ERROR use of deprecated

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