Skip to content

Commit c1084a3

Browse files
committed
Changes to tests
1 parent d21bfff commit c1084a3

22 files changed

+20
-34
lines changed

src/librustc/lint/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,10 @@ pub trait LintContext: Sized {
505505
impl<'a> EarlyContext<'a> {
506506
fn new(sess: &'a Session,
507507
krate: &'a ast::Crate) -> EarlyContext<'a> {
508-
// We want to own the lint store, so move it out of the session.
508+
// We want to own the lint store, so move it out of the session. Remember
509+
// to put it back later...
509510
let lint_store = mem::replace(&mut *sess.lint_store.borrow_mut(),
510511
LintStore::new());
511-
512512
EarlyContext {
513513
sess: sess,
514514
krate: krate,

src/librustc_driver/driver.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ pub fn compile_input(sess: Session,
129129
&ast_map.krate(),
130130
&id[..]));
131131

132+
time(sess.time_passes(), "early lint checks", || {
133+
lint::check_ast_crate(&sess, &expanded_crate)
134+
});
132135

133136
phase_3_run_analysis_passes(sess,
134137
ast_map,
@@ -597,10 +600,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
597600
sess.abort_if_errors();
598601
});
599602

600-
time(time_passes, "early lint checks", || {
601-
lint::check_ast_crate(sess, &krate)
602-
});
603-
604603
Some(krate)
605604
}
606605

src/test/auxiliary/lint_for_crate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
extern crate rustc_front;
1818
extern crate syntax;
1919

20-
use rustc::lint::{Context, LintPass, LintPassObject, LintArray};
20+
use rustc::lint::{Context, LintContext, LintPass, LintPassObject, LintArray};
2121
use rustc::plugin::Registry;
2222
use rustc_front::hir;
2323
use syntax::attr;

src/test/auxiliary/lint_group_plugin_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern crate rustc_front;
2020
extern crate rustc;
2121

2222
use rustc_front::hir;
23-
use rustc::lint::{Context, LintPass, LintPassObject, LintArray};
23+
use rustc::lint::{Context, LintContext, LintPass, LintPassObject, LintArray};
2424
use rustc::plugin::Registry;
2525

2626
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");

src/test/auxiliary/lint_plugin_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
#![feature(plugin_registrar)]
1414
#![feature(box_syntax, rustc_private)]
1515

16-
extern crate rustc_front;
16+
extern crate syntax;
1717

1818
// Load rustc as a plugin to get macros
1919
#[macro_use]
2020
extern crate rustc;
2121

22-
use rustc::lint::{Context, LintPass, LintPassObject, LintArray};
22+
use rustc::lint::{EarlyContext, LintContext, LintPass, LintPassObject, LintArray};
2323
use rustc::plugin::Registry;
24-
use rustc_front::hir;
24+
use syntax::ast;
2525
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
2626

2727
struct Pass;
@@ -31,7 +31,7 @@ impl LintPass for Pass {
3131
lint_array!(TEST_LINT)
3232
}
3333

34-
fn check_item(&mut self, cx: &Context, it: &hir::Item) {
34+
fn check_ast_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
3535
if it.ident.name == "lintme" {
3636
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
3737
}

src/test/compile-fail/autoderef-full-lval.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(unknown_features)]
1211
#![feature(box_syntax)]
1312

1413
struct clam {

src/test/compile-fail/borrow-tuple-fields.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(unknown_features)]
1211
#![feature(box_syntax)]
1312

1413
struct Foo(Box<isize>, isize);

src/test/compile-fail/cast-as-bool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
let u = (5 as bool);
12+
let u = 5 as bool;
1313
//~^ ERROR cannot cast as `bool`
1414
//~^^ HELP compare with zero instead
1515
}

src/test/compile-fail/dropck_arr_cycle_checked.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use std::cell::Cell;
1919
use id::Id;
2020

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

2524
static S_COUNT: AtomicUsize = AtomicUsize::new(0);

src/test/compile-fail/dropck_tarena_cycle_checked.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// which is a reduction of this code to more directly show the reason
1717
// for the error message we see here.)
1818

19-
#![allow(unstable)]
2019
#![feature(const_fn)]
2120

2221
extern crate arena;
@@ -26,7 +25,6 @@ use std::cell::Cell;
2625
use id::Id;
2726

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

3230
static S_COUNT: AtomicUsize = AtomicUsize::new(0);

src/test/compile-fail/dropck_tarena_unsound_drop.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
// (Also compare against dropck_tarena_cycle_checked.rs, from which
2020
// this was reduced to better understand its error message.)
2121

22-
#![allow(unstable)]
23-
2422
extern crate arena;
2523

2624
use arena::TypedArena;

src/test/compile-fail/dropck_vec_cycle_checked.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use std::cell::Cell;
1818
use id::Id;
1919

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

2423
static S_COUNT: AtomicUsize = AtomicUsize::new(0);

src/test/compile-fail/for-loop-hygiene.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
// for-loops are expanded in the front end, and use an `iter` ident in their expansion. Check that
1212
// `iter` is not accessible inside the for loop.
1313

14-
#![allow(unstable)]
15-
1614
fn main() {
1715
for _ in 0..10 {
1816
iter.next(); //~ error: unresolved name `iter`

src/test/compile-fail/issue-17283.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// Test that the parser does not attempt to parse struct literals
1212
// within assignments in if expressions.
1313

14+
#![allow(unused_parens)]
15+
1416
struct Foo {
1517
foo: usize
1618
}

src/test/compile-fail/issue-23729.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn main() {
2626
self.pos += 1;
2727
Some(next_val)
2828
} else {
29-
let next_val = (self.mem[0] + self.mem[1]);
29+
let next_val = self.mem[0] + self.mem[1];
3030
self.mem[0] = self.mem[1];
3131
self.mem[1] = next_val;
3232
Some(next_val)

src/test/compile-fail/lint-visible-private-types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(visible_private_types)]
1211
#![allow(dead_code)]
1312
#![crate_type="lib"]
1413

src/test/compile-fail/loop-does-not-diverge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ fn forever() -> ! {
1818
}
1919

2020
fn main() {
21-
if (1 == 2) { forever(); }
21+
if 1 == 2 { forever(); }
2222
}

src/test/compile-fail/variance-trait-bounds.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bivariance)]
1211
#![allow(dead_code)]
1312
#![feature(rustc_attrs)]
1413

src/test/compile-fail/variance-types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![deny(bivariance)]
1211
#![allow(dead_code)]
1312
#![feature(rustc_attrs)]
1413

src/test/compile-fail/vec-must-not-hide-type-from-dropck.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use std::cell::Cell;
2929
use id::Id;
3030

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

3534
static S_COUNT: AtomicUsize = AtomicUsize::new(0);

src/test/pretty/issue-4264.pp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727
let _: [(); (1 as usize)] = ([(() as ())] as [(); 1]);
2828

2929
let _ =
30-
(((&((([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3])) as [i32; 3])
31-
as &[i32; 3]) as *const _ as *const [i32; 3]) as
32-
*const [i32; (3 as usize)] as *const [i32; 3]);
33-
30+
(((&([(1 as i32), (2 as i32), (3 as i32)] as [i32; 3]) as &[i32; 3])
31+
as *const _ as *const [i32; 3]) as *const [i32; (3 as usize)] as
32+
*const [i32; 3]);
3433

3534

3635

src/test/run-make/execution-engine/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ fn compile_program(input: &str, sysroot: PathBuf)
228228
let ast_map = driver::make_map(&sess, &mut hir_forest);
229229

230230
driver::phase_3_run_analysis_passes(
231-
sess, ast_map, &krate, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
231+
sess, ast_map, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
232232

233233
let trans = driver::phase_4_translate_to_llvm(tcx, analysis);
234234

0 commit comments

Comments
 (0)