tests: fix fallout of merging ast::ViewItem into ast::Item.
This commit is contained in:
parent
838b2ea760
commit
139346adb6
7 changed files with 14 additions and 47 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
}
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue