Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #250 from KodrAus/cargo/1.3.0
Prepare for 1.3.0 release
- Loading branch information
Showing
8 changed files
with
122 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
wip | ||
target | ||
Cargo.lock | ||
|
||
|
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
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 @@ | ||
*.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,18 @@ | ||
error[E0603]: struct `Flags2` is private | ||
--> $DIR/private_flags.rs:17:26 | ||
| | ||
17 | let flag2 = example::Flags2::FLAG_B; | ||
| ^^^^^^ private struct | ||
| | ||
note: the struct `Flags2` is defined here | ||
--> $DIR/private_flags.rs:4:5 | ||
| | ||
4 | / bitflags! { | ||
5 | | pub struct Flags1: u32 { | ||
6 | | const FLAG_A = 0b00000001; | ||
7 | | } | ||
... | | ||
11 | | } | ||
12 | | } | ||
| |_____^ | ||
= note: this error originates in the macro `bitflags` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,55 @@ | ||
use std::{ | ||
fs, | ||
ffi::OsStr, | ||
io, | ||
path::Path, | ||
}; | ||
|
||
#[test] | ||
fn compile_fail() { | ||
prepare_stderr_files("tests/compile-fail").unwrap(); | ||
|
||
let t = trybuild::TestCases::new(); | ||
t.compile_fail("tests/compile-fail/*.rs"); | ||
} | ||
|
||
// Compiler messages may change between versions | ||
// We don't want to have to track these too closely for `bitflags`, but | ||
// having some message to check makes sure user-facing errors are sensical. | ||
// | ||
// The approach we use is to run the test on all compilers, but only check stderr | ||
// output on beta (which is the next stable release). We do this by default ignoring | ||
// any `.stderr` files in the `compile-fail` directory, and copying `.stderr.beta` files | ||
// when we happen to be running on a beta compiler. | ||
fn prepare_stderr_files(path: impl AsRef<Path>) -> io::Result<()> { | ||
for entry in fs::read_dir(path)? { | ||
let entry = entry?; | ||
|
||
if entry.path().extension().and_then(OsStr::to_str) == Some("beta") { | ||
let renamed = entry.path().with_extension(""); | ||
|
||
// Unconditionally remove a corresponding `.stderr` file for a `.stderr.beta` | ||
// file if it exists. On `beta` compilers, we'll recreate it. On other compilers, | ||
// we don't want to end up checking it anyways. | ||
if renamed.exists() { | ||
fs::remove_file(&renamed)?; | ||
} | ||
|
||
rename_beta_stderr(entry.path(), renamed)?; | ||
} | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
#[rustversion::beta] | ||
fn rename_beta_stderr(from: impl AsRef<Path>, to: impl AsRef<Path>) -> io::Result<()> { | ||
fs::copy(from, to)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
#[rustversion::not(beta)] | ||
fn rename_beta_stderr(_: impl AsRef<Path>, _: impl AsRef<Path>) -> io::Result<()> { | ||
Ok(()) | ||
} |