diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/empty-extern-arg.rs | 14 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-17651.rs | 17 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-17718-const-naming.rs | 1 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-dead-code-1.rs | 13 | ||||
| -rw-r--r-- | src/test/run-pass/lang-item-public.rs | 4 |
5 files changed, 48 insertions, 1 deletions
diff --git a/src/test/compile-fail/empty-extern-arg.rs b/src/test/compile-fail/empty-extern-arg.rs new file mode 100644 index 00000000000..9b7df81a5dc --- /dev/null +++ b/src/test/compile-fail/empty-extern-arg.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. + +// compile-flags: --extern std= +// error-pattern: is not a file + +fn main() {} diff --git a/src/test/compile-fail/issue-17651.rs b/src/test/compile-fail/issue-17651.rs new file mode 100644 index 00000000000..ef8174a26aa --- /dev/null +++ b/src/test/compile-fail/issue-17651.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. + +// Test that moves of unsized values within closures are caught +// and rejected. + +fn main() { + (|| box *[0u].as_slice())(); + //~^ ERROR cannot move a value of type [uint] +} diff --git a/src/test/compile-fail/issue-17718-const-naming.rs b/src/test/compile-fail/issue-17718-const-naming.rs index 046f038847b..0cfee6daf3f 100644 --- a/src/test/compile-fail/issue-17718-const-naming.rs +++ b/src/test/compile-fail/issue-17718-const-naming.rs @@ -12,5 +12,6 @@ const foo: int = 3; //~^ ERROR: should have an uppercase name such as +//~^^ ERROR: constant item is never used fn main() {} diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs index a4320b8dc77..96d40c52657 100644 --- a/src/test/compile-fail/lint-dead-code-1.rs +++ b/src/test/compile-fail/lint-dead-code-1.rs @@ -35,6 +35,13 @@ pub static used_static2: int = used_static; const USED_STATIC: int = 0; const STATIC_USED_IN_ENUM_DISCRIMINANT: int = 10; +pub const pub_const: int = 0; +const priv_const: int = 0; //~ ERROR: constant item is never used +const used_const: int = 0; +pub const used_const2: int = used_const; +const USED_CONST: int = 1; +const CONST_USED_IN_ENUM_DISCRIMINANT: int = 11; + pub type typ = *const UsedStruct4; pub struct PubStruct; struct PrivStruct; //~ ERROR: struct is never used @@ -61,7 +68,10 @@ pub struct PubStruct2 { pub enum pub_enum { foo1, bar1 } pub enum pub_enum2 { a(*const StructUsedInEnum) } -pub enum pub_enum3 { Foo = STATIC_USED_IN_ENUM_DISCRIMINANT } +pub enum pub_enum3 { + Foo = STATIC_USED_IN_ENUM_DISCRIMINANT, + Bar = CONST_USED_IN_ENUM_DISCRIMINANT, +} enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used enum used_enum { @@ -82,6 +92,7 @@ pub fn pub_fn() { let i = 1i; match i { USED_STATIC => (), + USED_CONST => (), _ => () } f::<StructUsedInGeneric>(); diff --git a/src/test/run-pass/lang-item-public.rs b/src/test/run-pass/lang-item-public.rs index abd5f8326b0..982d4f6a0b5 100644 --- a/src/test/run-pass/lang-item-public.rs +++ b/src/test/run-pass/lang-item-public.rs @@ -28,6 +28,10 @@ extern {} #[link(name = "execinfo")] extern {} +#[cfg(target_os = "freebsd")] +#[link(name = "c")] +extern {} + #[cfg(target_os = "dragonfly")] #[link(name = "c")] extern {} |
