File tree Expand file tree Collapse file tree 7 files changed +119
-0
lines changed
run-pass-fulldeps/proc-macro Expand file tree Collapse file tree 7 files changed +119
-0
lines changed Original file line number Diff line number Diff line change 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 struct X ( [ u8 ] ) ;
12+
13+ pub static Y : & ' static X = {
14+ const Y : & ' static [ u8 ] = b"" ;
15+ & X ( * Y )
16+ //~^ ERROR cannot move out
17+ //~^^ ERROR cannot move a
18+ //~^^^ ERROR cannot move a
19+ } ;
20+
21+ fn main ( ) { }
Original file line number Diff line number Diff line change 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+ #![ feature( rustc_attrs) ]
12+
13+ use std:: fmt;
14+
15+ // CoerceUnsized is not implemented for tuples. You can still create
16+ // an unsized tuple by transmuting a trait object.
17+ fn any < T > ( ) -> T { unreachable ! ( ) }
18+
19+ #[ rustc_error]
20+ fn main ( ) { //~ ERROR compilation successful
21+ let t: & ( u8 , fmt:: Debug ) = any ( ) ;
22+ println ! ( "{:?}" , & t. 1 ) ;
23+ }
Original file line number Diff line number Diff line change 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+ fn main ( ) {
12+ extern crate libc; //~ ERROR use of unstable
13+ use libc:: * ; //~ ERROR unresolved import
14+ }
Original file line number Diff line number Diff line change 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+ trait Foo {
12+ const AMT : usize ;
13+ }
14+
15+ enum Bar < A , B > {
16+ First ( A ) ,
17+ Second ( B ) ,
18+ }
19+
20+ impl < A : Foo , B : Foo > Foo for Bar < A , B > {
21+ const AMT : usize = [ A :: AMT ] [ ( A :: AMT > B :: AMT ) as usize ] ; //~ ERROR constant evaluation
22+ }
23+
24+ impl Foo for u8 {
25+ const AMT : usize = 1 ;
26+ }
27+
28+ impl Foo for u16 {
29+ const AMT : usize = 2 ;
30+ }
31+
32+ fn main ( ) {
33+ println ! ( "{}" , <Bar <u16 , u8 > as Foo >:: AMT ) ;
34+ }
Original file line number Diff line number Diff line change 99// except according to those terms.
1010
1111// aux-build:attr-on-trait.rs
12+ // ignore-stage1
1213
1314#![ feature( proc_macro) ]
1415
Original file line number Diff line number Diff line change 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+ fn f ( x : & mut u32 ) { }
12+
13+ fn main ( ) {
14+ let x = Box :: new ( 3 ) ;
15+ f ( & mut * x) ;
16+ }
Original file line number Diff line number Diff line change 1+ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable
2+ --> $DIR/issue-36400.rs:15:12
3+ |
4+ 14 | let x = Box::new(3);
5+ | - consider changing this to `mut x`
6+ 15 | f(&mut *x);
7+ | ^^ cannot borrow as mutable
8+
9+ error: aborting due to previous error
10+
You can’t perform that action at this time.
0 commit comments