]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2014 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 | ||
b7449926 | 11 | // run-pass |
c34b1796 AL |
12 | // pretty-expanded FIXME #23616 |
13 | ||
1a4d82fc JJ |
14 | mod a { |
15 | pub enum Enum<T> { | |
16 | A(T), | |
17 | } | |
18 | ||
85aaf69f SL |
19 | pub trait X { |
20 | fn dummy(&self) { } | |
21 | } | |
c34b1796 | 22 | impl X for isize {} |
1a4d82fc JJ |
23 | |
24 | pub struct Z<'a>(Enum<&'a (X+'a)>); | |
c34b1796 | 25 | fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &X)); let _ = z; } |
1a4d82fc JJ |
26 | } |
27 | ||
28 | mod b { | |
85aaf69f SL |
29 | trait X { |
30 | fn dummy(&self) { } | |
31 | } | |
c34b1796 | 32 | impl X for isize {} |
1a4d82fc JJ |
33 | struct Y<'a>{ |
34 | x:Option<&'a (X+'a)>, | |
35 | } | |
36 | ||
37 | fn bar() { | |
c34b1796 | 38 | let x: isize = 42; |
1a4d82fc JJ |
39 | let _y = Y { x: Some(&x as &X) }; |
40 | } | |
41 | } | |
42 | ||
43 | mod c { | |
44 | pub trait X { fn f(&self); } | |
c34b1796 | 45 | impl X for isize { fn f(&self) {} } |
1a4d82fc | 46 | pub struct Z<'a>(Option<&'a (X+'a)>); |
c34b1796 | 47 | fn main() { let x: isize = 42; let z = Z(Some(&x as &X)); let _ = z; } |
1a4d82fc JJ |
48 | } |
49 | ||
50 | pub fn main() {} |