File tree 8 files changed +175
-0
lines changed
8 files changed +175
-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
+ // Shadowing a unit-like enum in a closure
12
+
13
+ struct Test ;
14
+
15
+ fn main ( ) {
16
+ || {
17
+ let Test = 1 ; //~ ERROR let bindings cannot shadow unit structs
18
+ } ;
19
+ }
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( associated_consts) ]
12
+
13
+ trait VecN {
14
+ const DIM : usize ;
15
+ }
16
+ trait Mat {
17
+ type Row : VecN ;
18
+ }
19
+
20
+ fn m < M : Mat > ( ) {
21
+ let a = [ 3 ; M :: Row :: DIM ] ; //~ ERROR associated type `Row` not found for `M`
22
+ }
23
+ fn main ( ) {
24
+ }
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
+ // error-pattern:index out of bounds: the len is 5 but the index is 5
12
+
13
+ #![ feature( const_fn) ]
14
+ const fn test ( x : usize ) -> i32 {
15
+ [ 42 ; 5 ] [ x]
16
+ }
17
+
18
+ fn main ( ) {
19
+ let _ = test ( 5 ) ;
20
+ }
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( optin_builtin_traits) ]
12
+
13
+ trait NotSame { }
14
+ impl NotSame for .. { }
15
+ impl < A > !NotSame for ( A , A ) { }
16
+
17
+ trait OneOfEach { }
18
+
19
+ impl < A > OneOfEach for ( A , ) { }
20
+
21
+ impl < A , B > OneOfEach for ( A , B )
22
+ where
23
+ ( B , ) : OneOfEach ,
24
+ ( A , B ) : NotSame ,
25
+ {
26
+ }
27
+
28
+ 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( associated_consts) ]
12
+
13
+ use std:: marker:: PhantomData ;
14
+
15
+ trait Tr < ' a > {
16
+ const C : PhantomData < & ' a u8 > = PhantomData :: < & ' a u8 > ;
17
+ }
18
+
19
+ 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
+ macro_rules! expr { ( ) => { ( ) } }
12
+
13
+ enum A { }
14
+
15
+ impl A {
16
+ const A : ( ) = expr ! ( ) ;
17
+ }
18
+
19
+ 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( repr_simd, platform_intrinsics) ]
12
+
13
+ #[ repr( C ) ]
14
+ #[ repr( simd) ]
15
+ #[ derive( Copy , Clone , Debug ) ]
16
+ pub struct char3 ( pub i8 , pub i8 , pub i8 ) ;
17
+
18
+ #[ repr( C ) ]
19
+ #[ repr( simd) ]
20
+ #[ derive( Copy , Clone , Debug ) ]
21
+ pub struct short3 ( pub i16 , pub i16 , pub i16 ) ;
22
+
23
+ extern "platform-intrinsic" {
24
+ fn simd_cast < T , U > ( x : T ) -> U ;
25
+ }
26
+
27
+ fn main ( ) {
28
+ let cast: short3 = unsafe { simd_cast ( char3 ( 10 , -3 , -9 ) ) } ;
29
+
30
+ println ! ( "{:?}" , cast) ;
31
+ }
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
+ // compile-flags:--test
12
+
13
+ // rustdoc should not panic when target crate has compilation errors
14
+
15
+ fn main ( ) { 0 }
You can’t perform that action at this time.
0 commit comments