diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-17 15:19:51 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-17 15:19:51 +0530 |
| commit | a4b57bebd0de3172dd0057bbd600f69e95295c35 (patch) | |
| tree | 0e3cd1d66f52a096b68faeaf218db34559705eba /src/test | |
| parent | 74adeda78a807d4e7e3598fa0b3dd5470bb89fc2 (diff) | |
| parent | c1f6951826c4f99d570aaf9bba321e1bfde0c0de (diff) | |
| download | rust-a4b57bebd0de3172dd0057bbd600f69e95295c35.tar.gz rust-a4b57bebd0de3172dd0057bbd600f69e95295c35.zip | |
Rollup merge of #23402 - tamird:needstest-tests, r=jakub-
@alexcrichton @jakub-
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/auxiliary/pub_static_array.rs | 11 | ||||
| -rw-r--r-- | src/test/compile-fail/associated-types-eq-expr-path.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/integral-indexing.rs | 8 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-13407.rs | 19 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-16922.rs | 20 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-18919.rs | 17 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-19982.rs | 17 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-20225.rs | 22 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-20261.rs | 17 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-20714.rs | 15 | ||||
| -rw-r--r-- | src/test/compile-fail/static-array-across-crate.rs | 20 | ||||
| -rw-r--r-- | src/test/compile-fail/trait-bounds-not-on-bare-trait.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-11820.rs | 19 | ||||
| -rw-r--r-- | src/test/run-pass/issue-16922.rs | 18 | ||||
| -rw-r--r-- | src/test/run-pass/issue-19982.rs | 22 | ||||
| -rw-r--r-- | src/test/run-pass/issue-20396.rs | 23 | ||||
| -rw-r--r-- | src/test/run-pass/issue-9951.rs | 28 |
17 files changed, 274 insertions, 6 deletions
diff --git a/src/test/auxiliary/pub_static_array.rs b/src/test/auxiliary/pub_static_array.rs new file mode 100644 index 00000000000..4419a5ae83c --- /dev/null +++ b/src/test/auxiliary/pub_static_array.rs @@ -0,0 +1,11 @@ +// 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 static ARRAY: &'static [u8] = &[1]; diff --git a/src/test/compile-fail/associated-types-eq-expr-path.rs b/src/test/compile-fail/associated-types-eq-expr-path.rs index c48f9972ebc..0d68b960f31 100644 --- a/src/test/compile-fail/associated-types-eq-expr-path.rs +++ b/src/test/compile-fail/associated-types-eq-expr-path.rs @@ -22,5 +22,5 @@ impl Foo for isize { pub fn main() { let x: isize = Foo::<A=usize>::bar(); - //~^ERROR unexpected binding of associated item in expression path + //~^ ERROR unexpected binding of associated item in expression path } diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs index e8998dd7a9d..e2fb0fa4f2f 100644 --- a/src/test/compile-fail/integral-indexing.rs +++ b/src/test/compile-fail/integral-indexing.rs @@ -24,11 +24,11 @@ pub fn main() { s.as_bytes()[3_usize]; s.as_bytes()[3]; s.as_bytes()[3u8]; //~ERROR the trait `core::ops::Index<u8>` is not implemented - //~^ERROR the trait `core::ops::Index<u8>` is not implemented + //~^ ERROR the trait `core::ops::Index<u8>` is not implemented s.as_bytes()[3i8]; //~ERROR the trait `core::ops::Index<i8>` is not implemented - //~^ERROR the trait `core::ops::Index<i8>` is not implemented + //~^ ERROR the trait `core::ops::Index<i8>` is not implemented s.as_bytes()[3u32]; //~ERROR the trait `core::ops::Index<u32>` is not implemented - //~^ERROR the trait `core::ops::Index<u32>` is not implemented + //~^ ERROR the trait `core::ops::Index<u32>` is not implemented s.as_bytes()[3i32]; //~ERROR the trait `core::ops::Index<i32>` is not implemented - //~^ERROR the trait `core::ops::Index<i32>` is not implemented + //~^ ERROR the trait `core::ops::Index<i32>` is not implemented } diff --git a/src/test/compile-fail/issue-13407.rs b/src/test/compile-fail/issue-13407.rs new file mode 100644 index 00000000000..f845eba4060 --- /dev/null +++ b/src/test/compile-fail/issue-13407.rs @@ -0,0 +1,19 @@ +// Copyright 2015 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. + +mod A { + struct C; +} + +fn main() { + A::C = 1; + //~^ ERROR: illegal left-hand side expression + //~| ERROR: mismatched types +} diff --git a/src/test/compile-fail/issue-16922.rs b/src/test/compile-fail/issue-16922.rs new file mode 100644 index 00000000000..b525d5f64fc --- /dev/null +++ b/src/test/compile-fail/issue-16922.rs @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +use std::any::Any; + +fn foo<T: Any>(value: &T) -> Box<Any> { + Box::new(value) as Box<Any> + //~^ ERROR: cannot infer an appropriate lifetime +} + +fn main() { + let _ = foo(&5); +} diff --git a/src/test/compile-fail/issue-18919.rs b/src/test/compile-fail/issue-18919.rs new file mode 100644 index 00000000000..8c2c52e6fad --- /dev/null +++ b/src/test/compile-fail/issue-18919.rs @@ -0,0 +1,17 @@ +// Copyright 2015 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. + +type FuncType<'f> = Fn(&isize) -> isize + 'f; + +fn ho_func(f: Option<FuncType>) { + //~^ ERROR: the trait `core::marker::Sized` is not implemented for the type +} + +fn main() {} diff --git a/src/test/compile-fail/issue-19982.rs b/src/test/compile-fail/issue-19982.rs new file mode 100644 index 00000000000..9dbca997341 --- /dev/null +++ b/src/test/compile-fail/issue-19982.rs @@ -0,0 +1,17 @@ +// Copyright 2015 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)] + +struct Foo; + +impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier + +fn main() {} diff --git a/src/test/compile-fail/issue-20225.rs b/src/test/compile-fail/issue-20225.rs new file mode 100644 index 00000000000..e4bedbbb7e1 --- /dev/null +++ b/src/test/compile-fail/issue-20225.rs @@ -0,0 +1,22 @@ +// Copyright 2015 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)] + +struct Foo; + +impl<'a, T> Fn<(&'a T,)> for Foo { + type Output = (); + + extern "rust-call" fn call(&self, (_,): (T,)) {} + //~^ ERROR: has an incompatible type for trait: expected &-ptr +} + +fn main() {} diff --git a/src/test/compile-fail/issue-20261.rs b/src/test/compile-fail/issue-20261.rs new file mode 100644 index 00000000000..33e00f9a823 --- /dev/null +++ b/src/test/compile-fail/issue-20261.rs @@ -0,0 +1,17 @@ +// Copyright 2015 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. + +fn main() { + for (ref i,) in [].iter() { //~ ERROR: type mismatch resolving + i.clone(); + //~^ ERROR: the type of this value must be known in this context + //~| ERROR: reached the recursion limit while auto-dereferencing + } +} diff --git a/src/test/compile-fail/issue-20714.rs b/src/test/compile-fail/issue-20714.rs new file mode 100644 index 00000000000..cb322f00723 --- /dev/null +++ b/src/test/compile-fail/issue-20714.rs @@ -0,0 +1,15 @@ +// Copyright 2015 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 G; + +fn main() { + let g = G(); //~ ERROR: expected function, found `G` +} diff --git a/src/test/compile-fail/static-array-across-crate.rs b/src/test/compile-fail/static-array-across-crate.rs new file mode 100644 index 00000000000..422cf630429 --- /dev/null +++ b/src/test/compile-fail/static-array-across-crate.rs @@ -0,0 +1,20 @@ +// Copyright 2015 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:pub_static_array.rs + +extern crate "pub_static_array" as array; + +use array::ARRAY; + +static X: &'static u8 = &ARRAY[0]; +//~^ ERROR: cannot refer to the interior of another static, use a constant + +pub fn main() {} diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index 448b186f6a5..e126a3040e9 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -15,7 +15,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ERROR the trait `core::marker::Sized` is not implemented + //~^ ERROR the trait `core::marker::Sized` is not implemented } fn main() { } diff --git a/src/test/run-pass/issue-11820.rs b/src/test/run-pass/issue-11820.rs new file mode 100644 index 00000000000..f7aaf495377 --- /dev/null +++ b/src/test/run-pass/issue-11820.rs @@ -0,0 +1,19 @@ +// Copyright 2015 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 NoClone; + +fn main() { + let rnc = &NoClone; + let rsnc = &Some(NoClone); + + let _: &NoClone = rnc.clone(); + let _: &Option<NoClone> = rsnc.clone(); +} diff --git a/src/test/run-pass/issue-16922.rs b/src/test/run-pass/issue-16922.rs new file mode 100644 index 00000000000..25909bcbfe9 --- /dev/null +++ b/src/test/run-pass/issue-16922.rs @@ -0,0 +1,18 @@ +// Copyright 2015 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. + +use std::any::Any; + +fn foo(_: &u8) { +} + +fn main() { + let _ = &foo as &Any; +} diff --git a/src/test/run-pass/issue-19982.rs b/src/test/run-pass/issue-19982.rs new file mode 100644 index 00000000000..3082fc27a7d --- /dev/null +++ b/src/test/run-pass/issue-19982.rs @@ -0,0 +1,22 @@ +// Copyright 2015 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(core,unboxed_closures)] + +#[allow(dead_code)] +struct Foo; + +impl<'a> Fn<(&'a (),)> for Foo { + type Output = (); + + extern "rust-call" fn call(&self, (_,): (&(),)) {} +} + +fn main() {} diff --git a/src/test/run-pass/issue-20396.rs b/src/test/run-pass/issue-20396.rs new file mode 100644 index 00000000000..63a88988162 --- /dev/null +++ b/src/test/run-pass/issue-20396.rs @@ -0,0 +1,23 @@ +// Copyright 2015 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. + +#![allow(dead_code)] + +trait Foo<T> { + fn noop(&self, _: T); +} + +enum Bar<T> { Bla(T) } + +struct Baz<'a> { + inner: for<'b> Foo<Bar<&'b ()>> + 'a, +} + +fn main() {} diff --git a/src/test/run-pass/issue-9951.rs b/src/test/run-pass/issue-9951.rs new file mode 100644 index 00000000000..210f647e5be --- /dev/null +++ b/src/test/run-pass/issue-9951.rs @@ -0,0 +1,28 @@ +// Copyright 2015 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. + +#![allow(unused_variables)] + +trait Bar { + fn noop(&self); +} +impl Bar for u8 { + fn noop(&self) {} +} + +fn main() { + let (a, b) = (&5u8 as &Bar, &9u8 as &Bar); + let (c, d): (&Bar, &Bar) = (a, b); + + let (a, b) = (Box::new(5u8) as Box<Bar>, Box::new(9u8) as Box<Bar>); + let (c, d): (&Bar, &Bar) = (&*a, &*b); + + let (c, d): (&Bar, &Bar) = (&5, &9); +} |
