File tree 2 files changed +35
-3
lines changed
2 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -724,10 +724,9 @@ impl BuildOutput {
724
724
pkg_descr : & str ,
725
725
msrv : & Option < RustVersion > ,
726
726
) -> CargoResult < ( ) > {
727
- let new_syntax_added_in = & RustVersion :: from_str ( "1.77.0" ) ?;
728
-
729
727
if let Some ( msrv) = msrv {
730
- if msrv < new_syntax_added_in {
728
+ let new_syntax_added_in = RustVersion :: from_str ( "1.77.0" ) ?;
729
+ if !new_syntax_added_in. is_compatible_with ( msrv. as_partial ( ) ) {
731
730
bail ! (
732
731
"the `cargo::` syntax for build script output instructions was added in \
733
732
Rust 1.77.0, but the minimum supported Rust version of `{pkg_descr}` is {msrv}.\n \
Original file line number Diff line number Diff line change @@ -5502,6 +5502,39 @@ for more information about build script outputs.
5502
5502
. run ( ) ;
5503
5503
}
5504
5504
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_stderr_contains (
5531
+ "\
5532
+ [COMPILING] foo [..]
5533
+ " ,
5534
+ )
5535
+ . run ( ) ;
5536
+ }
5537
+
5505
5538
#[ cargo_test]
5506
5539
fn test_old_syntax_with_old_msrv ( ) {
5507
5540
let p = project ( )
You can’t perform that action at this time.
0 commit comments