Skip to content

Commit

Permalink
Changes to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Sep 17, 2015
1 parent d21bfff commit c1084a3
Show file tree
Hide file tree
Showing 22 changed files with 20 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/librustc/lint/context.rs
Expand Up @@ -505,10 +505,10 @@ pub trait LintContext: Sized {
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,
Expand Down
7 changes: 3 additions & 4 deletions src/librustc_driver/driver.rs
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/auxiliary/lint_for_crate.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/test/auxiliary/lint_group_plugin_test.rs
Expand Up @@ -20,7 +20,7 @@ extern crate rustc_front;
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'");
Expand Down
8 changes: 4 additions & 4 deletions src/test/auxiliary/lint_plugin_test.rs
Expand Up @@ -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;
Expand All @@ -31,7 +31,7 @@ impl LintPass for Pass {
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'");
}
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/autoderef-full-lval.rs
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/borrow-tuple-fields.rs
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/cast-as-bool.rs
Expand Up @@ -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
}
1 change: 0 additions & 1 deletion src/test/compile-fail/dropck_arr_cycle_checked.rs
Expand Up @@ -19,7 +19,6 @@ use std::cell::Cell;
use id::Id;

mod s {
#![allow(unstable)]
use std::sync::atomic::{AtomicUsize, Ordering};

static S_COUNT: AtomicUsize = AtomicUsize::new(0);
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/dropck_tarena_cycle_checked.rs
Expand Up @@ -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;
Expand All @@ -26,7 +25,6 @@ use std::cell::Cell;
use id::Id;

mod s {
#![allow(unstable)]
use std::sync::atomic::{AtomicUsize, Ordering};

static S_COUNT: AtomicUsize = AtomicUsize::new(0);
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/dropck_tarena_unsound_drop.rs
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/dropck_vec_cycle_checked.rs
Expand Up @@ -18,7 +18,6 @@ use std::cell::Cell;
use id::Id;

mod s {
#![allow(unstable)]
use std::sync::atomic::{AtomicUsize, Ordering};

static S_COUNT: AtomicUsize = AtomicUsize::new(0);
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/for-loop-hygiene.rs
Expand Up @@ -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`
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-17283.rs
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-23729.rs
Expand Up @@ -26,7 +26,7 @@ fn main() {
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)
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/lint-visible-private-types.rs
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/loop-does-not-diverge.rs
Expand Up @@ -18,5 +18,5 @@ fn forever() -> ! {
}

fn main() {
if (1 == 2) { forever(); }
if 1 == 2 { forever(); }
}
1 change: 0 additions & 1 deletion src/test/compile-fail/variance-trait-bounds.rs
Expand Up @@ -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)]

Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/variance-types.rs
Expand Up @@ -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)]

Expand Down
Expand Up @@ -29,7 +29,6 @@ use std::cell::Cell;
use id::Id;

mod s {
#![allow(unstable)]
use std::sync::atomic::{AtomicUsize, Ordering};

static S_COUNT: AtomicUsize = AtomicUsize::new(0);
Expand Down
7 changes: 3 additions & 4 deletions src/test/pretty/issue-4264.pp
Expand Up @@ -27,10 +27,9 @@
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]);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make/execution-engine/test.rs
Expand Up @@ -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);

Expand Down

0 comments on commit c1084a3

Please sign in to comment.