Skip to content

Commit

Permalink
Improve debuggability of #48116.
Browse files Browse the repository at this point in the history
1. When the invalid condition is hit, write out the relevant variables too
2. In compile-fail/parse-fail tests, check for ICE first, so the invalid
   error patterns won't mask our ICE output.
  • Loading branch information
kennytm committed Feb 13, 2018
1 parent 4d2d3fc commit 7984c89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/librustc_resolve/resolve_imports.rs
Expand Up @@ -1026,6 +1026,8 @@ fn import_path_to_string(names: &[SpannedIdent],
if names.is_empty() {
import_directive_subclass_to_string(subclass)
} else {
// FIXME: Remove this entire logic after #48116 is fixed.
//
// Note that this code looks a little wonky, it's currently here to
// hopefully help debug #48116, but otherwise isn't intended to
// cause any problems.
Expand All @@ -1034,8 +1036,17 @@ fn import_path_to_string(names: &[SpannedIdent],
names_to_string(names),
import_directive_subclass_to_string(subclass),
);
assert!(!names.is_empty());
assert!(!x.starts_with("::"));
if names.is_empty() || x.starts_with("::") {
span_bug!(
span,
"invalid name `{}` at {:?}; global = {}, names = {:?}, subclass = {:?}",
x,
span,
global,
names,
subclass
);
}
return x
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/runtest.rs
Expand Up @@ -250,6 +250,7 @@ impl<'test> TestCx<'test> {
fn run_cfail_test(&self) {
let proc_res = self.compile_test();
self.check_if_test_should_compile(&proc_res);
self.check_no_compiler_crash(&proc_res);

let output_to_check = self.get_output(&proc_res);
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
Expand All @@ -262,7 +263,6 @@ impl<'test> TestCx<'test> {
self.check_error_patterns(&output_to_check, &proc_res);
}

self.check_no_compiler_crash(&proc_res);
self.check_forbid_output(&output_to_check, &proc_res);
}

Expand Down

0 comments on commit 7984c89

Please sign in to comment.