Skip to content

Commit f3b525f

Browse files
committed
test fallout
1 parent 585cf6f commit f3b525f

16 files changed

+46
-34
lines changed

src/librustc_driver/driver.rs

+22-11
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ pub fn compile_input(sess: Session,
7070
(control.$point.callback)(state);
7171

7272
if control.$point.stop == Compilation::Stop {
73+
$tsess.abort_if_errors();
7374
return;
7475
}
7576
})}
@@ -469,7 +470,11 @@ pub fn phase_2_configure_and_expand(sess: &Session,
469470

470471
let mut feature_gated_cfgs = vec![];
471472
krate = time(time_passes, "configuration 1", || {
472-
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate, &mut feature_gated_cfgs)
473+
sess.abort_if_new_errors(|| {
474+
syntax::config::strip_unconfigured_items(sess.diagnostic(),
475+
krate,
476+
&mut feature_gated_cfgs)
477+
})
473478
});
474479

475480
*sess.crate_types.borrow_mut() = collect_crate_types(sess, &krate.attrs);
@@ -605,17 +610,23 @@ pub fn phase_2_configure_and_expand(sess: &Session,
605610
// JBC: make CFG processing part of expansion to avoid this problem:
606611

607612
// strip again, in case expansion added anything with a #[cfg].
608-
krate = time(time_passes, "configuration 2", || {
609-
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate, &mut feature_gated_cfgs)
610-
});
613+
krate = sess.abort_if_new_errors(|| {
614+
let krate = time(time_passes, "configuration 2", || {
615+
syntax::config::strip_unconfigured_items(sess.diagnostic(),
616+
krate,
617+
&mut feature_gated_cfgs)
618+
});
611619

612-
time(time_passes, "gated configuration checking", || {
613-
let features = sess.features.borrow();
614-
feature_gated_cfgs.sort();
615-
feature_gated_cfgs.dedup();
616-
for cfg in &feature_gated_cfgs {
617-
cfg.check_and_emit(sess.diagnostic(), &features, sess.codemap());
618-
}
620+
time(time_passes, "gated configuration checking", || {
621+
let features = sess.features.borrow();
622+
feature_gated_cfgs.sort();
623+
feature_gated_cfgs.dedup();
624+
for cfg in &feature_gated_cfgs {
625+
cfg.check_and_emit(sess.diagnostic(), &features, sess.codemap());
626+
}
627+
});
628+
629+
krate
619630
});
620631

621632
krate = time(time_passes, "maybe building test harness", || {

src/librustc_typeck/check/mod.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -4229,7 +4229,9 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
42294229
}
42304230
// Check for unrepresentable discriminant values
42314231
match hint {
4232-
attr::ReprAny | attr::ReprExtern => (),
4232+
attr::ReprAny | attr::ReprExtern => {
4233+
disr_vals.push(current_disr_val);
4234+
}
42334235
attr::ReprInt(sp, ity) => {
42344236
if !disr_in_range(ccx, ity, current_disr_val) {
42354237
let mut err = struct_span_err!(ccx.tcx.sess, v.span, E0082,
@@ -4239,14 +4241,9 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
42394241
err.emit();
42404242
}
42414243
}
4242-
attr::ReprSimd => {
4243-
ccx.tcx.sess.bug("range_to_inttype: found ReprSimd on an enum");
4244-
}
4245-
attr::ReprPacked => {
4246-
ccx.tcx.sess.bug("range_to_inttype: found ReprPacked on an enum");
4247-
}
4244+
// Error reported elsewhere.
4245+
attr::ReprSimd | attr::ReprPacked => {}
42484246
}
4249-
disr_vals.push(current_disr_val);
42504247
}
42514248
}
42524249

src/test/compile-fail/cfg-non-opt-expr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(stmt_expr_attributes)]
12+
1113
fn main() {
1214
let _ = #[cfg(unset)] ();
1315
//~^ ERROR removing an expression is not supported in this position

src/test/compile-fail/double-type-import.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ mod foo {
2020
}
2121

2222
fn main() {
23-
let _ = foo::X;
23+
let _ = foo::X; //~ ERROR unresolved name `foo::X`
2424
}

src/test/compile-fail/import-from-missing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ mod spam {
1616
}
1717

1818
fn main() { ham(); eggs(); }
19+
//~^ ERROR unresolved name `eggs`

src/test/compile-fail/import.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ use zed::baz;
1616
mod zed {
1717
pub fn bar() { println!("bar"); }
1818
}
19-
fn main(args: Vec<String>) { bar(); }
19+
fn main() { bar(); }

src/test/compile-fail/import2.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ mod baz {}
1616
mod zed {
1717
pub fn bar() { println!("bar3"); }
1818
}
19-
fn main(args: Vec<String>) { bar(); }
19+
fn main() { bar(); }
20+
//~^ ERROR unresolved name `bar`

src/test/compile-fail/macro-reexport-malformed-1.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![no_std]
1112
#![feature(macro_reexport)]
1213

1314
#[macro_reexport] //~ ERROR bad macro reexport
1415
extern crate std;
15-
16-
fn main() { }

src/test/compile-fail/macro-reexport-malformed-2.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![no_std]
1112
#![feature(macro_reexport)]
1213

1314
#[macro_reexport="foo"] //~ ERROR bad macro reexport
1415
extern crate std;
15-
16-
fn main() { }

src/test/compile-fail/macro-reexport-malformed-3.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![no_std]
1112
#![feature(macro_reexport)]
1213

1314
#[macro_reexport(foo="bar")] //~ ERROR bad macro reexport
1415
extern crate std;
15-
16-
fn main() { }

src/test/compile-fail/macro-reexport-undef.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// aux-build:two_macros.rs
1212

13+
#![feature(macro_reexport)]
14+
1315
#[macro_use(macro_two)]
1416
#[macro_reexport(no_way)] //~ ERROR reexported macro not found
1517
extern crate two_macros;

src/test/compile-fail/macro-use-bad-args-1.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![no_std]
12+
1113
#[macro_use(foo(bar))] //~ ERROR bad macro import
1214
extern crate std;
13-
14-
fn main() {
15-
}

src/test/compile-fail/macro-use-bad-args-2.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![no_std]
12+
1113
#[macro_use(foo="bar")] //~ ERROR bad macro import
1214
extern crate std;
13-
14-
fn main() {
15-
}

src/test/compile-fail/privacy3.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn test1() {
2828
use bar::gpriv;
2929
//~^ ERROR unresolved import `bar::gpriv`. There is no `gpriv` in `bar`
3030
gpriv();
31+
//~^ ERROR unresolved name `gpriv`
3132
}
3233

3334
#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 }

src/test/compile-fail/self_type_keyword.rs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub fn main() {
2929
//~^ ERROR expected identifier, found keyword `Self`
3030
Self!() => (),
3131
//~^ ERROR expected identifier, found keyword `Self`
32+
//~^^ ERROR macro undefined: 'Self!'
3233
Foo { x: Self } => (),
3334
//~^ ERROR expected identifier, found keyword `Self`
3435
Foo { Self } => (),

src/test/compile-fail/use-mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use foo::bar::{
1414
Bar,
1515
self
1616
//~^ NOTE another `self` import appears here
17+
//~^^ ERROR a module named `bar` has already been imported in this module
1718
};
1819

1920
use {self};

0 commit comments

Comments
 (0)