提交 139346ad 编写于 作者: E Eduard Burtescu

tests: fix fallout of merging ast::ViewItem into ast::Item.

上级 838b2ea7
...@@ -200,6 +200,7 @@ fn search(this: &Env, ...@@ -200,6 +200,7 @@ fn search(this: &Env,
} }
return match it.node { return match it.node {
ast::ItemUse(..) | ast::ItemExternCrate(..) |
ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemFn(..) | ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemFn(..) |
ast::ItemForeignMod(..) | ast::ItemTy(..) => { ast::ItemForeignMod(..) | ast::ItemTy(..) => {
None None
......
...@@ -1109,25 +1109,25 @@ fn parser_done(p: Parser){ ...@@ -1109,25 +1109,25 @@ fn parser_done(p: Parser){
#[test] fn parse_use() { #[test] fn parse_use() {
let use_s = "use foo::bar::baz;"; let use_s = "use foo::bar::baz;";
let vitem = string_to_item(use_s.to_string()); let vitem = string_to_item(use_s.to_string()).unwrap();
let vitem_s = item_to_string(&vitem); let vitem_s = item_to_string(&*vitem);
assert_eq!(&vitem_s[], use_s); assert_eq!(&vitem_s[], use_s);
let use_s = "use foo::bar as baz;"; let use_s = "use foo::bar as baz;";
let vitem = string_to_item(use_s.to_string()); let vitem = string_to_item(use_s.to_string()).unwrap();
let vitem_s = item_to_string(&vitem); let vitem_s = item_to_string(&*vitem);
assert_eq!(&vitem_s[], use_s); assert_eq!(&vitem_s[], use_s);
} }
#[test] fn parse_extern_crate() { #[test] fn parse_extern_crate() {
let ex_s = "extern crate foo;"; let ex_s = "extern crate foo;";
let vitem = string_to_item(ex_s.to_string()); let vitem = string_to_item(ex_s.to_string()).unwrap();
let vitem_s = item_to_string(&vitem); let vitem_s = item_to_string(&*vitem);
assert_eq!(&vitem_s[], ex_s); assert_eq!(&vitem_s[], ex_s);
let ex_s = "extern crate \"foo\" as bar;"; let ex_s = "extern crate \"foo\" as bar;";
let vitem = string_to_item(ex_s.to_string()); let vitem = string_to_item(ex_s.to_string()).unwrap();
let vitem_s = item_to_string(&vitem); let vitem_s = item_to_string(&*vitem);
assert_eq!(&vitem_s[], ex_s); assert_eq!(&vitem_s[], ex_s);
} }
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
// aux-build:macro_crate_test.rs // aux-build:macro_crate_test.rs
// ignore-stage1 // ignore-stage1
#[plugin] #[no_link] #[plugin] #[no_link] extern crate macro_crate_test;
//~^ ERROR compiler plugins are experimental and possibly buggy //~^ ERROR compiler plugins are experimental and possibly buggy
extern crate macro_crate_test;
fn main() {} fn main() {}
// 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
}
// 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 // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
pub use std::uint; //~ ERROR: visibility has no effect
pub struct A; //~ ERROR: visibility has no effect pub struct A; //~ ERROR: visibility has no effect
pub enum B {} //~ ERROR: visibility has no effect pub enum B {} //~ ERROR: visibility has no effect
pub trait C { //~ ERROR: visibility has no effect pub trait C { //~ ERROR: visibility has no effect
......
// 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() {
}
#![no_std] #![no_std]
#[macro_use]
extern crate "std" as std;
#[prelude_import] #[prelude_import]
use std::prelude::v1::*; use std::prelude::v1::*;
#[macro_use]
extern crate "std" as std;
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册