about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2014-12-26 23:36:21 +0200
committerEduard Burtescu <edy.burt@gmail.com>2015-01-21 20:05:16 +0200
commit139346adb6632dd1507b263f1702f5f6df66e682 (patch)
tree7afc362760fffce38688b51b3378c712f3077291
parent838b2ea760282c716f4354b40fafe3cd55ae5ec7 (diff)
tests: fix fallout of merging ast::ViewItem into ast::Item.
-rw-r--r--src/librustc_driver/test.rs1
-rw-r--r--src/libsyntax/parse/mod.rs16
-rw-r--r--src/test/compile-fail-fulldeps/gated-plugin.rs3
-rw-r--r--src/test/compile-fail/issue-9957.rs15
-rw-r--r--src/test/compile-fail/unnecessary-private.rs3
-rw-r--r--src/test/compile-fail/view-items-at-top.rs19
-rw-r--r--src/test/pretty/issue-4264.pp4
7 files changed, 14 insertions, 47 deletions
diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs
index f68c76f4c44..cd28a27f988 100644
--- a/src/librustc_driver/test.rs
+++ b/src/librustc_driver/test.rs
@@ -200,6 +200,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
             }
 
             return match it.node {
+                ast::ItemUse(..) | ast::ItemExternCrate(..) |
                 ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemFn(..) |
                 ast::ItemForeignMod(..) | ast::ItemTy(..) => {
                     None
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 49dca01ef50..8ac94a38273 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -1109,25 +1109,25 @@ mod test {
 
     #[test] fn parse_use() {
         let use_s = "use foo::bar::baz;";
-        let vitem = string_to_item(use_s.to_string());
-        let vitem_s = item_to_string(&vitem);
+        let vitem = string_to_item(use_s.to_string()).unwrap();
+        let vitem_s = item_to_string(&*vitem);
         assert_eq!(&vitem_s[], use_s);
 
         let use_s = "use foo::bar as baz;";
-        let vitem = string_to_item(use_s.to_string());
-        let vitem_s = item_to_string(&vitem);
+        let vitem = string_to_item(use_s.to_string()).unwrap();
+        let vitem_s = item_to_string(&*vitem);
         assert_eq!(&vitem_s[], use_s);
     }
 
     #[test] fn parse_extern_crate() {
         let ex_s = "extern crate foo;";
-        let vitem = string_to_item(ex_s.to_string());
-        let vitem_s = item_to_string(&vitem);
+        let vitem = string_to_item(ex_s.to_string()).unwrap();
+        let vitem_s = item_to_string(&*vitem);
         assert_eq!(&vitem_s[], ex_s);
 
         let ex_s = "extern crate \"foo\" as bar;";
-        let vitem = string_to_item(ex_s.to_string());
-        let vitem_s = item_to_string(&vitem);
+        let vitem = string_to_item(ex_s.to_string()).unwrap();
+        let vitem_s = item_to_string(&*vitem);
         assert_eq!(&vitem_s[], ex_s);
     }
 
diff --git a/src/test/compile-fail-fulldeps/gated-plugin.rs b/src/test/compile-fail-fulldeps/gated-plugin.rs
index 89090d5f38a..be9e57e2d19 100644
--- a/src/test/compile-fail-fulldeps/gated-plugin.rs
+++ b/src/test/compile-fail-fulldeps/gated-plugin.rs
@@ -11,8 +11,7 @@
 // aux-build:macro_crate_test.rs
 // ignore-stage1
 
-#[plugin] #[no_link]
+#[plugin] #[no_link] extern crate macro_crate_test;
 //~^ ERROR compiler plugins are experimental and possibly buggy
-extern crate macro_crate_test;
 
 fn main() {}
diff --git a/src/test/compile-fail/issue-9957.rs b/src/test/compile-fail/issue-9957.rs
deleted file mode 100644
index b1204e82890..00000000000
--- a/src/test/compile-fail/issue-9957.rs
+++ /dev/null
@@ -1,15 +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.
-
-pub extern crate core; //~ ERROR: `pub` visibility is not allowed
-
-fn main() {
-    pub use std::usize; //~ ERROR: imports in functions are never reachable
-}
diff --git a/src/test/compile-fail/unnecessary-private.rs b/src/test/compile-fail/unnecessary-private.rs
index 6e6ffd23c4a..e3707292f24 100644
--- a/src/test/compile-fail/unnecessary-private.rs
+++ b/src/test/compile-fail/unnecessary-private.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 fn main() {
+    pub use std::uint; //~ ERROR: visibility has no effect
     pub struct A; //~ ERROR: visibility has no effect
     pub enum B {} //~ ERROR: visibility has no effect
     pub trait C { //~ ERROR: visibility has no effect
diff --git a/src/test/compile-fail/view-items-at-top.rs b/src/test/compile-fail/view-items-at-top.rs
deleted file mode 100644
index 7b78a8d932b..00000000000
--- a/src/test/compile-fail/view-items-at-top.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2012-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 test;
-
-fn f() {
-}
-
-use test::net;    //~ ERROR `use` and `extern crate` declarations must precede items
-
-fn main() {
-}
diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp
index dac6e628d10..c18d076c0d3 100644
--- a/src/test/pretty/issue-4264.pp
+++ b/src/test/pretty/issue-4264.pp
@@ -1,8 +1,8 @@
 #![no_std]
-#[macro_use]
-extern crate "std" as std;
 #[prelude_import]
 use std::prelude::v1::*;
+#[macro_use]
+extern crate "std" as std;
 // 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.