Skip to content

Commit 5eaedda

Browse files
committed
Address review comments.
1 parent 5baac07 commit 5eaedda

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

src/test/ui/lint/lint-type-overflow2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#![deny(overflowing_literals)]
44
#![deny(const_err)]
5-
#![allow(unused_variables)]
65

76
fn main() {
87
let x2: i8 = --128; //~ ERROR literal out of range for `i8`

src/test/ui/proc-macro/auxiliary/generate-mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
// force-host
33
// no-prefer-dynamic
4+
// ignore-pass
45

56
#![crate_type = "proc-macro"]
67

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// compile-pass
22
// compile-flags: -Zsave-analysis -Zemit-artifact-notifications
33
// compile-flags: --crate-type rlib --error-format=json
4+
// ignore-pass
5+
// ^-- needed because otherwise, the .stderr file changes with --pass check
6+
47
pub fn foo() {}

src/tools/compiletest/src/header.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ pub struct TestProps {
350350
// arguments. (In particular, it propagates to the aux-builds.)
351351
pub incremental_dir: Option<PathBuf>,
352352
// How far should the test proceed while still passing.
353-
pub pass_mode: Option<PassMode>,
353+
pass_mode: Option<PassMode>,
354354
// Ignore `--pass` overrides from the command line for this test.
355-
pub ignore_pass: bool,
355+
ignore_pass: bool,
356356
// rustdoc will test the output of the `--test` option
357357
pub check_test_line_numbers_match: bool,
358358
// Do not pass `-Z ui-testing` to UI tests
@@ -608,6 +608,15 @@ impl TestProps {
608608
(_, None) => {}
609609
}
610610
}
611+
612+
pub fn pass_mode(&self, config: &Config) -> Option<PassMode> {
613+
if !self.ignore_pass {
614+
if let (mode @ Some(_), Some(_)) = (config.force_pass_mode, self.pass_mode) {
615+
return mode;
616+
}
617+
}
618+
self.pass_mode
619+
}
611620
}
612621

613622
fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) {

src/tools/compiletest/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
328328
filter_exact: matches.opt_present("exact"),
329329
force_pass_mode: matches.opt_str("pass").map(|mode|
330330
mode.parse::<PassMode>()
331-
.unwrap_or_else(|_| panic!("unknown `--pass` option `{}` given.", mode))
331+
.unwrap_or_else(|_| panic!("unknown `--pass` option `{}` given", mode))
332332
),
333333
logfile: matches.opt_str("logfile").map(|s| PathBuf::from(&s)),
334334
runtool: matches.opt_str("runtool"),

src/tools/compiletest/src/runtest.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
211211
props: &props,
212212
testpaths,
213213
revision: revision,
214-
is_aux: false,
215214
};
216215
create_dir_all(&cx.output_base_dir()).unwrap();
217216

@@ -230,7 +229,6 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
230229
props: &revision_props,
231230
testpaths,
232231
revision: Some(revision),
233-
is_aux: false,
234232
};
235233
rev_cx.run_revision();
236234
}
@@ -262,7 +260,7 @@ pub fn compute_stamp_hash(config: &Config) -> String {
262260
env::var_os("PYTHONPATH").hash(&mut hash);
263261
}
264262

265-
if let Ui | RunPass = config.mode {
263+
if let Ui | RunPass | Incremental = config.mode {
266264
config.force_pass_mode.hash(&mut hash);
267265
}
268266

@@ -274,7 +272,6 @@ struct TestCx<'test> {
274272
props: &'test TestProps,
275273
testpaths: &'test TestPaths,
276274
revision: Option<&'test str>,
277-
is_aux: bool,
278275
}
279276

280277
struct DebuggerCommands {
@@ -316,18 +313,13 @@ impl<'test> TestCx<'test> {
316313
}
317314
}
318315

319-
fn effective_pass_mode(&self) -> Option<PassMode> {
320-
if !self.props.ignore_pass {
321-
if let (mode @ Some(_), Some(_)) = (self.config.force_pass_mode, self.props.pass_mode) {
322-
return mode;
323-
}
324-
}
325-
self.props.pass_mode
316+
fn pass_mode(&self) -> Option<PassMode> {
317+
self.props.pass_mode(self.config)
326318
}
327319

328320
fn should_run_successfully(&self) -> bool {
329321
match self.config.mode {
330-
RunPass | Ui => self.effective_pass_mode() == Some(PassMode::Run),
322+
RunPass | Ui => self.pass_mode() == Some(PassMode::Run),
331323
mode => panic!("unimplemented for mode {:?}", mode),
332324
}
333325
}
@@ -337,15 +329,15 @@ impl<'test> TestCx<'test> {
337329
CompileFail => false,
338330
RunPass => true,
339331
JsDocTest => true,
340-
Ui => self.props.pass_mode.is_some(),
332+
Ui => self.pass_mode().is_some(),
341333
Incremental => {
342334
let revision = self.revision
343335
.expect("incremental tests require a list of revisions");
344336
if revision.starts_with("rpass") || revision.starts_with("rfail") {
345337
true
346338
} else if revision.starts_with("cfail") {
347339
// FIXME: would be nice if incremental revs could start with "cpass"
348-
self.props.pass_mode.is_some()
340+
self.pass_mode().is_some()
349341
} else {
350342
panic!("revision name must begin with rpass, rfail, or cfail");
351343
}
@@ -1356,7 +1348,7 @@ impl<'test> TestCx<'test> {
13561348
fn check_error_patterns(&self, output_to_check: &str, proc_res: &ProcRes) {
13571349
debug!("check_error_patterns");
13581350
if self.props.error_patterns.is_empty() {
1359-
if self.props.pass_mode.is_some() {
1351+
if self.pass_mode().is_some() {
13601352
return;
13611353
} else {
13621354
self.fatal(&format!(
@@ -1578,7 +1570,6 @@ impl<'test> TestCx<'test> {
15781570
props: &aux_props,
15791571
testpaths: &aux_testpaths,
15801572
revision: self.revision,
1581-
is_aux: true,
15821573
};
15831574
// Create the directory for the stdout/stderr files.
15841575
create_dir_all(aux_cx.output_base_dir()).unwrap();
@@ -1748,7 +1739,6 @@ impl<'test> TestCx<'test> {
17481739
props: &aux_props,
17491740
testpaths: &aux_testpaths,
17501741
revision: self.revision,
1751-
is_aux: true,
17521742
};
17531743
// Create the directory for the stdout/stderr files.
17541744
create_dir_all(aux_cx.output_base_dir()).unwrap();
@@ -1989,8 +1979,7 @@ impl<'test> TestCx<'test> {
19891979
}
19901980
}
19911981

1992-
let pass_mode = if self.is_aux { self.props.pass_mode } else { self.effective_pass_mode() };
1993-
if let Some(PassMode::Check) = pass_mode {
1982+
if let Some(PassMode::Check) = self.pass_mode() {
19941983
rustc.args(&["--emit", "metadata"]);
19951984
}
19961985

@@ -2728,7 +2717,6 @@ impl<'test> TestCx<'test> {
27282717
props: &revision_props,
27292718
testpaths: self.testpaths,
27302719
revision: self.revision,
2731-
is_aux: false,
27322720
};
27332721

27342722
if self.config.verbose {

0 commit comments

Comments
 (0)