Skip to content

Commit

Permalink
Auto merge of #48127 - kennytm:debug-48116, r=<try>
Browse files Browse the repository at this point in the history
[WIP] Debug #48116.

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.

r? @alexcrichton
cc #48116, cc @eddyb
  • Loading branch information
bors committed Feb 11, 2018
2 parents 0196b20 + b292325 commit 36d3769
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ matrix:
include:
# Images used in testing PR and try-build should be run first.
- env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1
if: type = pull_request OR branch = auto
if: branch = auto

- env: IMAGE=dist-x86_64-linux DEPLOY=1
if: branch = try OR branch = auto
if: branch = auto

# "alternate" deployments, these are "nightlies" but have LLVM assertions
# turned on, they're deployed to a different location primarily for
Expand Down Expand Up @@ -57,7 +57,7 @@ matrix:
NO_DEBUG_ASSERTIONS=1
os: osx
osx_image: xcode8.3
if: branch = auto
#if: branch = auto
- env: >
RUST_CHECK_TARGET=check
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ book:
standalone-docs:
$(Q)$(BOOTSTRAP) doc src/doc $(BOOTSTRAP_ARGS)
check:
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS) src/test/compile-fail --test-args single-segment
check-aux:
$(Q)$(BOOTSTRAP) test \
src/tools/cargo \
Expand Down
4 changes: 2 additions & 2 deletions src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ else
return $retval
}

do_make tidy
do_make all
#do_make tidy
#do_make all
do_make "$RUST_CHECK_TARGET"
fi
29 changes: 27 additions & 2 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
// resolution for it so that later resolve stages won't complain.
self.import_dummy_binding(import);
if !seen_spans.contains(&span) {
info!(
"preparing to import_path_to_string(import={:?}, span={:?})",
import,
span
);
let path = import_path_to_string(&import.module_path[..],
&import.subclass,
span);
Expand Down Expand Up @@ -1015,6 +1020,14 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
fn import_path_to_string(names: &[SpannedIdent],
subclass: &ImportDirectiveSubclass,
span: Span) -> String {
info!(
"import_path_to_string(names={:?} ({:p}/{}), subclass={:?}, span={:?})",
names,
names.as_ptr(),
names.len(),
subclass,
span,
);
let pos = names.iter()
.position(|p| span == p.span && p.node.name != keywords::CrateRoot.name());
let global = !names.is_empty() && names[0].node.name == keywords::CrateRoot.name();
Expand All @@ -1026,6 +1039,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 +1049,18 @@ 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 = {:p}/{}, subclass = {:?}",
x,
span,
global,
names.as_ptr(),
names.len(),
subclass
);
}
return x
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// aux-build:xcrate.rs
// rustc-env:RUST_LOG=info

#![feature(extern_in_paths)]

Expand All @@ -20,4 +21,4 @@ use extern::*; //~ ERROR unresolved import `extern::*`
fn main() {
let s = extern::xcrate; //~ ERROR expected value, found module `extern::xcrate`
//~^ NOTE not a value
}
} //~ ERROR must fail kthxbye
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
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 36d3769

Please sign in to comment.