Skip to content

Commit a0ad4ad

Browse files
Change thread name
1 parent 5fe3915 commit a0ad4ad

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

src/librustdoc/test.rs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub fn run(input: &str,
8888
config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone()));
8989

9090
let krate = panictry!(driver::phase_1_parse_input(&sess, &input));
91-
let driver::ExpansionResult { defs, mut hir_forest, .. } = {
91+
let driver::ExpansionResult { hir_forest, .. } = {
9292
phase_2_configure_and_expand(
9393
&sess, &cstore, krate, None, "rustdoc-test", None, MakeGlobMap::No, |_| Ok(())
9494
).expect("phase_2_configure_and_expand aborted in rustdoc!")
@@ -183,8 +183,6 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
183183
name: driver::anon_src(),
184184
input: test.to_owned(),
185185
};
186-
let test = format!("Error in \"{}\" at line {}.\n",
187-
filename, line_number);
188186
let outputs = OutputTypes::new(&[(OutputType::Exe, None)]);
189187

190188
let sessopts = config::Options {
@@ -265,22 +263,22 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
265263
if count > 0 && !compile_fail {
266264
sess.fatal("aborting due to previous error(s)")
267265
} else if count == 0 && compile_fail {
268-
panic!("test compiled while it wasn't supposed to:\n\n{}\n", test)
266+
panic!("test compiled while it wasn't supposed to")
269267
}
270268
if count > 0 && error_codes.len() > 0 {
271269
let out = String::from_utf8(data.lock().unwrap().to_vec()).unwrap();
272270
error_codes.retain(|err| !out.contains(err));
273271
}
274272
}
275273
Ok(()) if compile_fail => {
276-
panic!("test compiled while it wasn't supposed to:\n\n{}\n", test)
274+
panic!("test compiled while it wasn't supposed to")
277275
}
278276
_ => {}
279277
}
280278
}
281279
Err(_) => {
282280
if !compile_fail {
283-
panic!("couldn't compile the test:\n\n{}\n", test);
281+
panic!("couldn't compile the test");
284282
}
285283
if error_codes.len() > 0 {
286284
let out = String::from_utf8(data.lock().unwrap().to_vec()).unwrap();
@@ -290,7 +288,7 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
290288
}
291289

292290
if error_codes.len() > 0 {
293-
panic!("Some expected error codes were not found: {:?}\n\n{}\n", error_codes, test);
291+
panic!("Some expected error codes were not found: {:?}", error_codes);
294292
}
295293

296294
if no_run { return }
@@ -312,18 +310,17 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
312310
cmd.env(var, &newpath);
313311

314312
match cmd.output() {
315-
Err(e) => panic!("couldn't run the test: {}{}\n\n{}\n", e,
313+
Err(e) => panic!("couldn't run the test: {}{}", e,
316314
if e.kind() == io::ErrorKind::PermissionDenied {
317315
" - maybe your tempdir is mounted with noexec?"
318-
} else { "" }, test),
316+
} else { "" }),
319317
Ok(out) => {
320318
if should_panic && out.status.success() {
321-
panic!("test executable succeeded when it should have failed\n\n{}\n", test);
319+
panic!("test executable succeeded when it should have failed");
322320
} else if !should_panic && !out.status.success() {
323-
panic!("test executable failed:\n{}\n{}\n\n{}\n",
321+
panic!("test executable failed:\n{}\n{}\n",
324322
str::from_utf8(&out.stdout).unwrap_or(""),
325-
str::from_utf8(&out.stderr).unwrap_or(""),
326-
test);
323+
str::from_utf8(&out.stderr).unwrap_or(""));
327324
}
328325
}
329326
}
@@ -458,12 +455,8 @@ impl Collector {
458455
should_panic: bool, no_run: bool, should_ignore: bool,
459456
as_test_harness: bool, compile_fail: bool, error_codes: Vec<String>,
460457
original: String) {
461-
let name = if self.use_headers {
462-
let s = self.current_header.as_ref().map(|s| &**s).unwrap_or("");
463-
format!("{}_{}", s, self.cnt)
464-
} else {
465-
format!("{}_{}", self.names.join("::"), self.cnt)
466-
};
458+
let line_number = self.get_line_from_key(&format!("{}\n{}\n", original, test));
459+
let name = format!("{} - line {}", self.filename, line_number);
467460
self.cnt += 1;
468461
let cfgs = self.cfgs.clone();
469462
let libs = self.libs.clone();
@@ -472,8 +465,6 @@ impl Collector {
472465
let opts = self.opts.clone();
473466
let maybe_sysroot = self.maybe_sysroot.clone();
474467
debug!("Creating test {}: {}", name, test);
475-
let line_number = self.get_line_from_key(&format!("{}\n{}\n", original, test));
476-
let filename = self.filename.clone();
477468
self.tests.push(testing::TestDescAndFn {
478469
desc: testing::TestDesc {
479470
name: testing::DynTestName(name),

0 commit comments

Comments
 (0)