Skip to content

Commit dd25e89

Browse files
committed
Update the semver-check script to be able to run in any directory.
1 parent 0e93732 commit dd25e89

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

crates/semver-check/src/main.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ fn main() {
2323
const SEPARATOR: &str = "///////////////////////////////////////////////////////////";
2424

2525
fn doit() -> Result<(), Box<dyn Error>> {
26-
let filename = std::env::args()
27-
.nth(1)
28-
.unwrap_or_else(|| "src/doc/src/reference/semver.md".to_string());
26+
let filename = std::env::args().nth(1).unwrap_or_else(|| {
27+
Path::new(env!("CARGO_MANIFEST_DIR"))
28+
.join("../../src/doc/src/reference/semver.md")
29+
.to_str()
30+
.unwrap()
31+
.to_string()
32+
});
2933
let contents = fs::read_to_string(filename)?;
3034
let mut lines = contents.lines().enumerate();
3135

src/doc/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ To rebuild the man pages, run `cargo build-man` inside the workspace.
5555
### SemVer chapter tests
5656

5757
There is a script to verify that the examples in the SemVer chapter work as
58-
intended. To run the tests, go into the `semver-check` directory and run
59-
`cargo run`.
58+
intended. To run the tests, run `cargo +stable run -p semver-check`.
59+
60+
Note that these tests run on the most recent stable release because they
61+
validate the output of the compiler diagnostics. The output can change between
62+
releases, so we pin to a specific release to avoid frequent and unexpected
63+
breakage.
6064

6165
## Contributing
6266

0 commit comments

Comments
 (0)