File tree Expand file tree Collapse file tree 12 files changed +288
-0
lines changed Expand file tree Collapse file tree 12 files changed +288
-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+ fn main ( ) {
12+ /// comment //~ ERROR found a documentation comment that doesn't document anything
13+ }
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+ #[ rustc_error]
15+ fn main ( ) { //~ ERROR compilation successful
16+ /// crash
17+ let x = 0 ;
18+ }
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+ #![ allow( warnings) ]
12+
13+ trait Trait < T > {
14+ fn foo ( _: T ) { }
15+ }
16+
17+ pub struct Foo < T = Box < Trait < DefaultFoo > > > ;
18+ type DefaultFoo = Foo ; //~ ERROR unsupported cyclic reference
19+
20+ fn main ( ) {
21+ }
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:: mem;
14+
15+ trait Trait1 < T > { }
16+ trait Trait2 < ' a > {
17+ type Ty ;
18+ }
19+
20+ fn _ice ( param : Box <for <' a > Trait1 < <( ) as Trait2 < ' a > >:: Ty > >) {
21+ let _e: ( usize , usize ) = unsafe { mem:: transmute ( param) } ;
22+ }
23+
24+ trait Lifetime < ' a > {
25+ type Out ;
26+ }
27+ impl < ' a > Lifetime < ' a > for ( ) {
28+ type Out = & ' a ( ) ;
29+ }
30+ fn foo < ' a > ( x : & ' a ( ) ) -> <( ) as Lifetime < ' a > >:: Out {
31+ x
32+ }
33+
34+ fn takes_lifetime ( _f : for <' a > fn ( & ' a ( ) ) -> <( ) as Lifetime < ' a > >:: Out ) {
35+ }
36+
37+ #[ rustc_error]
38+ fn main ( ) { //~ ERROR compilation successful
39+ takes_lifetime ( foo) ;
40+ }
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+ pub trait Foo {
14+ type Bar ;
15+ }
16+
17+ pub trait Broken {
18+ type Assoc ;
19+ fn broken ( & self ) where Self :: Assoc : Foo ;
20+ }
21+
22+ impl < T > Broken for T {
23+ type Assoc = ( ) ;
24+ fn broken ( & self ) where Self :: Assoc : Foo {
25+ let _x: <Self :: Assoc as Foo >:: Bar ;
26+ }
27+ }
28+
29+ #[ rustc_error]
30+ fn main ( ) { //~ ERROR compilation successful
31+ let _m: & Broken < Assoc =( ) > = & ( ) ;
32+ }
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, associated_type_defaults) ]
12+ #![ allow( warnings) ]
13+
14+ trait State : Sized {
15+ type NextState : State = StateMachineEnded ;
16+ fn execute ( self ) -> Option < Self :: NextState > ;
17+ }
18+
19+ struct StateMachineEnded ;
20+
21+ impl State for StateMachineEnded {
22+ fn execute ( self ) -> Option < Self :: NextState > {
23+ None
24+ }
25+ }
26+
27+ #[ rustc_error]
28+ fn main ( ) { //~ ERROR compilation successful
29+ }
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+ #[ derive( Debug ) ]
15+ struct Point {
16+ }
17+
18+ struct NestedA < ' a , ' b > {
19+ x : & ' a NestedB < ' b >
20+ //~^ ERROR E0491
21+ }
22+
23+ struct NestedB < ' a > {
24+ x : & ' a i32 ,
25+ }
26+
27+ fn main ( ) {
28+ }
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+ // ignore-emscripten
12+
13+ #![ feature( rustc_attrs, asm) ]
14+
15+ macro_rules! interrupt_handler {
16+ ( ) => {
17+ unsafe fn _interrupt_handler( ) {
18+ asm!( "pop eax" :: :: "intel" ) ;
19+ }
20+ }
21+ }
22+ interrupt_handler ! { }
23+
24+ #[ rustc_error]
25+ fn main ( ) { //~ ERROR compilation successful
26+ }
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+ fn foo ( _: & mut i32 ) -> bool { true }
14+
15+ #[ rustc_error]
16+ fn main ( ) { //~ ERROR compilation successful
17+ let opt = Some ( 92 ) ;
18+ let mut x = 62 ;
19+
20+ if let Some ( _) = opt {
21+
22+ } else if foo ( & mut x) {
23+
24+ }
25+ }
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+ type Z = for <' x > Send ;
14+ //~^ WARN type alias is never used
15+
16+ #[ rustc_error]
17+ fn main ( ) { //~ ERROR compilation successful
18+ }
You can’t perform that action at this time.
0 commit comments