Skip to content

Commit

Permalink
test fallout
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Jan 21, 2016
1 parent 585cf6f commit f3b525f
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 34 deletions.
33 changes: 22 additions & 11 deletions src/librustc_driver/driver.rs
Expand Up @@ -70,6 +70,7 @@ pub fn compile_input(sess: Session,
(control.$point.callback)(state);

if control.$point.stop == Compilation::Stop {
$tsess.abort_if_errors();
return;
}
})}
Expand Down Expand Up @@ -469,7 +470,11 @@ pub fn phase_2_configure_and_expand(sess: &Session,

let mut feature_gated_cfgs = vec![];
krate = time(time_passes, "configuration 1", || {
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate, &mut feature_gated_cfgs)
sess.abort_if_new_errors(|| {
syntax::config::strip_unconfigured_items(sess.diagnostic(),
krate,
&mut feature_gated_cfgs)
})
});

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

// strip again, in case expansion added anything with a #[cfg].
krate = time(time_passes, "configuration 2", || {
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate, &mut feature_gated_cfgs)
});
krate = sess.abort_if_new_errors(|| {
let krate = time(time_passes, "configuration 2", || {
syntax::config::strip_unconfigured_items(sess.diagnostic(),
krate,
&mut feature_gated_cfgs)
});

time(time_passes, "gated configuration checking", || {
let features = sess.features.borrow();
feature_gated_cfgs.sort();
feature_gated_cfgs.dedup();
for cfg in &feature_gated_cfgs {
cfg.check_and_emit(sess.diagnostic(), &features, sess.codemap());
}
time(time_passes, "gated configuration checking", || {
let features = sess.features.borrow();
feature_gated_cfgs.sort();
feature_gated_cfgs.dedup();
for cfg in &feature_gated_cfgs {
cfg.check_and_emit(sess.diagnostic(), &features, sess.codemap());
}
});

krate
});

krate = time(time_passes, "maybe building test harness", || {
Expand Down
13 changes: 5 additions & 8 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -4229,7 +4229,9 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
}
// Check for unrepresentable discriminant values
match hint {
attr::ReprAny | attr::ReprExtern => (),
attr::ReprAny | attr::ReprExtern => {
disr_vals.push(current_disr_val);
}
attr::ReprInt(sp, ity) => {
if !disr_in_range(ccx, ity, current_disr_val) {
let mut err = struct_span_err!(ccx.tcx.sess, v.span, E0082,
Expand All @@ -4239,14 +4241,9 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
err.emit();
}
}
attr::ReprSimd => {
ccx.tcx.sess.bug("range_to_inttype: found ReprSimd on an enum");
}
attr::ReprPacked => {
ccx.tcx.sess.bug("range_to_inttype: found ReprPacked on an enum");
}
// Error reported elsewhere.
attr::ReprSimd | attr::ReprPacked => {}
}
disr_vals.push(current_disr_val);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/cfg-non-opt-expr.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(stmt_expr_attributes)]

fn main() {
let _ = #[cfg(unset)] ();
//~^ ERROR removing an expression is not supported in this position
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/double-type-import.rs
Expand Up @@ -20,5 +20,5 @@ mod foo {
}

fn main() {
let _ = foo::X;
let _ = foo::X; //~ ERROR unresolved name `foo::X`
}
1 change: 1 addition & 0 deletions src/test/compile-fail/import-from-missing.rs
Expand Up @@ -16,3 +16,4 @@ mod spam {
}

fn main() { ham(); eggs(); }
//~^ ERROR unresolved name `eggs`
2 changes: 1 addition & 1 deletion src/test/compile-fail/import.rs
Expand Up @@ -16,4 +16,4 @@ use zed::baz;
mod zed {
pub fn bar() { println!("bar"); }
}
fn main(args: Vec<String>) { bar(); }
fn main() { bar(); }
3 changes: 2 additions & 1 deletion src/test/compile-fail/import2.rs
Expand Up @@ -16,4 +16,5 @@ mod baz {}
mod zed {
pub fn bar() { println!("bar3"); }
}
fn main(args: Vec<String>) { bar(); }
fn main() { bar(); }
//~^ ERROR unresolved name `bar`
3 changes: 1 addition & 2 deletions src/test/compile-fail/macro-reexport-malformed-1.rs
Expand Up @@ -8,9 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![no_std]
#![feature(macro_reexport)]

#[macro_reexport] //~ ERROR bad macro reexport
extern crate std;

fn main() { }
3 changes: 1 addition & 2 deletions src/test/compile-fail/macro-reexport-malformed-2.rs
Expand Up @@ -8,9 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![no_std]
#![feature(macro_reexport)]

#[macro_reexport="foo"] //~ ERROR bad macro reexport
extern crate std;

fn main() { }
3 changes: 1 addition & 2 deletions src/test/compile-fail/macro-reexport-malformed-3.rs
Expand Up @@ -8,9 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![no_std]
#![feature(macro_reexport)]

#[macro_reexport(foo="bar")] //~ ERROR bad macro reexport
extern crate std;

fn main() { }
2 changes: 2 additions & 0 deletions src/test/compile-fail/macro-reexport-undef.rs
Expand Up @@ -10,6 +10,8 @@

// aux-build:two_macros.rs

#![feature(macro_reexport)]

#[macro_use(macro_two)]
#[macro_reexport(no_way)] //~ ERROR reexported macro not found
extern crate two_macros;
Expand Down
5 changes: 2 additions & 3 deletions src/test/compile-fail/macro-use-bad-args-1.rs
Expand Up @@ -8,8 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![no_std]

#[macro_use(foo(bar))] //~ ERROR bad macro import
extern crate std;

fn main() {
}
5 changes: 2 additions & 3 deletions src/test/compile-fail/macro-use-bad-args-2.rs
Expand Up @@ -8,8 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![no_std]

#[macro_use(foo="bar")] //~ ERROR bad macro import
extern crate std;

fn main() {
}
1 change: 1 addition & 0 deletions src/test/compile-fail/privacy3.rs
Expand Up @@ -28,6 +28,7 @@ fn test1() {
use bar::gpriv;
//~^ ERROR unresolved import `bar::gpriv`. There is no `gpriv` in `bar`
gpriv();
//~^ ERROR unresolved name `gpriv`
}

#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 }
1 change: 1 addition & 0 deletions src/test/compile-fail/self_type_keyword.rs
Expand Up @@ -29,6 +29,7 @@ pub fn main() {
//~^ ERROR expected identifier, found keyword `Self`
Self!() => (),
//~^ ERROR expected identifier, found keyword `Self`
//~^^ ERROR macro undefined: 'Self!'
Foo { x: Self } => (),
//~^ ERROR expected identifier, found keyword `Self`
Foo { Self } => (),
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/use-mod.rs
Expand Up @@ -14,6 +14,7 @@ use foo::bar::{
Bar,
self
//~^ NOTE another `self` import appears here
//~^^ ERROR a module named `bar` has already been imported in this module
};

use {self};
Expand Down

0 comments on commit f3b525f

Please sign in to comment.