Skip to content

Commit f70bfd3

Browse files
committed
test: emit 1.77 syntax error only when msrv is incompatible
1 parent e91b58d commit f70bfd3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/testsuite/build_script.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5502,6 +5502,44 @@ for more information about build script outputs.
55025502
.run();
55035503
}
55045504

5505+
#[cargo_test]
5506+
fn test_new_syntax_with_compatible_partial_msrv() {
5507+
let p = project()
5508+
.file(
5509+
"Cargo.toml",
5510+
r#"
5511+
[package]
5512+
name = "foo"
5513+
edition = "2015"
5514+
build = "build.rs"
5515+
rust-version = "1.77"
5516+
"#,
5517+
)
5518+
.file("src/lib.rs", "")
5519+
.file(
5520+
"build.rs",
5521+
r#"
5522+
fn main() {
5523+
println!("cargo::metadata=foo=bar");
5524+
}
5525+
"#,
5526+
)
5527+
.build();
5528+
5529+
p.cargo("check")
5530+
.with_status(101)
5531+
.with_stderr_contains(
5532+
"\
5533+
[COMPILING] foo [..]
5534+
[ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5535+
but the minimum supported Rust version of `foo v0.0.0 ([ROOT]/foo)` is 1.77.
5536+
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5537+
for more information about build script outputs.
5538+
",
5539+
)
5540+
.run();
5541+
}
5542+
55055543
#[cargo_test]
55065544
fn test_old_syntax_with_old_msrv() {
55075545
let p = project()

0 commit comments

Comments
 (0)