Skip to content

Commit 36d3769

Browse files
committed
Auto merge of #48127 - kennytm:debug-48116, r=<try>
[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
2 parents 0196b20 + b292325 commit 36d3769

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ matrix:
1313
include:
1414
# Images used in testing PR and try-build should be run first.
1515
- env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1
16-
if: type = pull_request OR branch = auto
16+
if: branch = auto
1717

1818
- env: IMAGE=dist-x86_64-linux DEPLOY=1
19-
if: branch = try OR branch = auto
19+
if: branch = auto
2020

2121
# "alternate" deployments, these are "nightlies" but have LLVM assertions
2222
# turned on, they're deployed to a different location primarily for
@@ -57,7 +57,7 @@ matrix:
5757
NO_DEBUG_ASSERTIONS=1
5858
os: osx
5959
osx_image: xcode8.3
60-
if: branch = auto
60+
#if: branch = auto
6161
6262
- env: >
6363
RUST_CHECK_TARGET=check

src/bootstrap/mk/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ book:
4949
standalone-docs:
5050
$(Q)$(BOOTSTRAP) doc src/doc $(BOOTSTRAP_ARGS)
5151
check:
52-
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
52+
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS) src/test/compile-fail --test-args single-segment
5353
check-aux:
5454
$(Q)$(BOOTSTRAP) test \
5555
src/tools/cargo \

src/ci/run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ else
105105
return $retval
106106
}
107107

108-
do_make tidy
109-
do_make all
108+
#do_make tidy
109+
#do_make all
110110
do_make "$RUST_CHECK_TARGET"
111111
fi

src/librustc_resolve/resolve_imports.rs

+27-2
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,11 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
499499
// resolution for it so that later resolve stages won't complain.
500500
self.import_dummy_binding(import);
501501
if !seen_spans.contains(&span) {
502+
info!(
503+
"preparing to import_path_to_string(import={:?}, span={:?})",
504+
import,
505+
span
506+
);
502507
let path = import_path_to_string(&import.module_path[..],
503508
&import.subclass,
504509
span);
@@ -1015,6 +1020,14 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
10151020
fn import_path_to_string(names: &[SpannedIdent],
10161021
subclass: &ImportDirectiveSubclass,
10171022
span: Span) -> String {
1023+
info!(
1024+
"import_path_to_string(names={:?} ({:p}/{}), subclass={:?}, span={:?})",
1025+
names,
1026+
names.as_ptr(),
1027+
names.len(),
1028+
subclass,
1029+
span,
1030+
);
10181031
let pos = names.iter()
10191032
.position(|p| span == p.span && p.node.name != keywords::CrateRoot.name());
10201033
let global = !names.is_empty() && names[0].node.name == keywords::CrateRoot.name();
@@ -1026,6 +1039,8 @@ fn import_path_to_string(names: &[SpannedIdent],
10261039
if names.is_empty() {
10271040
import_directive_subclass_to_string(subclass)
10281041
} else {
1042+
// FIXME: Remove this entire logic after #48116 is fixed.
1043+
//
10291044
// Note that this code looks a little wonky, it's currently here to
10301045
// hopefully help debug #48116, but otherwise isn't intended to
10311046
// cause any problems.
@@ -1034,8 +1049,18 @@ fn import_path_to_string(names: &[SpannedIdent],
10341049
names_to_string(names),
10351050
import_directive_subclass_to_string(subclass),
10361051
);
1037-
assert!(!names.is_empty());
1038-
assert!(!x.starts_with("::"));
1052+
if names.is_empty() || x.starts_with("::") {
1053+
span_bug!(
1054+
span,
1055+
"invalid name `{}` at {:?}; global = {}, names = {:p}/{}, subclass = {:?}",
1056+
x,
1057+
span,
1058+
global,
1059+
names.as_ptr(),
1060+
names.len(),
1061+
subclass
1062+
);
1063+
}
10391064
return x
10401065
}
10411066
}

src/test/compile-fail/rfc-2126-extern-in-paths/single-segment.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// aux-build:xcrate.rs
12+
// rustc-env:RUST_LOG=info
1213

1314
#![feature(extern_in_paths)]
1415

@@ -20,4 +21,4 @@ use extern::*; //~ ERROR unresolved import `extern::*`
2021
fn main() {
2122
let s = extern::xcrate; //~ ERROR expected value, found module `extern::xcrate`
2223
//~^ NOTE not a value
23-
}
24+
} //~ ERROR must fail kthxbye

src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ impl<'test> TestCx<'test> {
250250
fn run_cfail_test(&self) {
251251
let proc_res = self.compile_test();
252252
self.check_if_test_should_compile(&proc_res);
253+
self.check_no_compiler_crash(&proc_res);
253254

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

265-
self.check_no_compiler_crash(&proc_res);
266266
self.check_forbid_output(&output_to_check, &proc_res);
267267
}
268268

0 commit comments

Comments
 (0)