File tree 10 files changed +227
-0
lines changed
10 files changed +227
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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 Foo < ' a , A > ( & ' a A ) ;
12
+
13
+ impl < ' a , A > Foo < ' a , A > {
14
+ pub fn new ( a : & ' a A ) -> Foo < ' a , A > {
15
+ Foo ( a)
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+
12
+ pub enum Foo < ' a > {
13
+ A ,
14
+ B ( & ' a str ) ,
15
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+
12
+ trait Serializable < ' self , T > { //~ ERROR: no longer a special lifetime
13
+ fn serialize ( val : & ' self T ) -> ~[ u8 ] ;
14
+ fn deserialize ( repr : & [ u8 ] ) -> & ' self T ;
15
+ }
16
+
17
+ impl < ' self > Serializable < str > for & ' self str {
18
+ fn serialize ( val : & ' self str ) -> ~[ u8 ] {
19
+ ~[ 1 ]
20
+ }
21
+ fn deserialize ( repr : & [ u8 ] ) -> & ' self str {
22
+ "hi"
23
+ }
24
+ }
25
+
26
+ fn main ( ) {
27
+ println ( "hello" ) ;
28
+ let x = ~"foo";
29
+ let y = x;
30
+ println ( y) ;
31
+ }
Original file line number Diff line number Diff line change
1
+ // opyright 2013 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
+ #[ path = "../compile-fail" ]
12
+ mod foo; //~ ERROR: illegal operation on a directory
13
+
14
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+ // xfail-fast
12
+
13
+ pub use local_alias = local;
14
+
15
+ mod local { }
16
+
17
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+ // xfail-fast
12
+ // aux-build:issue-7178.rs
13
+
14
+ extern mod cross_crate_self = "issue-7178" ;
15
+
16
+ fn main ( ) {
17
+ let _ = cross_crate_self:: Foo :: new ( & 1 i) ;
18
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+ // xfail-fast
12
+ // aux-build:issue-8259.rs
13
+
14
+ extern mod other = "issue-8259" ;
15
+ static a: other:: Foo < ' static > = other:: A ;
16
+
17
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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 UninterpretedOption_NamePart {
12
+ name_part : Option < ~str > ,
13
+ }
14
+
15
+ impl < ' a > UninterpretedOption_NamePart {
16
+ pub fn default_instance( ) -> & ' static UninterpretedOption_NamePart {
17
+ static instance: UninterpretedOption_NamePart = UninterpretedOption_NamePart {
18
+ name_part : None ,
19
+ } ;
20
+ & ' static instance
21
+ }
22
+ }
23
+
24
+ pub fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+ enum T {
14
+ A ( int ) ,
15
+ B ( uint )
16
+ }
17
+
18
+ macro_rules! test(
19
+ ( $e: expr) => (
20
+ fn foo( t: T ) -> int {
21
+ match t {
22
+ A ( y) => $e,
23
+ B ( y) => $e
24
+ }
25
+ }
26
+ )
27
+ )
28
+
29
+ test ! ( 10 + ( y as int) )
30
+
31
+ pub fn main ( ) {
32
+ foo ( A ( 20 ) ) ;
33
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+ // xfail-pretty
12
+
13
+ #[ feature( managed_boxes, macro_rules) ] ;
14
+
15
+ pub trait bomb { fn boom ( @self , Ident ) ; }
16
+ pub struct S ;
17
+ impl bomb for S { fn boom ( @self , _: Ident ) { } }
18
+
19
+ pub struct Ident { name : uint }
20
+
21
+ // macro_rules! int3( () => ( unsafe { asm!( "int3" ); } ) )
22
+ macro_rules! int3( ( ) => ( { } ) )
23
+
24
+ fn Ident_new ( ) -> Ident {
25
+ int3 ! ( ) ;
26
+ Ident { name : 0x6789ABCD }
27
+ }
28
+
29
+ pub fn light_fuse ( fld : @bomb ) {
30
+ int3 ! ( ) ;
31
+ let f = || {
32
+ int3 ! ( ) ;
33
+ fld. boom ( Ident_new ( ) ) ; // *** 1
34
+ } ;
35
+ f ( ) ;
36
+ }
37
+
38
+ pub fn main ( ) {
39
+ let b = @S as @bomb ;
40
+ light_fuse ( b) ;
41
+ }
You can’t perform that action at this time.
0 commit comments