@@ -625,7 +625,7 @@ fn custom_build_invalid_host_config_feature_flag() {
625
625
. with_status ( 101 )
626
626
. with_stderr_contains (
627
627
"\
628
- error: the -Zhost-config flag requires the -Ztarget-applies-to-host flag to be set
628
+ [ERROR] the -Zhost-config flag requires the -Ztarget-applies-to-host flag to be set
629
629
" ,
630
630
)
631
631
. run ( ) ;
@@ -1038,7 +1038,7 @@ fn links_duplicates() {
1038
1038
1039
1039
p. cargo ( "build" ) . with_status ( 101 )
1040
1040
. with_stderr ( "\
1041
- error: failed to select a version for `a-sys`.
1041
+ [ERROR] failed to select a version for `a-sys`.
1042
1042
... required by package `foo v0.5.0 ([..])`
1043
1043
versions that meet the requirements `*` are: 0.5.0
1044
1044
@@ -1163,7 +1163,7 @@ fn links_duplicates_deep_dependency() {
1163
1163
1164
1164
p. cargo ( "build" ) . with_status ( 101 )
1165
1165
. with_stderr ( "\
1166
- error: failed to select a version for `a-sys`.
1166
+ [ERROR] failed to select a version for `a-sys`.
1167
1167
... required by package `a v0.5.0 ([..])`
1168
1168
... which satisfies path dependency `a` of package `foo v0.5.0 ([..])`
1169
1169
versions that meet the requirements `*` are: 0.5.0
@@ -4508,7 +4508,7 @@ fn links_duplicates_with_cycle() {
4508
4508
4509
4509
p. cargo ( "build" ) . with_status ( 101 )
4510
4510
. with_stderr ( "\
4511
- error: failed to select a version for `a`.
4511
+ [ERROR] failed to select a version for `a`.
4512
4512
... required by package `foo v0.5.0 ([..])`
4513
4513
versions that meet the requirements `*` are: 0.5.0
4514
4514
@@ -5315,7 +5315,7 @@ fn wrong_output() {
5315
5315
. with_stderr (
5316
5316
"\
5317
5317
[COMPILING] foo [..]
5318
- error: invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::example`
5318
+ [ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::example`
5319
5319
Expected a line with `cargo::KEY=VALUE` with an `=` character, but none was found.
5320
5320
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5321
5321
for more information about build script outputs.
@@ -5405,7 +5405,7 @@ fn test_invalid_old_syntax() {
5405
5405
. with_stderr (
5406
5406
"\
5407
5407
[COMPILING] foo [..]
5408
- error: invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo:foo`
5408
+ [ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo:foo`
5409
5409
Expected a line with `cargo:KEY=VALUE` with an `=` character, but none was found.
5410
5410
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5411
5411
for more information about build script outputs.
@@ -5434,7 +5434,7 @@ fn test_invalid_new_syntax() {
5434
5434
. with_stderr (
5435
5435
"\
5436
5436
[COMPILING] foo [..]
5437
- error: invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::metadata=foo`
5437
+ [ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::metadata=foo`
5438
5438
Expected a line with `cargo::metadata=KEY=VALUE` with an `=` character, but none was found.
5439
5439
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5440
5440
for more information about build script outputs.
@@ -5459,7 +5459,7 @@ for more information about build script outputs.
5459
5459
. with_stderr (
5460
5460
"\
5461
5461
[COMPILING] foo [..]
5462
- error: invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::foo=bar`
5462
+ [ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::foo=bar`
5463
5463
Unknown key: `foo`.
5464
5464
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5465
5465
for more information about build script outputs.
@@ -5499,7 +5499,89 @@ fn test_new_syntax_with_old_msrv() {
5499
5499
. with_stderr_contains (
5500
5500
"\
5501
5501
[COMPILING] foo [..]
5502
- error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5502
+ [ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5503
+ but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
5504
+ Switch to the old `cargo:foo=bar` syntax instead of `cargo::metadata=foo=bar` (note the single colon).
5505
+ See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5506
+ for more information about build script outputs.
5507
+ " ,
5508
+ )
5509
+ . run ( ) ;
5510
+ }
5511
+
5512
+ #[ cargo_test]
5513
+ fn test_new_syntax_with_old_msrv_and_reserved_prefix ( ) {
5514
+ let p = project ( )
5515
+ . file (
5516
+ "Cargo.toml" ,
5517
+ r#"
5518
+ [package]
5519
+ name = "foo"
5520
+ version = "0.5.0"
5521
+ edition = "2015"
5522
+ authors = []
5523
+ build = "build.rs"
5524
+ rust-version = "1.60.0"
5525
+ "# ,
5526
+ )
5527
+ . file ( "src/lib.rs" , "" )
5528
+ . file (
5529
+ "build.rs" ,
5530
+ r#"
5531
+ fn main() {
5532
+ println!("cargo::rustc-check-cfg=cfg(foo)");
5533
+ }
5534
+ "# ,
5535
+ )
5536
+ . build ( ) ;
5537
+
5538
+ p. cargo ( "build" )
5539
+ . with_status ( 101 )
5540
+ . with_stderr_contains (
5541
+ "\
5542
+ [COMPILING] foo [..]
5543
+ [ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5544
+ but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
5545
+ Switch to the old `cargo:rustc-check-cfg=cfg(foo)` syntax (note the single colon).
5546
+ See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5547
+ for more information about build script outputs.
5548
+ " ,
5549
+ )
5550
+ . run ( ) ;
5551
+ }
5552
+
5553
+ #[ cargo_test]
5554
+ fn test_new_syntax_with_old_msrv_and_unknown_prefix ( ) {
5555
+ let p = project ( )
5556
+ . file (
5557
+ "Cargo.toml" ,
5558
+ r#"
5559
+ [package]
5560
+ name = "foo"
5561
+ version = "0.5.0"
5562
+ edition = "2015"
5563
+ authors = []
5564
+ build = "build.rs"
5565
+ rust-version = "1.60.0"
5566
+ "# ,
5567
+ )
5568
+ . file ( "src/lib.rs" , "" )
5569
+ . file (
5570
+ "build.rs" ,
5571
+ r#"
5572
+ fn main() {
5573
+ println!("cargo::foo=bar");
5574
+ }
5575
+ "# ,
5576
+ )
5577
+ . build ( ) ;
5578
+
5579
+ p. cargo ( "build" )
5580
+ . with_status ( 101 )
5581
+ . with_stderr_contains (
5582
+ "\
5583
+ [COMPILING] foo [..]
5584
+ [ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5503
5585
but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
5504
5586
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5505
5587
for more information about build script outputs.
0 commit comments