File tree 22 files changed +357
-18
lines changed
22 files changed +357
-18
lines changed Original file line number Diff line number Diff line change @@ -557,7 +557,7 @@ impl<'a> ExtCtxt<'a> {
557
557
self . recursion_count += 1 ;
558
558
if self . recursion_count > self . ecfg. recursion_limit {
559
559
self. span_fatal( ei. call_site,
560
- format!( "Recursion limit reached while expanding the macro `{}`" ,
560
+ format!( "recursion limit reached while expanding the macro `{}`" ,
561
561
ei. callee. name) . as_slice( ) ) ;
562
562
}
563
563
Original file line number Diff line number Diff line change 12
12
13
13
macro_rules! recursive(
14
14
( ) => (
15
- recursive!( ) //~ ERROR Recursion limit reached while expanding the macro `recursive`
15
+ recursive!( ) //~ ERROR recursion limit reached while expanding the macro `recursive`
16
16
)
17
17
)
18
18
Original file line number Diff line number Diff line change
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.
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
+ return . is_failure
13
+ //~^ ERROR attempted access of field `is_failure` on type `!`, but no field with that name was found
14
+ }
Original file line number Diff line number Diff line change
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.
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
+ loop { break . push ( 1 ) ; } //~ ERROR type `!` does not implement any method in scope named `push`
13
+ }
Original file line number Diff line number Diff line change
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.
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 NoLifetime {
12
+ fn get < ' p , T : Test < ' p > > ( & self ) -> T ;
13
+ }
14
+
15
+ trait Test < ' p > {
16
+ fn new ( buf : & ' p mut [ u8 ] ) -> Self ;
17
+ }
18
+
19
+ struct Foo < ' a > {
20
+ buf : & ' a mut [ u8 ] ,
21
+ }
22
+
23
+ impl < ' a > Test < ' a > for Foo < ' a > {
24
+ fn new ( buf : & ' a mut [ u8 ] ) -> Foo < ' a > {
25
+ Foo { buf : buf }
26
+ }
27
+ }
28
+
29
+ impl < ' a > NoLifetime for Foo < ' a > {
30
+ fn get < ' p , T : Test < ' a > > ( & self ) -> T {
31
+ //~^ ERROR lifetime parameters or bounds on method `get` do not match the trait declaration
32
+ return * self as T ; //~ ERROR non-scalar cast: `Foo<'a>` as `T`
33
+ }
34
+ }
35
+
36
+ fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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( macro_rules) ]
12
+
13
+ macro_rules! prob1 {
14
+ ( 0 ) => {
15
+ 0
16
+ } ;
17
+ ( $n: expr) => {
18
+ if ( $n % 3 == 0 ) || ( $n % 5 == 0 ) {
19
+ $n + prob1!( $n - 1 ) ; //~ ERROR recursion limit reached while expanding the macro `prob1`
20
+ } else {
21
+ prob1!( $n - 1 ) ;
22
+ }
23
+ } ;
24
+ }
25
+
26
+ fn main ( ) {
27
+ println ! ( "Problem 1: {}" , prob1!( 1000 ) ) ;
28
+ }
Original file line number Diff line number Diff line change
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.
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 MatrixShape { }
12
+
13
+ struct Col < D , C > {
14
+ data : D ,
15
+ col : C ,
16
+ }
17
+
18
+ impl < T , M : MatrixShape > Collection for Col < M , uint > {
19
+ //~^ ERROR unable to infer enough type information to locate the impl of the trait
20
+ //~^^ NOTE the trait `core::kinds::Sized` must be implemented because it is required by
21
+ fn len ( & self ) -> uint {
22
+ unimplemented ! ( )
23
+ }
24
+ }
25
+
26
+ fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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
+ use std:: ptr;
12
+ use std:: raw;
13
+
14
+ fn main ( ) {
15
+ unsafe {
16
+ let nil: * const u8 = ptr:: null ( ) ;
17
+ let slice: raw:: Slice < u8 > =
18
+ Slice { //~ ERROR use of trait `Slice` as a struct constructor [E0159]
19
+ data : nil,
20
+ len : 0 ,
21
+ } ;
22
+ }
23
+ }
Original file line number Diff line number Diff line change
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.
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 ListItem < ' a > {
12
+ fn list_name ( ) -> & ' a str ;
13
+ }
14
+
15
+ struct List < ' a , T : ListItem < ' a > > {
16
+ //~^ ERROR the parameter type `T` may not live long enough; consider adding an explicit lifetime bo
17
+ //~^^ NOTE ...so that the reference type `&'a [T]` does not outlive the data it points at
18
+ slice : & ' a [ T ]
19
+ }
20
+
21
+ impl < ' a , T : ListItem < ' a > > Collection for List < ' a , T > {
22
+ fn len ( & self ) -> uint {
23
+ 0
24
+ }
25
+ }
26
+
27
+ fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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
+ enum A {
12
+ B ( char ) ,
13
+ C ( [ Box < A > ] ) ,
14
+ }
15
+
16
+ fn c ( c : char ) -> A {
17
+ B ( c) //~ ERROR cannot move a value of type A: the size of A cannot be statically determined
18
+ }
19
+
20
+ pub fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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( dead_code) ]
12
+
13
+ static mut x: int = 3 ;
14
+ static mut y: int = unsafe {
15
+ x
16
+ //~^ ERROR cannot refer to other statics by value, use the address-of operator or a constant instea
17
+ } ;
18
+
19
+ fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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 MyItem < T > { }
12
+ impl < T > MyItem < T > for T { }
13
+
14
+ pub fn build_archive < ' a , I : MyItem < & ' a ( |& uint |: ' a ) > > ( files : I ) { }
15
+
16
+ fn main ( ) {
17
+ build_archive ( & ( |_| { } ) ) ;
18
+ //~^ ERROR unable to infer enough type information to locate the impl of the trait `MyItem<&|&uint|
19
+ }
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- // ignore-test
12
- //
13
- // Ignored because of an ICE at the moment.
14
-
15
11
// Check that non-constant exprs do fail as count in fixed length vec type
16
12
17
13
fn main ( ) {
Original file line number Diff line number Diff line change 1
- // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1
+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
2
// file at the top-level directory of this distribution and at
3
3
// http://rust-lang.org/COPYRIGHT.
4
4
//
8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- // ignore-test #12920
11
+ trait Foo {
12
+ fn quux ( u8 ) { }
13
+ }
12
14
13
- pub fn main ( ) { if 1 == 1 { return ; } println ! ( "Paul is dead" ) ; }
15
+ fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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
+ static TEST_VALUE : * const [ int , ..2 ] = 0x1234 as * const [ int , ..2 ] ;
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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
+ static mut n_mut: uint = 0 ;
12
+
13
+ static n: & ' static uint = unsafe { & n_mut } ;
14
+
15
+ fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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
+ let mut buf = Vec :: new ( ) ;
13
+ |c : u8 | buf. push ( c) ;
14
+ }
Original file line number Diff line number Diff line change
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.
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 MatrixRow { }
12
+
13
+ struct Mat ;
14
+
15
+ impl < ' a > MatrixRow for & ' a Mat { }
16
+
17
+ struct Rows < M : MatrixRow > {
18
+ mat : M ,
19
+ }
20
+
21
+ impl < ' a > Iterator < ( ) > for Rows < & ' a Mat > {
22
+ fn next ( & mut self ) -> Option < ( ) > {
23
+ unimplemented ! ( )
24
+ }
25
+ }
26
+
27
+ fn main ( ) { }
Original file line number Diff line number Diff line change
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.
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
+ use std:: io:: BufReader ;
12
+ use std:: io:: BufferedReader ;
13
+ use std:: io:: File ;
14
+ use std:: io:: IoResult ;
15
+
16
+ struct Lexer < R : Reader >
17
+ {
18
+ reader : BufferedReader < R > ,
19
+ }
20
+
21
+ impl < R : Reader > Lexer < R >
22
+ {
23
+ pub fn new_from_reader ( r : R ) -> Lexer < R >
24
+ {
25
+ Lexer { reader : BufferedReader :: new ( r) }
26
+ }
27
+
28
+ pub fn new_from_file ( p : Path ) -> IoResult < Lexer < File > >
29
+ {
30
+ Ok ( Lexer :: new_from_reader ( try!( File :: open ( & p) ) ) )
31
+ }
32
+
33
+ pub fn new_from_str < ' a > ( s : & ' a str ) -> Lexer < BufReader < ' a > >
34
+ {
35
+ Lexer :: new_from_reader ( BufReader :: new ( s. as_bytes ( ) ) )
36
+ }
37
+ }
38
+
39
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments