diff options
| author | bors <bors@rust-lang.org> | 2014-11-27 04:32:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-11-27 04:32:12 +0000 |
| commit | f358ca45c8cf8a5ea8922b5c66403d6a4f4d52ad (patch) | |
| tree | 755e6d6f67ea238da49c5a697375b20b2513bc66 /src/test | |
| parent | fac5a07679cac21a580badc84b755b8df0f975cf (diff) | |
| parent | 5816d7f5305ce4401326568785d624e689064311 (diff) | |
| download | rust-f358ca45c8cf8a5ea8922b5c66403d6a4f4d52ad.tar.gz rust-f358ca45c8cf8a5ea8922b5c66403d6a4f4d52ad.zip | |
auto merge of #19342 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/test')
45 files changed, 254 insertions, 58 deletions
diff --git a/src/test/auxiliary/issue-13872-2.rs b/src/test/auxiliary/issue-13872-2.rs index e2744b7910f..8294d2b4594 100644 --- a/src/test/auxiliary/issue-13872-2.rs +++ b/src/test/auxiliary/issue-13872-2.rs @@ -10,4 +10,4 @@ extern crate "issue-13872-1" as foo; -pub use foo::B; +pub use foo::A::B; diff --git a/src/test/auxiliary/issue_19293.rs b/src/test/auxiliary/issue_19293.rs new file mode 100644 index 00000000000..40c8eb9b23a --- /dev/null +++ b/src/test/auxiliary/issue_19293.rs @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Foo (pub int); +pub enum MyEnum { + Foo(Foo), +} diff --git a/src/test/compile-fail/dst-index.rs b/src/test/compile-fail/dst-index.rs index 542562b69e6..f6511d68662 100644 --- a/src/test/compile-fail/dst-index.rs +++ b/src/test/compile-fail/dst-index.rs @@ -25,7 +25,7 @@ impl Index<uint, str> for S { struct T; impl Index<uint, Show + 'static> for T { - fn index<'a>(&'a self, idx: &uint) -> &'a Show + 'static { + fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) { static x: uint = 42; &x } diff --git a/src/test/compile-fail/enums-are-namespaced-xc.rs b/src/test/compile-fail/enums-are-namespaced-xc.rs new file mode 100644 index 00000000000..5315e6c834a --- /dev/null +++ b/src/test/compile-fail/enums-are-namespaced-xc.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:namespaced_enums.rs +extern crate namespaced_enums; + +fn main() { + let _ = namespaced_enums::A; //~ ERROR unresolved name + let _ = namespaced_enums::B(10); //~ ERROR unresolved name + let _ = namespaced_enums::C { a: 10 }; //~ ERROR does not name a structure +} diff --git a/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs b/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs new file mode 100644 index 00000000000..ff3512ad8e7 --- /dev/null +++ b/src/test/compile-fail/hrtb-precedence-of-plus-error-message.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unboxed_closures)] + +// Test that we suggest the correct parentheses + +trait Bar { + fn dummy(&self) { } +} + +struct Foo<'a> { + a: &'a Bar+'a, + //~^ ERROR E0171 + //~^^ NOTE perhaps you meant `&'a (Bar + 'a)`? + + b: &'a mut Bar+'a, + //~^ ERROR E0171 + //~^^ NOTE perhaps you meant `&'a mut (Bar + 'a)`? + + c: Box<Bar+'a>, // OK, no paren needed in this context + + d: fn() -> Bar+'a, + //~^ ERROR E0171 + //~^^ NOTE perhaps you forgot parentheses + //~^^^ WARN deprecated syntax +} + +fn main() { } diff --git a/src/test/compile-fail/issue-12470.rs b/src/test/compile-fail/issue-12470.rs index aa7e3cd3739..0202d538cf6 100644 --- a/src/test/compile-fail/issue-12470.rs +++ b/src/test/compile-fail/issue-12470.rs @@ -24,7 +24,7 @@ impl X for B { } struct A<'a> { - p: &'a X+'a + p: &'a (X+'a) } fn make_a<'a>(p: &'a X) -> A<'a> { diff --git a/src/test/compile-fail/issue-14285.rs b/src/test/compile-fail/issue-14285.rs index 624ddf0c8bb..cbf4412a81d 100644 --- a/src/test/compile-fail/issue-14285.rs +++ b/src/test/compile-fail/issue-14285.rs @@ -14,7 +14,7 @@ struct A; impl Foo for A {} -struct B<'a>(&'a Foo+'a); +struct B<'a>(&'a (Foo+'a)); fn foo<'a>(a: &Foo) -> B<'a> { B(a) //~ ERROR cannot infer an appropriate lifetime diff --git a/src/test/compile-fail/issue-19244-1.rs b/src/test/compile-fail/issue-19244-1.rs new file mode 100644 index 00000000000..4fcbb878890 --- /dev/null +++ b/src/test/compile-fail/issue-19244-1.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(tuple_indexing)] + +const TUP: (uint,) = (42,); + +fn main() { + let a: [int, ..TUP.1]; + //~^ ERROR expected constant expr for array length: tuple index out of bounds +} diff --git a/src/test/compile-fail/issue-19244-2.rs b/src/test/compile-fail/issue-19244-2.rs new file mode 100644 index 00000000000..d9aeecc0222 --- /dev/null +++ b/src/test/compile-fail/issue-19244-2.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct MyStruct { field: uint } +const STRUCT: MyStruct = MyStruct { field: 42 }; + +fn main() { + let a: [int, ..STRUCT.nonexistent_field]; + //~^ ERROR expected constant expr for array length: nonexistent struct field +} diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs index 499144698fb..202529c30b3 100644 --- a/src/test/compile-fail/kindck-copy.rs +++ b/src/test/compile-fail/kindck-copy.rs @@ -44,15 +44,15 @@ fn test<'a,T,U:Copy>(_: &'a int) { // borrowed object types are generally ok assert_copy::<&'a Dummy>(); - assert_copy::<&'a Dummy+Copy>(); - assert_copy::<&'static Dummy+Copy>(); + assert_copy::<&'a (Dummy+Copy)>(); + assert_copy::<&'static (Dummy+Copy)>(); // owned object types are not ok assert_copy::<Box<Dummy>>(); //~ ERROR `core::kinds::Copy` is not implemented assert_copy::<Box<Dummy+Copy>>(); //~ ERROR `core::kinds::Copy` is not implemented // mutable object types are not ok - assert_copy::<&'a mut Dummy+Copy>(); //~ ERROR `core::kinds::Copy` is not implemented + assert_copy::<&'a mut (Dummy+Copy)>(); //~ ERROR `core::kinds::Copy` is not implemented // closures are like an `&mut` object assert_copy::<||>(); //~ ERROR `core::kinds::Copy` is not implemented diff --git a/src/test/compile-fail/kindck-send-object.rs b/src/test/compile-fail/kindck-send-object.rs index 9217d05002d..4fbb3eab8c4 100644 --- a/src/test/compile-fail/kindck-send-object.rs +++ b/src/test/compile-fail/kindck-send-object.rs @@ -19,7 +19,7 @@ trait Message : Send { } // careful with object types, who knows what they close over... fn object_ref_with_static_bound_not_ok() { - assert_send::<&'static Dummy+'static>(); + assert_send::<&'static (Dummy+'static)>(); //~^ ERROR the trait `core::kinds::Send` is not implemented } @@ -36,7 +36,7 @@ fn closure_with_no_bound_not_ok<'a>() { } fn object_with_send_bound_ok() { - assert_send::<&'static Dummy+Send>(); + assert_send::<&'static (Dummy+Send)>(); assert_send::<Box<Dummy+Send>>(); assert_send::<proc():Send>; assert_send::<||:Send>; diff --git a/src/test/compile-fail/kindck-send-object1.rs b/src/test/compile-fail/kindck-send-object1.rs index ff8daa045c6..a5519753643 100644 --- a/src/test/compile-fail/kindck-send-object1.rs +++ b/src/test/compile-fail/kindck-send-object1.rs @@ -21,13 +21,13 @@ fn test51<'a>() { //~^ ERROR the trait `core::kinds::Send` is not implemented } fn test52<'a>() { - assert_send::<&'a Dummy+Send>(); + assert_send::<&'a (Dummy+Send)>(); //~^ ERROR does not fulfill the required lifetime } // ...unless they are properly bounded fn test60() { - assert_send::<&'static Dummy+Send>(); + assert_send::<&'static (Dummy+Send)>(); } fn test61() { assert_send::<Box<Dummy+Send>>(); diff --git a/src/test/compile-fail/kindck-send-object2.rs b/src/test/compile-fail/kindck-send-object2.rs index d46c6e68c05..ea8c2628306 100644 --- a/src/test/compile-fail/kindck-send-object2.rs +++ b/src/test/compile-fail/kindck-send-object2.rs @@ -23,7 +23,7 @@ fn test53() { // ...unless they are properly bounded fn test60() { - assert_send::<&'static Dummy+Send>(); + assert_send::<&'static (Dummy+Send)>(); } fn test61() { assert_send::<Box<Dummy+Send>>(); diff --git a/src/test/compile-fail/region-object-lifetime-1.rs b/src/test/compile-fail/region-object-lifetime-1.rs index 01daeb628ef..4758ce71fff 100644 --- a/src/test/compile-fail/region-object-lifetime-1.rs +++ b/src/test/compile-fail/region-object-lifetime-1.rs @@ -28,14 +28,14 @@ fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { // Borrowed receiver with two distinct lifetimes, but we know that // 'b:'a, hence &'a () is permitted. -fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a Foo+'b) -> &'a () { +fn borrowed_receiver_related_lifetimes<'a,'b>(x: &'a (Foo+'b)) -> &'a () { x.borrowed() } // Here we have two distinct lifetimes, but we try to return a pointer // with the longer lifetime when (from the signature) we only know // that it lives as long as the shorter lifetime. Therefore, error. -fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a Foo+'b) -> &'b () { +fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { x.borrowed() //~ ERROR cannot infer } diff --git a/src/test/compile-fail/regions-bounded-by-send.rs b/src/test/compile-fail/regions-bounded-by-send.rs index 182b40ceaae..660a9be4f63 100644 --- a/src/test/compile-fail/regions-bounded-by-send.rs +++ b/src/test/compile-fail/regions-bounded-by-send.rs @@ -57,12 +57,12 @@ fn box_with_region_not_ok<'a>() { // objects with insufficient bounds no ok fn object_with_random_bound_not_ok<'a>() { - assert_send::<&'a Dummy+'a>(); + assert_send::<&'a (Dummy+'a)>(); //~^ ERROR not implemented } fn object_with_send_bound_not_ok<'a>() { - assert_send::<&'a Dummy+Send>(); + assert_send::<&'a (Dummy+Send)>(); //~^ ERROR does not fulfill } diff --git a/src/test/compile-fail/regions-close-object-into-object.rs b/src/test/compile-fail/regions-close-object-into-object.rs index 835c55c9bd1..48945868bd3 100644 --- a/src/test/compile-fail/regions-close-object-into-object.rs +++ b/src/test/compile-fail/regions-close-object-into-object.rs @@ -10,7 +10,7 @@ trait A<T> {} -struct B<'a, T>(&'a A<T>+'a); +struct B<'a, T>(&'a (A<T>+'a)); trait X {} impl<'a, T> X for B<'a, T> {} diff --git a/src/test/compile-fail/regions-trait-variance.rs b/src/test/compile-fail/regions-trait-variance.rs index 3ceb4e3fef6..4e31a41c4e0 100644 --- a/src/test/compile-fail/regions-trait-variance.rs +++ b/src/test/compile-fail/regions-trait-variance.rs @@ -31,7 +31,7 @@ impl Drop for B { } struct A<'r> { - p: &'r X+'r + p: &'r (X+'r) } fn make_a(p:&X) -> A { diff --git a/src/test/compile-fail/trait-bounds-not-on-impl.rs b/src/test/compile-fail/trait-bounds-not-on-impl.rs index 38c78144601..a034352c4a6 100644 --- a/src/test/compile-fail/trait-bounds-not-on-impl.rs +++ b/src/test/compile-fail/trait-bounds-not-on-impl.rs @@ -13,7 +13,7 @@ trait Foo { struct Bar; -impl Foo + Owned for Bar { //~ ERROR bounded traits are only valid in type position +impl Foo + Owned for Bar { //~ ERROR not a trait } fn main() { } diff --git a/src/test/compile-fail/trait-bounds-not-on-struct.rs b/src/test/compile-fail/trait-bounds-not-on-struct.rs index 0a5909ff2ef..081efa429c3 100644 --- a/src/test/compile-fail/trait-bounds-not-on-struct.rs +++ b/src/test/compile-fail/trait-bounds-not-on-struct.rs @@ -11,6 +11,6 @@ struct Foo; -fn foo(_x: Box<Foo + Send>) { } //~ ERROR kind bounds can only be used on trait types +fn foo(_x: Box<Foo + Send>) { } //~ ERROR expected a reference to a trait fn main() { } diff --git a/src/test/compile-fail/trait-bounds-sugar.rs b/src/test/compile-fail/trait-bounds-sugar.rs index 7ed8db4fcd2..4da496621d1 100644 --- a/src/test/compile-fail/trait-bounds-sugar.rs +++ b/src/test/compile-fail/trait-bounds-sugar.rs @@ -16,14 +16,14 @@ trait Foo {} fn a(_x: Box<Foo+Send>) { } -fn b(_x: &'static Foo+'static) { +fn b(_x: &'static (Foo+'static)) { } fn c(x: Box<Foo+Sync>) { a(x); //~ ERROR mismatched types } -fn d(x: &'static Foo+Sync) { +fn d(x: &'static (Foo+Sync)) { b(x); //~ ERROR cannot infer //~^ ERROR mismatched types } diff --git a/src/test/compile-fail/unreachable-variant.rs b/src/test/compile-fail/unreachable-variant.rs index a6f17efe6b5..ef991d85337 100644 --- a/src/test/compile-fail/unreachable-variant.rs +++ b/src/test/compile-fail/unreachable-variant.rs @@ -13,5 +13,5 @@ extern crate "unreachable-variant" as other; fn main() { - let _x = other::super_sekrit::baz; //~ ERROR is private + let _x = other::super_sekrit::sooper_sekrit::baz; //~ ERROR is private } diff --git a/src/test/compile-fail/xc-private-method2.rs b/src/test/compile-fail/xc-private-method2.rs index 48b07a39eb8..26e055d7cbb 100644 --- a/src/test/compile-fail/xc-private-method2.rs +++ b/src/test/compile-fail/xc-private-method2.rs @@ -16,6 +16,6 @@ fn main() { let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); //~^ ERROR method `meth_struct` is private - let _ = xc_private_method_lib::Variant1(20).meth_enum(); + let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); //~^ ERROR method `meth_enum` is private } diff --git a/src/test/run-pass/colorful-write-macros.rs b/src/test/run-pass/colorful-write-macros.rs index 75b8e391331..bbb049eb960 100644 --- a/src/test/run-pass/colorful-write-macros.rs +++ b/src/test/run-pass/colorful-write-macros.rs @@ -18,7 +18,7 @@ use std::fmt; use std::fmt::FormatWriter; struct Foo<'a> { - writer: &'a mut Writer+'a, + writer: &'a mut (Writer+'a), other: &'a str, } diff --git a/src/test/run-pass/dst-index.rs b/src/test/run-pass/dst-index.rs index 266f9bcba5f..eaf7131e1d8 100644 --- a/src/test/run-pass/dst-index.rs +++ b/src/test/run-pass/dst-index.rs @@ -25,7 +25,7 @@ impl Index<uint, str> for S { struct T; impl Index<uint, Show + 'static> for T { - fn index<'a>(&'a self, idx: &uint) -> &'a Show + 'static { + fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) { static x: uint = 42; &x } diff --git a/src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs b/src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs new file mode 100644 index 00000000000..88e6de6d3e6 --- /dev/null +++ b/src/test/run-pass/hrtb-precedence-of-plus-where-clause.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unboxed_closures)] + +// Test that `F : Fn(int) -> int + Send` is interpreted as two +// distinct bounds on `F`. + +fn foo1<F>(f: F) + where F : FnOnce(int) -> int + Send +{ + bar(f); +} + +fn foo2<F>(f: F) + where F : FnOnce(int) -> int + Send +{ + baz(f); +} + +fn bar<F:Send>(f: F) { } + +fn baz<F:FnOnce(int) -> int>(f: F) { } + +fn main() {} diff --git a/src/test/run-pass/hrtb-precedence-of-plus.rs b/src/test/run-pass/hrtb-precedence-of-plus.rs new file mode 100644 index 00000000000..9a43b5b711e --- /dev/null +++ b/src/test/run-pass/hrtb-precedence-of-plus.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unboxed_closures)] + +// Test that `Fn(int) -> int + 'static` parses as `(Fn(int) -> int) + +// 'static` and not `Fn(int) -> (int + 'static)`. The latter would +// cause a compilation error. Issue #18772. + +fn adder(y: int) -> Box<Fn(int) -> int + 'static> { + box move |&: x| y + x +} + +fn main() {} diff --git a/src/test/run-pass/issue-10902.rs b/src/test/run-pass/issue-10902.rs index 84d71e1ef5d..324a1701b2f 100644 --- a/src/test/run-pass/issue-10902.rs +++ b/src/test/run-pass/issue-10902.rs @@ -10,7 +10,7 @@ pub mod two_tuple { pub trait T {} - pub struct P<'a>(&'a T + 'a, &'a T + 'a); + pub struct P<'a>(&'a (T + 'a), &'a (T + 'a)); pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { P(car, cdr) } @@ -18,7 +18,7 @@ pub mod two_tuple { pub mod two_fields { pub trait T {} - pub struct P<'a> { car: &'a T + 'a, cdr: &'a T + 'a } + pub struct P<'a> { car: &'a (T + 'a), cdr: &'a (T + 'a) } pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { P{ car: car, cdr: cdr } } diff --git a/src/test/run-pass/issue-11205.rs b/src/test/run-pass/issue-11205.rs index 89224e1fb12..ea138311f19 100644 --- a/src/test/run-pass/issue-11205.rs +++ b/src/test/run-pass/issue-11205.rs @@ -49,7 +49,7 @@ fn main() { foog(x, &[box 1i]); struct T<'a> { - t: [&'a Foo+'a, ..2] + t: [&'a (Foo+'a), ..2] } let _n = T { t: [&1i, &2i] @@ -64,7 +64,7 @@ fn main() { }; struct F<'b> { - t: &'b [&'b Foo+'b] + t: &'b [&'b (Foo+'b)] } let _n = F { t: &[&1i, &2i] diff --git a/src/test/run-pass/issue-14901.rs b/src/test/run-pass/issue-14901.rs index 647bbfbd65d..e41754fd1b9 100644 --- a/src/test/run-pass/issue-14901.rs +++ b/src/test/run-pass/issue-14901.rs @@ -11,7 +11,7 @@ use std::io::Reader; enum Wrapper<'a> { - WrapReader(&'a Reader + 'a) + WrapReader(&'a (Reader + 'a)) } trait Wrap<'a> { diff --git a/src/test/run-pass/issue-14958.rs b/src/test/run-pass/issue-14958.rs index 7f3321e0b3e..1ffd349a653 100644 --- a/src/test/run-pass/issue-14958.rs +++ b/src/test/run-pass/issue-14958.rs @@ -14,7 +14,7 @@ trait Foo {} struct Bar; -impl<'a> std::ops::Fn<(&'a Foo+'a,), ()> for Bar { +impl<'a> std::ops::Fn<(&'a (Foo+'a),), ()> for Bar { extern "rust-call" fn call(&self, _: (&'a Foo,)) {} } diff --git a/src/test/run-pass/issue-14959.rs b/src/test/run-pass/issue-14959.rs index 6cc5ab4d6cb..99472bb3610 100644 --- a/src/test/run-pass/issue-14959.rs +++ b/src/test/run-pass/issue-14959.rs @@ -33,8 +33,8 @@ impl Alloy { } } -impl<'a, 'b> Fn<(&'b mut Response+'b,),()> for SendFile<'a> { - extern "rust-call" fn call(&self, (_res,): (&'b mut Response+'b,)) {} +impl<'a, 'b> Fn<(&'b mut (Response+'b),),()> for SendFile<'a> { + extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {} } impl<Rq: Request, Rs: Response> Ingot<Rq, Rs> for HelloWorld { diff --git a/src/test/run-pass/issue-18619.rs b/src/test/run-pass/issue-18619.rs index 70ccc20e01a..a885513611d 100644 --- a/src/test/run-pass/issue-18619.rs +++ b/src/test/run-pass/issue-18619.rs @@ -11,5 +11,5 @@ use std::io::FileType; pub fn main() { - let _ = FileType::TypeFile.clone(); + let _ = FileType::RegularFile.clone(); } diff --git a/src/test/run-pass/issue-19244.rs b/src/test/run-pass/issue-19244.rs new file mode 100644 index 00000000000..fecddea13e0 --- /dev/null +++ b/src/test/run-pass/issue-19244.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(tuple_indexing)] + +struct MyStruct { field: uint } +const STRUCT: MyStruct = MyStruct { field: 42 }; +const TUP: (uint,) = (43,); + +fn main() { + let a = [0i, ..STRUCT.field]; + let b = [0i, ..TUP.0]; + + assert!(a.len() == 42); + assert!(b.len() == 43); +} diff --git a/src/test/run-pass/issue-19293.rs b/src/test/run-pass/issue-19293.rs new file mode 100644 index 00000000000..4a446a76de3 --- /dev/null +++ b/src/test/run-pass/issue-19293.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:issue_19293.rs +extern crate issue_19293; +use issue_19293::{Foo, MyEnum}; + +fn main() { + MyEnum::Foo(Foo(5)); +} diff --git a/src/test/run-pass/issue-2316-c.rs b/src/test/run-pass/issue-2316-c.rs index a27f0b8d659..a6fac423bb6 100644 --- a/src/test/run-pass/issue-2316-c.rs +++ b/src/test/run-pass/issue-2316-c.rs @@ -15,5 +15,5 @@ extern crate issue_2316_b; use issue_2316_b::cloth; pub fn main() { - let _c: cloth::fabric = cloth::calico; + let _c: cloth::fabric = cloth::fabric::calico; } diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 4f66139789b..ec19b95ab1a 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -13,7 +13,7 @@ extern crate collections; extern crate serialize; use std::collections::HashMap; -use serialize::json; +use serialize::json::{mod, Json}; use std::option; enum object { @@ -21,10 +21,10 @@ enum object { int_value(i64), } -fn lookup(table: json::JsonObject, key: String, default: String) -> String +fn lookup(table: json::Object, key: String, default: String) -> String { match table.find(&key.to_string()) { - option::Some(&json::String(ref s)) => { + option::Some(&Json::String(ref s)) => { s.to_string() } option::Some(value) => { @@ -40,7 +40,7 @@ fn lookup(table: json::JsonObject, key: String, default: String) -> String fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String, object) { match &data { - &json::Object(ref interface) => { + &Json::Object(ref interface) => { let name = lookup(interface.clone(), "ifDescr".to_string(), "".to_string()); @@ -59,7 +59,7 @@ fn add_interfaces(store: int, managed_ip: String, device: HashMap<String, json:: -> Vec<(String, object)> { match device["interfaces".to_string()] { - json::Array(ref interfaces) => + Json::Array(ref interfaces) => { interfaces.iter().map(|interface| { add_interface(store, managed_ip.clone(), (*interface).clone()) diff --git a/src/test/run-pass/issue-5708.rs b/src/test/run-pass/issue-5708.rs index 9c728005b6f..61ae273aef5 100644 --- a/src/test/run-pass/issue-5708.rs +++ b/src/test/run-pass/issue-5708.rs @@ -29,7 +29,7 @@ impl Inner for int { } struct Outer<'a> { - inner: &'a Inner+'a + inner: &'a (Inner+'a) } impl<'a> Outer<'a> { @@ -51,7 +51,7 @@ pub fn main() { pub trait MyTrait<T> { } pub struct MyContainer<'a, T> { - foos: Vec<&'a MyTrait<T>+'a> , + foos: Vec<&'a (MyTrait<T>+'a)> , } impl<'a, T> MyContainer<'a, T> { diff --git a/src/test/run-pass/issue-8249.rs b/src/test/run-pass/issue-8249.rs index dae5db11b0a..44f07def531 100644 --- a/src/test/run-pass/issue-8249.rs +++ b/src/test/run-pass/issue-8249.rs @@ -13,7 +13,7 @@ struct B; impl A for B {} struct C<'a> { - foo: &'a mut A+'a, + foo: &'a mut (A+'a), } fn foo(a: &mut A) { diff --git a/src/test/run-pass/issue-8259.rs b/src/test/run-pass/issue-8259.rs index 4805b7713ee..fb893873bc4 100644 --- a/src/test/run-pass/issue-8259.rs +++ b/src/test/run-pass/issue-8259.rs @@ -11,6 +11,6 @@ // aux-build:issue-8259.rs extern crate "issue-8259" as other; -static a: other::Foo<'static> = other::A; +static a: other::Foo<'static> = other::Foo::A; pub fn main() {} diff --git a/src/test/run-pass/issue-9719.rs b/src/test/run-pass/issue-9719.rs index ebb9b20ec25..4c6b9a3aaa0 100644 --- a/src/test/run-pass/issue-9719.rs +++ b/src/test/run-pass/issue-9719.rs @@ -16,7 +16,7 @@ mod a { pub trait X {} impl X for int {} - pub struct Z<'a>(Enum<&'a X+'a>); + pub struct Z<'a>(Enum<&'a (X+'a)>); fn foo() { let x = 42i; let z = Z(Enum::A(&x as &X)); let _ = z; } } @@ -24,7 +24,7 @@ mod b { trait X {} impl X for int {} struct Y<'a>{ - x:Option<&'a X+'a>, + x:Option<&'a (X+'a)>, } fn bar() { @@ -36,7 +36,7 @@ mod b { mod c { pub trait X { fn f(&self); } impl X for int { fn f(&self) {} } - pub struct Z<'a>(Option<&'a X+'a>); + pub struct Z<'a>(Option<&'a (X+'a)>); fn main() { let x = 42i; let z = Z(Some(&x as &X)); let _ = z; } } diff --git a/src/test/run-pass/parameterized-trait-with-bounds.rs b/src/test/run-pass/parameterized-trait-with-bounds.rs index 339c9e3c490..840e58848a7 100644 --- a/src/test/run-pass/parameterized-trait-with-bounds.rs +++ b/src/test/run-pass/parameterized-trait-with-bounds.rs @@ -19,7 +19,7 @@ mod foo { pub trait D<'a, T> {} } -fn foo1<T>(_: &A<T> + Send) {} +fn foo1<T>(_: &(A<T> + Send)) {} fn foo2<T>(_: Box<A<T> + Send + Sync>) {} fn foo3<T>(_: Box<B<int, uint> + 'static>) {} fn foo4<'a, T>(_: Box<C<'a, T> + 'static + Send>) {} diff --git a/src/test/run-pass/regions-early-bound-trait-param.rs b/src/test/run-pass/regions-early-bound-trait-param.rs index faf371e8826..907f610ff25 100644 --- a/src/test/run-pass/regions-early-bound-trait-param.rs +++ b/src/test/run-pass/regions-early-bound-trait-param.rs @@ -30,7 +30,7 @@ fn object_invoke1<'d>(x: &'d Trait<'d>) -> (int, int) { } struct Struct1<'e> { - f: &'e Trait<'e>+'e + f: &'e (Trait<'e>+'e) } fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (int,int) { @@ -40,7 +40,7 @@ fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (int,int) { } struct Struct2<'h, 'i> { - f: &'h Trait<'i>+'h + f: &'h (Trait<'i>+'h) } fn object_invoke2<'j, 'k>(x: &'k Trait<'j>) -> int { diff --git a/src/test/run-pass/struct_variant_xc.rs b/src/test/run-pass/struct_variant_xc.rs index 11521e86117..923a1427869 100644 --- a/src/test/run-pass/struct_variant_xc.rs +++ b/src/test/run-pass/struct_variant_xc.rs @@ -11,7 +11,7 @@ // aux-build:struct_variant_xc_aux.rs extern crate struct_variant_xc_aux; -use struct_variant_xc_aux::StructVariant; +use struct_variant_xc_aux::Enum::StructVariant; pub fn main() { let _ = StructVariant { arg: 1 }; diff --git a/src/test/run-pass/struct_variant_xc_match.rs b/src/test/run-pass/struct_variant_xc_match.rs index e7bc61c1fb9..41dcb7ddbc8 100644 --- a/src/test/run-pass/struct_variant_xc_match.rs +++ b/src/test/run-pass/struct_variant_xc_match.rs @@ -11,7 +11,7 @@ // aux-build:struct_variant_xc_aux.rs extern crate struct_variant_xc_aux; -use struct_variant_xc_aux::{StructVariant, Variant}; +use struct_variant_xc_aux::Enum::{StructVariant, Variant}; pub fn main() { let arg = match (StructVariant { arg: 42 }) { diff --git a/src/test/run-pass/xcrate-unit-struct.rs b/src/test/run-pass/xcrate-unit-struct.rs index 7eb73968db5..30b5f47b2ae 100644 --- a/src/test/run-pass/xcrate-unit-struct.rs +++ b/src/test/run-pass/xcrate-unit-struct.rs @@ -12,10 +12,10 @@ extern crate xcrate_unit_struct; const s1: xcrate_unit_struct::Struct = xcrate_unit_struct::Struct; -static s2: xcrate_unit_struct::Unit = xcrate_unit_struct::UnitVariant; +static s2: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit::UnitVariant; static s3: xcrate_unit_struct::Unit = - xcrate_unit_struct::Argument(xcrate_unit_struct::Struct); -static s4: xcrate_unit_struct::Unit = xcrate_unit_struct::Argument(s1); + xcrate_unit_struct::Unit::Argument(xcrate_unit_struct::Struct); +static s4: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit::Argument(s1); static s5: xcrate_unit_struct::TupleStruct = xcrate_unit_struct::TupleStruct(20, "foo"); fn f1(_: xcrate_unit_struct::Struct) {} @@ -24,8 +24,8 @@ fn f3(_: xcrate_unit_struct::TupleStruct) {} pub fn main() { f1(xcrate_unit_struct::Struct); - f2(xcrate_unit_struct::UnitVariant); - f2(xcrate_unit_struct::Argument(xcrate_unit_struct::Struct)); + f2(xcrate_unit_struct::Unit::UnitVariant); + f2(xcrate_unit_struct::Unit::Argument(xcrate_unit_struct::Struct)); f3(xcrate_unit_struct::TupleStruct(10, "bar")); f1(s1); |
