diff options
Diffstat (limited to 'src/test')
29 files changed, 97 insertions, 260 deletions
diff --git a/src/test/compile-fail/ambig_impl_2_exe.rs b/src/test/compile-fail/ambig_impl_2_exe.rs index 664a1684505..13cceaa71ae 100644 --- a/src/test/compile-fail/ambig_impl_2_exe.rs +++ b/src/test/compile-fail/ambig_impl_2_exe.rs @@ -11,9 +11,9 @@ // aux-build:ambig_impl_2_lib.rs extern crate ambig_impl_2_lib; use ambig_impl_2_lib::me; -trait me { +trait me2 { fn me(&self) -> uint; } -impl me for uint { fn me(&self) -> uint { *self } } //~ NOTE is `uint.me::me` +impl me2 for uint { fn me(&self) -> uint { *self } } //~ NOTE is `uint.me2::me` fn main() { 1u.me(); } //~ ERROR multiple applicable methods in scope //~^ NOTE is `ambig_impl_2_lib::uint.me::me` diff --git a/src/test/compile-fail/issue-7663.rs b/src/test/compile-fail/issue-7663.rs deleted file mode 100644 index baea483ad98..00000000000 --- a/src/test/compile-fail/issue-7663.rs +++ /dev/null @@ -1,56 +0,0 @@ -// 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(globs)] -#![deny(unused_imports)] -#![allow(dead_code)] - -mod test1 { - - mod foo { pub fn p() -> int { 1 } } - mod bar { pub fn p() -> int { 2 } } - - pub mod baz { - use test1::foo::*; //~ ERROR: unused import - use test1::bar::*; - - pub fn my_main() { assert!(p() == 2); } - } -} - -mod test2 { - - mod foo { pub fn p() -> int { 1 } } - mod bar { pub fn p() -> int { 2 } } - - pub mod baz { - use test2::foo::p; //~ ERROR: unused import - use test2::bar::p; - - pub fn my_main() { assert!(p() == 2); } - } -} - -mod test3 { - - mod foo { pub fn p() -> int { 1 } } - mod bar { pub fn p() -> int { 2 } } - - pub mod baz { - use test3::foo::*; //~ ERROR: unused import - use test3::bar::p; - - pub fn my_main() { assert!(p() == 2); } - } -} - -fn main() { -} - diff --git a/src/test/compile-fail/issue-9957.rs b/src/test/compile-fail/issue-9957.rs index 3c6a1a7b275..a90a1ac1a75 100644 --- a/src/test/compile-fail/issue-9957.rs +++ b/src/test/compile-fail/issue-9957.rs @@ -8,13 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub extern crate std; //~ ERROR: `pub` visibility is not allowed -extern crate std; - -pub use std::bool; -use std::bool; +pub extern crate core; //~ ERROR: `pub` visibility is not allowed fn main() { pub use std::bool; //~ ERROR: imports in functions are never reachable - use std::bool; } diff --git a/src/test/compile-fail/lint-unused-import-tricky-globs.rs b/src/test/compile-fail/lint-unused-import-tricky-globs.rs deleted file mode 100644 index 62ea337656d..00000000000 --- a/src/test/compile-fail/lint-unused-import-tricky-globs.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2013 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(globs)] -#![deny(unused_imports)] -#![allow(dead_code)] - -mod A { - pub fn p() {} -} -mod B { - pub fn p() {} -} - -mod C { - pub fn q() {} -} -mod D { - pub fn q() {} -} - -mod E { - pub fn r() {} -} -mod F { - pub fn r() {} -} - -mod G { - pub fn s() {} - pub fn t() {} -} -mod H { - pub fn s() {} -} - -mod I { - pub fn u() {} - pub fn v() {} -} -mod J { - pub fn u() {} - pub fn v() {} -} - -mod K { - pub fn w() {} -} -mod L { - pub fn w() {} -} - -mod m { - use A::p; //~ ERROR: unused import - use B::p; - use C::q; //~ ERROR: unused import - use D::*; - use E::*; //~ ERROR: unused import - use F::r; - use G::*; - use H::*; - use I::*; - use J::v; - use K::*; //~ ERROR: unused import - use L::*; - - #[main] - fn my_main() { - p(); - q(); - r(); - s(); - t(); - u(); - v(); - w(); - } -} - diff --git a/src/test/compile-fail/lint-unused-import-tricky-names.rs b/src/test/compile-fail/lint-unused-import-tricky-names.rs deleted file mode 100644 index 39e344da115..00000000000 --- a/src/test/compile-fail/lint-unused-import-tricky-names.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2013 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. - -#![deny(unused_imports)] -#![allow(non_camel_case_types)] -#![allow(dead_code)] - -// Regression test for issue #6633 -mod issue6633 { - use self::foo::name::name; //~ ERROR: unused import - use self::foo::name; - - pub mod foo { - pub mod name { - pub type a = int; - pub mod name { - pub type a = f64; - } - } - } - - fn bar() -> name::a { 1 } -} - -// Regression test for issue #6935 -mod issue6935 { - use self::a::foo::a::foo; - use self::a::foo; //~ ERROR: unused import - - pub mod a { - pub mod foo { - pub mod a { - pub fn foo() {} - } - } - } - - fn bar() { foo(); } -} - -fn main(){} diff --git a/src/test/compile-fail/privacy-ns2.rs b/src/test/compile-fail/privacy-ns2.rs index 5ce0fb7e56a..769bdae80f1 100644 --- a/src/test/compile-fail/privacy-ns2.rs +++ b/src/test/compile-fail/privacy-ns2.rs @@ -70,7 +70,6 @@ pub mod foo3 { fn test_unused3() { use foo3::Bar; //~ ERROR `Bar` is private - use foo3::{Bar,Baz}; //~ ERROR `Bar` is private } fn test_single3() { diff --git a/src/test/compile-fail/privacy1.rs b/src/test/compile-fail/privacy1.rs index e52a4da1352..c30261b9d3b 100644 --- a/src/test/compile-fail/privacy1.rs +++ b/src/test/compile-fail/privacy1.rs @@ -171,7 +171,6 @@ pub mod mytest { // Even though the inner `A` struct is a publicly exported item (usable from // external crates through `foo::foo`, it should not be accessible through // its definition path (which has the private `i` module). - use self::foo::foo; use self::foo::i::A; //~ ERROR: type `A` is inaccessible //~^ NOTE: module `i` is private diff --git a/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs new file mode 100644 index 00000000000..8673d95de1b --- /dev/null +++ b/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs @@ -0,0 +1,15 @@ +// 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. + +extern crate std; +//~^ ERROR an external crate named `std` has already been imported + +fn main(){} + diff --git a/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs new file mode 100644 index 00000000000..dcd6ee6e957 --- /dev/null +++ b/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs @@ -0,0 +1,15 @@ +// 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. + +use std = std::slice; //~ ERROR import conflicts with imported crate + +fn main() { +} + diff --git a/src/test/compile-fail/resolve-conflict-import-vs-import.rs b/src/test/compile-fail/resolve-conflict-import-vs-import.rs new file mode 100644 index 00000000000..beb4b74f326 --- /dev/null +++ b/src/test/compile-fail/resolve-conflict-import-vs-import.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. + +use std::mem::transmute; +use std::mem::transmute; +//~^ ERROR a value named `transmute` has already been imported + +fn main() { +} + diff --git a/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs b/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs new file mode 100644 index 00000000000..9d40196d4ac --- /dev/null +++ b/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs @@ -0,0 +1,15 @@ +// 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. + +fn std() {} //~ ERROR the name `std` conflicts with an external crate + +fn main() { +} + diff --git a/src/test/compile-fail/resolve-conflict-item-vs-import.rs b/src/test/compile-fail/resolve-conflict-item-vs-import.rs new file mode 100644 index 00000000000..3834007f5ff --- /dev/null +++ b/src/test/compile-fail/resolve-conflict-item-vs-import.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. + +use std::mem::transmute; +//~^ ERROR import conflicts with value in this module + +fn transmute() {} + +fn main() { +} + diff --git a/src/test/compile-fail/resolve-priv-shadowing-pub.rs b/src/test/compile-fail/resolve-priv-shadowing-pub.rs deleted file mode 100644 index 0830722f969..00000000000 --- a/src/test/compile-fail/resolve-priv-shadowing-pub.rs +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -mod a { - pub fn foobar() -> int { 1 } -} - -mod b { - pub fn foobar() -> int { 2 } -} - -mod c { - // Technically the second use shadows the first, but in theory it should - // only be shadowed for this module. The implementation of resolve currently - // doesn't implement this, so this test is ensuring that using "c::foobar" - // is *not* getting b::foobar. Today it's an error, but perhaps one day it - // can correctly get a::foobar instead. - pub use a::foobar; - use b::foobar; -} - -fn main() { - assert_eq!(c::foobar(), 1); - //~^ ERROR: unresolved name `c::foobar` -} - diff --git a/src/test/compile-fail/unused-attr.rs b/src/test/compile-fail/unused-attr.rs index 3e1e08c7b58..0a5a9db8fa8 100644 --- a/src/test/compile-fail/unused-attr.rs +++ b/src/test/compile-fail/unused-attr.rs @@ -13,7 +13,7 @@ #![foo] //~ ERROR unused attribute #[foo] //~ ERROR unused attribute -extern crate std; +extern crate core; #[foo] //~ ERROR unused attribute use std::collections; diff --git a/src/test/compile-fail/use-mod-3.rs b/src/test/compile-fail/use-mod-3.rs index 0263dc392f1..b6b86a9993d 100644 --- a/src/test/compile-fail/use-mod-3.rs +++ b/src/test/compile-fail/use-mod-3.rs @@ -12,9 +12,8 @@ use foo::bar::{ mod //~ ERROR module `bar` is private }; use foo::bar::{ - Bar, //~ ERROR type `Bar` is inaccessible + Bar //~ ERROR type `Bar` is inaccessible //~^ NOTE module `bar` is private - mod //~ ERROR module `bar` is private }; mod foo { diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index a9f57a48f44..e1ad27ec5c7 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -4,6 +4,7 @@ #[phase(plugin, link)] extern crate std = "std"; extern crate rt = "native"; +#[prelude_import] use std::prelude::*; // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at diff --git a/src/test/run-fail/glob-use-std.rs b/src/test/run-fail/glob-use-std.rs index fffe146f7f4..bee60cd1205 100644 --- a/src/test/run-fail/glob-use-std.rs +++ b/src/test/run-fail/glob-use-std.rs @@ -10,6 +10,10 @@ // Issue #7580 +// ignore-pretty +// +// Expanded pretty printing causes resolve conflicts. + // error-pattern:fail works #![feature(globs)] diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs index 9cee83a8598..c7a02a419c0 100644 --- a/src/test/run-pass/core-run-destroy.rs +++ b/src/test/run-pass/core-run-destroy.rs @@ -41,7 +41,7 @@ macro_rules! iotest ( use std::str; use std::io::process::Command; use native; - use super::*; + use super::{sleeper, test_destroy_actually_kills}; fn f() $b diff --git a/src/test/run-pass/extern-mod-ordering-exe.rs b/src/test/run-pass/extern-mod-ordering-exe.rs index 7e9e6073252..56c29b54b68 100644 --- a/src/test/run-pass/extern-mod-ordering-exe.rs +++ b/src/test/run-pass/extern-mod-ordering-exe.rs @@ -12,8 +12,8 @@ extern crate extern_mod_ordering_lib; -use extern_mod_ordering_lib::extern_mod_ordering_lib; +use the_lib = extern_mod_ordering_lib::extern_mod_ordering_lib; pub fn main() { - extern_mod_ordering_lib::f(); + the_lib::f(); } diff --git a/src/test/run-pass/issue-11736.rs b/src/test/run-pass/issue-11736.rs index 10d6e0158f6..cdd3252df4b 100644 --- a/src/test/run-pass/issue-11736.rs +++ b/src/test/run-pass/issue-11736.rs @@ -9,7 +9,6 @@ // except according to those terms. extern crate collections; -extern crate std; use std::collections::Bitv; diff --git a/src/test/run-pass/issue-12612.rs b/src/test/run-pass/issue-12612.rs index fcb658036b6..3e8ac2f2783 100644 --- a/src/test/run-pass/issue-12612.rs +++ b/src/test/run-pass/issue-12612.rs @@ -14,8 +14,6 @@ extern crate foo = "issue-12612-1"; extern crate bar = "issue-12612-2"; -use foo::bar; - mod test { use bar::baz; } diff --git a/src/test/run-pass/issue-14082.rs b/src/test/run-pass/issue-14082.rs index b8683c86164..9aff6b91748 100644 --- a/src/test/run-pass/issue-14082.rs +++ b/src/test/run-pass/issue-14082.rs @@ -14,7 +14,6 @@ use foo::GC; mod foo { - use d::*; pub use m::GC; // this should shadow d::GC } diff --git a/src/test/run-pass/issue-14330.rs b/src/test/run-pass/issue-14330.rs index a7f2ebf9e11..26b282b7180 100644 --- a/src/test/run-pass/issue-14330.rs +++ b/src/test/run-pass/issue-14330.rs @@ -10,6 +10,6 @@ #![feature(phase)] -#[phase(plugin, link)] extern crate std; +#[phase(plugin, link)] extern crate std2 = "std"; fn main() {} diff --git a/src/test/run-pass/issue-5521.rs b/src/test/run-pass/issue-5521.rs index 760ac5c9383..150bd9a74a9 100644 --- a/src/test/run-pass/issue-5521.rs +++ b/src/test/run-pass/issue-5521.rs @@ -13,7 +13,7 @@ extern crate foo = "issue-5521"; -fn foo(a: foo::map) { +fn bar(a: foo::map) { if false { fail!(); } else { diff --git a/src/test/run-pass/issue-7663.rs b/src/test/run-pass/issue-7663.rs index baf37e31417..ee500b3d4fa 100644 --- a/src/test/run-pass/issue-7663.rs +++ b/src/test/run-pass/issue-7663.rs @@ -30,7 +30,6 @@ mod test2 { mod bar { pub fn p() -> int { 2 } } pub mod baz { - use test2::foo::p; use test2::bar::p; pub fn my_main() { assert!(p() == 2); } @@ -43,7 +42,6 @@ mod test3 { mod bar { pub fn p() -> int { 2 } } pub mod baz { - use test3::foo::*; use test3::bar::p; pub fn my_main() { assert!(p() == 2); } diff --git a/src/test/run-pass/match-ref-binding-in-guard-3256.rs b/src/test/run-pass/match-ref-binding-in-guard-3256.rs index 4fdbdf8f5c7..a07c63490e7 100644 --- a/src/test/run-pass/match-ref-binding-in-guard-3256.rs +++ b/src/test/run-pass/match-ref-binding-in-guard-3256.rs @@ -8,11 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::rt; - pub fn main() { unsafe { - let x = Some(rt::exclusive::Exclusive::new(true)); + let x = Some(::std::rt::exclusive::Exclusive::new(true)); match x { Some(ref z) if *z.lock() => { assert!(*z.lock()); diff --git a/src/test/run-pass/privacy-ns.rs b/src/test/run-pass/privacy-ns.rs index 5915b3e3a76..336791e65fd 100644 --- a/src/test/run-pass/privacy-ns.rs +++ b/src/test/run-pass/privacy-ns.rs @@ -27,8 +27,6 @@ pub mod foo1 { } fn test_unused1() { - use foo1::Bar; - use foo1::{Bar,Baz}; use foo1::*; } @@ -60,8 +58,6 @@ pub mod foo2 { } fn test_unused2() { - use foo2::Bar; - use foo2::{Bar,Baz}; use foo2::*; } @@ -93,8 +89,6 @@ pub mod foo3 { } fn test_unused3() { - use foo3::Bar; - use foo3::{Bar,Baz}; use foo3::*; } diff --git a/src/test/run-pass/type-sizes.rs b/src/test/run-pass/type-sizes.rs index 970a5c5011b..2596bc9c837 100644 --- a/src/test/run-pass/type-sizes.rs +++ b/src/test/run-pass/type-sizes.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate std; use std::mem::size_of; struct t {a: u8, b: i8} diff --git a/src/test/run-pass/writealias.rs b/src/test/run-pass/writealias.rs index f2d29c97f15..6d57bff1bd6 100644 --- a/src/test/run-pass/writealias.rs +++ b/src/test/run-pass/writealias.rs @@ -9,15 +9,13 @@ // except according to those terms. -use std::rt; - struct Point {x: int, y: int, z: int} fn f(p: &mut Point) { p.z = 13; } pub fn main() { unsafe { - let x = Some(rt::exclusive::Exclusive::new(true)); + let x = Some(::std::rt::exclusive::Exclusive::new(true)); match x { Some(ref z) if *z.lock() => { assert!(*z.lock()); |
