forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#123601 - jieyouxu:compiletest-run-rustfix-rev…
…isions, r=WaffleLapkin compiletest: properly handle revisioned run-rustfix tests Before this PR, if you have a revisioned `//@ run-rustfix` test like `//`@[foo]` run-rustfix`, you would run into an error saying crate name cannot contain `.` characters because the fixed test file trying to be compiled is named `<test-name>.<revision>.fixed`, from which `rustc` infers the crate name to be `<test-name>.<revision>` which is not a valid crate name. This PR fixes the problem by constructing a synthetic crate name from `<test-name>.<revision>`, by 1. replacing all `-` with `_`, and 2. replacing all `.` with `__` and pass that constructed crate name with `--crate-name` to rustc to compile the fixed file. Fixes rust-lang#123596.
- Loading branch information
Showing
8 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/ui/compiletest-self-test/run-rustfix-revisions.foo.fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Check that revisioned `run-rustfix` does not fail with issues related to `.` in crate name. | ||
//@ revisions: foo | ||
//@[foo] run-rustfix | ||
#![deny(unused_variables)] | ||
|
||
fn main() { | ||
let _x = 0usize; | ||
//~^ ERROR unused variable: `x` | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/compiletest-self-test/run-rustfix-revisions.foo.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: unused variable: `x` | ||
--> $DIR/run-rustfix-revisions.rs:7:9 | ||
| | ||
LL | let x = 0usize; | ||
| ^ help: if this is intentional, prefix it with an underscore: `_x` | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/run-rustfix-revisions.rs:4:9 | ||
| | ||
LL | #![deny(unused_variables)] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Check that revisioned `run-rustfix` does not fail with issues related to `.` in crate name. | ||
//@ revisions: foo | ||
//@[foo] run-rustfix | ||
#![deny(unused_variables)] | ||
|
||
fn main() { | ||
let x = 0usize; | ||
//~^ ERROR unused variable: `x` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters