]> git.lizzy.rs Git - rust.git/blob - src/test/ui/did_you_mean/issue-39544.rs
Rollup merge of #41135 - japaric:unstable-docs, r=steveklabnik
[rust.git] / src / test / ui / did_you_mean / issue-39544.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 pub enum X {
12     Y
13 }
14
15 pub struct Z {
16     x: X
17 }
18
19 fn main() {
20     let z = Z { x: X::Y };
21     let _ = &mut z.x;
22 }
23
24 impl Z {
25     fn foo<'z>(&'z self) {
26         let _ = &mut self.x;
27     }
28
29     fn foo1(&self, other: &Z) {
30         let _ = &mut self.x;
31         let _ = &mut other.x;
32     }
33
34     fn foo2<'a>(&'a self, other: &Z) {
35         let _ = &mut self.x;
36         let _ = &mut other.x;
37     }
38
39     fn foo3<'a>(self: &'a Self, other: &Z) {
40         let _ = &mut self.x;
41         let _ = &mut other.x;
42     }
43
44     fn foo4(other: &Z) {
45         let _ = &mut other.x;
46     }
47
48 }
49
50 pub fn with_arg(z: Z, w: &Z) {
51     let _ = &mut z.x;
52     let _ = &mut w.x;
53 }
54
55 pub fn with_tuple() {
56     let mut y = 0;
57     let x = (&y,);
58     *x.0 = 1;
59 }