Skip to content

Commit

Permalink
Fix expected error message for missing file
Browse files Browse the repository at this point in the history
rust-lang/rust#82069 made error message that stem macro invocations more
verbose. Since Rust 1.54 (currently in beta) the message includes the
name of the offending macro.

This PR uses version_check to select the appropriate expected error
message.
  • Loading branch information
Kijewski authored and djc committed Feb 16, 2022
1 parent 73d3020 commit 10149f8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ serde_json = { version = "1.0", optional = true }
[dev-dependencies]
criterion = "0.3"
trybuild = "1.0"
version_check = "0.9"

[[bench]]
name = "all"
Expand Down
7 changes: 7 additions & 0 deletions testing/tests/ui.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
use trybuild::TestCases;
use version_check as rustc;

#[cfg_attr(not(windows), test)]
fn ui() {
let t = TestCases::new();
t.compile_fail("tests/ui/*.rs");

if rustc::is_min_version("1.54").unwrap() {
t.compile_fail("tests/ui/since_1_54/*.rs");
} else {
t.compile_fail("tests/ui/before_1_54/*.rs");
}
}
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions testing/tests/ui/since_1_54/incorrect_path.rs
7 changes: 7 additions & 0 deletions testing/tests/ui/since_1_54/incorrect_path.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error: template "thisdoesnotexist.html" not found in directories ["$WORKSPACE/target/tests/askama_testing/templates"]
--> $DIR/incorrect_path.rs:3:10
|
3 | #[derive(Template)]
| ^^^^^^^^
|
= note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info)

0 comments on commit 10149f8

Please sign in to comment.