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

Lines changed: 22 additions & 11 deletions
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

Lines changed: 5 additions & 8 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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() { }

0 commit comments

Comments
 (0)