File tree 5 files changed +124
-0
lines changed 5 files changed +124
-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
+ #![ feature( rustc_attrs) ]
12
+ #![ allow( warnings) ]
13
+
14
+ struct Attr {
15
+ name : String ,
16
+ value : String ,
17
+ }
18
+
19
+ struct Element {
20
+ attrs : Vec < Box < Attr > > ,
21
+ }
22
+
23
+ impl Element {
24
+ pub unsafe fn get_attr < ' a > ( & ' a self , name : & str ) {
25
+ self . attrs
26
+ . iter ( )
27
+ . find ( |attr| {
28
+ let attr: & & Box < Attr > = std:: mem:: transmute ( attr) ;
29
+ true
30
+ } ) ;
31
+ }
32
+ }
33
+
34
+ #[ rustc_error]
35
+ fn main ( ) { //~ ERROR compilation successful
36
+ let element = Element { attrs : Vec :: new ( ) } ;
37
+ let _ = unsafe { element. get_attr ( "foo" ) } ;
38
+ }
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
+ #![ allow( warnings) ]
13
+
14
+ trait A < T > { }
15
+ struct B < T > where B < T > : A < B < T > > { t : T }
16
+
17
+ #[ rustc_error]
18
+ fn main ( ) { //~ ERROR compilation successful
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( unboxed_closures, fn_traits, rustc_attrs) ]
12
+
13
+ struct Foo ;
14
+
15
+ impl < A > FnOnce < ( A , ) > for Foo {
16
+ type Output = ( ) ;
17
+ extern "rust-call" fn call_once ( self , ( _, ) : ( A , ) ) {
18
+ }
19
+ }
20
+ #[ rustc_error]
21
+ fn main ( ) { //~ ERROR compilation successful
22
+ println ! ( "{:?}" , Foo ( "bar" ) ) ;
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
+ #![ feature( unboxed_closures, fn_traits, rustc_attrs) ]
12
+
13
+ #[ rustc_error]
14
+ fn main ( ) { //~ ERROR compilation successful
15
+ let k = |x : i32 | { x + 1 } ;
16
+ Fn :: call ( & k, ( 0 , ) ) ;
17
+ }
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
+ #![ allow( warnings) ]
13
+
14
+ trait Mirror {
15
+ type It ;
16
+ }
17
+
18
+ impl < T > Mirror for T {
19
+ type It = Self ;
20
+ }
21
+
22
+
23
+ #[ rustc_error]
24
+ fn main ( ) { //~ ERROR compilation successful
25
+ let c: <u32 as Mirror >:: It = 5 ;
26
+ const CCCC : <u32 as Mirror >:: It = 5 ;
27
+ }
You can’t perform that action at this time.
0 commit comments