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.
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.
11 // Test DST raw pointers
13 // pretty-expanded FIXME #23616
23 fn foo(&self) -> int {
28 struct Foo<T: ?Sized> {
35 let z: *const Trait = &x;
42 let p = Foo {f: A { f: 42 }};
43 let o: *const Foo<Trait> = &p;
50 let a: *const [_] = &[1, 2, 3];
58 // raw slice with explicit cast
59 let a = &[1, 2, 3] as *const [_];
67 // raw DST struct with slice
68 let c: *const Foo<[_]> = &Foo {f: [1, 2, 3]};
72 let len = (&*c).f.len();
76 // all of the above with *mut
77 let mut x = A { f: 42 };
78 let z: *mut Trait = &mut x;
84 let mut p = Foo {f: A { f: 42 }};
85 let o: *mut Foo<Trait> = &mut p;
91 let a: *mut [_] = &mut [1, 2, 3];
99 let a = &mut [1, 2, 3] as *mut [_];
103 let len = (*a).len();
107 let c: *mut Foo<[_]> = &mut Foo {f: [1, 2, 3]};
111 let len = (&*c).f.len();