File tree 2 files changed +40
-1
lines changed
2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -690,7 +690,17 @@ impl BuildOutput {
690
690
continue ;
691
691
}
692
692
let data = match iter. next ( ) {
693
- Some ( val) => val,
693
+ Some ( val) => {
694
+ if val. starts_with ( ":" ) {
695
+ // Line started with `cargo::`.
696
+ bail ! ( "unsupported output in {}: `{}`\n \
697
+ Found a `cargo::key=value` build directive which is reserved for future use.\n \
698
+ Either change the directive to `cargo:key=value` syntax (note the single `:`) or upgrade your version of Rust.\n \
699
+ See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
700
+ for more information about build script outputs.", whence, line) ;
701
+ }
702
+ val
703
+ }
694
704
None => continue ,
695
705
} ;
696
706
Original file line number Diff line number Diff line change @@ -5140,6 +5140,35 @@ for more information about build script outputs.
5140
5140
. run ( ) ;
5141
5141
}
5142
5142
5143
+ #[ cargo_test]
5144
+ fn wrong_syntax_with_two_colons ( ) {
5145
+ let p = project ( )
5146
+ . file ( "src/lib.rs" , "" )
5147
+ . file (
5148
+ "build.rs" ,
5149
+ r#"
5150
+ fn main() {
5151
+ println!("cargo::foo=bar");
5152
+ }
5153
+ "# ,
5154
+ )
5155
+ . build ( ) ;
5156
+
5157
+ p. cargo ( "build" )
5158
+ . with_status ( 101 )
5159
+ . with_stderr (
5160
+ "\
5161
+ [COMPILING] foo [..]
5162
+ error: unsupported output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::foo=bar`
5163
+ Found a `cargo::key=value` build directive which is reserved for future use.
5164
+ Either change the directive to `cargo:key=value` syntax (note the single `:`) or upgrade your version of Rust.
5165
+ See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5166
+ for more information about build script outputs.
5167
+ " ,
5168
+ )
5169
+ . run ( ) ;
5170
+ }
5171
+
5143
5172
#[ cargo_test]
5144
5173
fn custom_build_closes_stdin ( ) {
5145
5174
// Ensure stdin is closed to prevent deadlock.
You can’t perform that action at this time.
0 commit comments