summaryrefslogtreecommitdiffstats
path: root/tests/ui/methods/field-method-suggestion-using-return-ty.rs
blob: 07b975c44c905ab2c1bd8bad6f3b56c1bf7f1472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
struct Wrapper<T>(T);

impl Wrapper<Option<i32>> {
    fn inner_mut(&self) -> Option<&mut i32> {
        self.as_mut()
        //~^ ERROR no method named `as_mut` found for reference `&Wrapper<Option<i32>>` in the current scope
        //~| HELP one of the expressions' fields has a method of the same name
        //~| HELP items from traits can only be used if
    }

    fn inner_mut_bad(&self) -> Option<&mut u32> {
        self.as_mut()
        //~^ ERROR no method named `as_mut` found for reference `&Wrapper<Option<i32>>` in the current scope
        //~| HELP items from traits can only be used if
    }
}

fn main() {}