提交 c1084a3a 编写于 作者: N Nick Cameron

Changes to tests

上级 d21bfff7
......@@ -505,10 +505,10 @@ fn with_ast_lint_attrs<F>(&mut self,
impl<'a> EarlyContext<'a> {
fn new(sess: &'a Session,
krate: &'a ast::Crate) -> EarlyContext<'a> {
// We want to own the lint store, so move it out of the session.
// We want to own the lint store, so move it out of the session. Remember
// to put it back later...
let lint_store = mem::replace(&mut *sess.lint_store.borrow_mut(),
LintStore::new());
EarlyContext {
sess: sess,
krate: krate,
......
......@@ -129,6 +129,9 @@ pub fn compile_input(sess: Session,
&ast_map.krate(),
&id[..]));
time(sess.time_passes(), "early lint checks", || {
lint::check_ast_crate(&sess, &expanded_crate)
});
phase_3_run_analysis_passes(sess,
ast_map,
......@@ -597,10 +600,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
sess.abort_if_errors();
});
time(time_passes, "early lint checks", || {
lint::check_ast_crate(sess, &krate)
});
Some(krate)
}
......
......@@ -17,7 +17,7 @@
extern crate rustc_front;
extern crate syntax;
use rustc::lint::{Context, LintPass, LintPassObject, LintArray};
use rustc::lint::{Context, LintContext, LintPass, LintPassObject, LintArray};
use rustc::plugin::Registry;
use rustc_front::hir;
use syntax::attr;
......
......@@ -20,7 +20,7 @@
extern crate rustc;
use rustc_front::hir;
use rustc::lint::{Context, LintPass, LintPassObject, LintArray};
use rustc::lint::{Context, LintContext, LintPass, LintPassObject, LintArray};
use rustc::plugin::Registry;
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
......
......@@ -13,15 +13,15 @@
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
extern crate rustc_front;
extern crate syntax;
// Load rustc as a plugin to get macros
#[macro_use]
extern crate rustc;
use rustc::lint::{Context, LintPass, LintPassObject, LintArray};
use rustc::lint::{EarlyContext, LintContext, LintPass, LintPassObject, LintArray};
use rustc::plugin::Registry;
use rustc_front::hir;
use syntax::ast;
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
struct Pass;
......@@ -31,7 +31,7 @@ fn get_lints(&self) -> LintArray {
lint_array!(TEST_LINT)
}
fn check_item(&mut self, cx: &Context, it: &hir::Item) {
fn check_ast_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
if it.ident.name == "lintme" {
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
}
......
......@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
struct clam {
......
......@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(unknown_features)]
#![feature(box_syntax)]
struct Foo(Box<isize>, isize);
......
......@@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let u = (5 as bool);
let u = 5 as bool;
//~^ ERROR cannot cast as `bool`
//~^^ HELP compare with zero instead
}
......@@ -19,7 +19,6 @@
use id::Id;
mod s {
#![allow(unstable)]
use std::sync::atomic::{AtomicUsize, Ordering};
static S_COUNT: AtomicUsize = AtomicUsize::new(0);
......
......@@ -16,7 +16,6 @@
// which is a reduction of this code to more directly show the reason
// for the error message we see here.)
#![allow(unstable)]
#![feature(const_fn)]
extern crate arena;
......@@ -26,7 +25,6 @@
use id::Id;
mod s {
#![allow(unstable)]
use std::sync::atomic::{AtomicUsize, Ordering};
static S_COUNT: AtomicUsize = AtomicUsize::new(0);
......
......@@ -19,8 +19,6 @@
// (Also compare against dropck_tarena_cycle_checked.rs, from which
// this was reduced to better understand its error message.)
#![allow(unstable)]
extern crate arena;
use arena::TypedArena;
......
......@@ -18,7 +18,6 @@
use id::Id;
mod s {
#![allow(unstable)]
use std::sync::atomic::{AtomicUsize, Ordering};
static S_COUNT: AtomicUsize = AtomicUsize::new(0);
......
......@@ -11,8 +11,6 @@
// for-loops are expanded in the front end, and use an `iter` ident in their expansion. Check that
// `iter` is not accessible inside the for loop.
#![allow(unstable)]
fn main() {
for _ in 0..10 {
iter.next(); //~ error: unresolved name `iter`
......
......@@ -11,6 +11,8 @@
// Test that the parser does not attempt to parse struct literals
// within assignments in if expressions.
#![allow(unused_parens)]
struct Foo {
foo: usize
}
......
......@@ -26,7 +26,7 @@ fn next(&mut self) -> Option<u64> {
self.pos += 1;
Some(next_val)
} else {
let next_val = (self.mem[0] + self.mem[1]);
let next_val = self.mem[0] + self.mem[1];
self.mem[0] = self.mem[1];
self.mem[1] = next_val;
Some(next_val)
......
......@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(visible_private_types)]
#![allow(dead_code)]
#![crate_type="lib"]
......
......@@ -18,5 +18,5 @@ fn forever() -> ! {
}
fn main() {
if (1 == 2) { forever(); }
if 1 == 2 { forever(); }
}
......@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(bivariance)]
#![allow(dead_code)]
#![feature(rustc_attrs)]
......
......@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(bivariance)]
#![allow(dead_code)]
#![feature(rustc_attrs)]
......
......@@ -29,7 +29,6 @@
use id::Id;
mod s {
#![allow(unstable)]
use std::sync::atomic::{AtomicUsize, Ordering};
static S_COUNT: AtomicUsize = AtomicUsize::new(0);
......
......@@ -27,10 +27,9 @@ pub fn bar() {
let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
let _ =
(((&((([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3])) as [i32; 3])
as &[i32; 3]) as *const _ as *const [i32; 3]) as
*const [i32; (3 as usize)] as *const [i32; 3]);
(((&([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3]) as &[i32; 3])
as *const _ as *const [i32; 3]) as *const [i32; (3 as usize)] as
*const [i32; 3]);
......
......@@ -228,7 +228,7 @@ fn compile_program(input: &str, sysroot: PathBuf)
let ast_map = driver::make_map(&sess, &mut hir_forest);
driver::phase_3_run_analysis_passes(
sess, ast_map, &krate, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
sess, ast_map, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
let trans = driver::phase_4_translate_to_llvm(tcx, analysis);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册