diff --git a/src/test/auxiliary/pub_static_array.rs b/src/test/auxiliary/pub_static_array.rs new file mode 100644 index 0000000000000..4419a5ae83cfa --- /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 or the MIT license +// , 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 c48f9972ebc18..0d68b960f3135 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::::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 e8998dd7a9d48..e2fb0fa4f2fa5 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` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3i8]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3u32]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` is not implemented s.as_bytes()[3i32]; //~ERROR the trait `core::ops::Index` is not implemented - //~^ERROR the trait `core::ops::Index` is not implemented + //~^ ERROR the trait `core::ops::Index` 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 0000000000000..f845eba406041 --- /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 or the MIT license +// , 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 0000000000000..b525d5f64fc9a --- /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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::any::Any; + +fn foo(value: &T) -> Box { + Box::new(value) as Box + //~^ 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 0000000000000..8c2c52e6fad41 --- /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 or the MIT license +// , 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) { + //~^ 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 0000000000000..9dbca997341fc --- /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 or the MIT license +// , 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 0000000000000..e4bedbbb7e1e5 --- /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 or the MIT license +// , 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 0000000000000..33e00f9a823ca --- /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 or the MIT license +// , 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 0000000000000..cb322f00723d2 --- /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 or the MIT license +// , 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 0000000000000..422cf630429ca --- /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 or the MIT license +// , 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 448b186f6a5c6..e126a3040e992 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 0000000000000..f7aaf4953774a --- /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 or the MIT license +// , 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 = 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 0000000000000..25909bcbfe9a8 --- /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 or the MIT license +// , 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 0000000000000..3082fc27a7dec --- /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 or the MIT license +// , 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 0000000000000..63a88988162a4 --- /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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(dead_code)] + +trait Foo { + fn noop(&self, _: T); +} + +enum Bar { Bla(T) } + +struct Baz<'a> { + inner: for<'b> Foo> + '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 0000000000000..210f647e5be2f --- /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 or the MIT license +// , 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, Box::new(9u8) as Box); + let (c, d): (&Bar, &Bar) = (&*a, &*b); + + let (c, d): (&Bar, &Bar) = (&5, &9); +}