Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit c31fe5f

Browse files
Kijewskidjc
authored andcommitted
Fix expected error message for missing file
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.
1 parent 8bb3de0 commit c31fe5f

File tree

6 files changed

+16
-0
lines changed

6 files changed

+16
-0
lines changed

testing/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ serde_json = { version = "1.0", optional = true }
1616
[dev-dependencies]
1717
criterion = "0.3"
1818
trybuild = "1.0"
19+
version_check = "0.9"
1920

2021
[[bench]]
2122
name = "all"

testing/tests/ui.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
use trybuild::TestCases;
2+
use version_check as rustc;
23

34
#[cfg_attr(not(windows), test)]
45
fn ui() {
56
let t = TestCases::new();
67
t.compile_fail("tests/ui/*.rs");
8+
9+
if rustc::is_min_version("1.54").unwrap() {
10+
t.compile_fail("tests/ui/since_1_54/*.rs");
11+
} else {
12+
t.compile_fail("tests/ui/before_1_54/*.rs");
13+
}
714
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../before_1_54/incorrect_path.rs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
error: template "thisdoesnotexist.html" not found in directories ["$WORKSPACE/target/tests/askama_testing/templates"]
2+
--> $DIR/incorrect_path.rs:3:10
3+
|
4+
3 | #[derive(Template)]
5+
| ^^^^^^^^
6+
|
7+
= note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info)

0 commit comments

Comments
 (0)