Skip to content

Commit 3f93030

Browse files
committed
fix(embedded): Don't auto-discover build.rs files
With #12268, we moved the manifest root to be the scripts parent directory, making it so auto-discovery might pick some things up. We previously ensured `auto*` don't pick things up but missed `build.rs` This is now addressed.
1 parent 4427cfe commit 3f93030

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/cargo/util/toml/embedded.rs

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ fn expand_manifest_(
8989
));
9090
toml::Value::String(DEFAULT_EDITION.to_string())
9191
});
92+
package
93+
.entry("build".to_owned())
94+
.or_insert_with(|| toml::Value::Boolean(false));
9295
package
9396
.entry("publish".to_owned())
9497
.or_insert_with(|| toml::Value::Boolean(DEFAULT_PUBLISH));
@@ -491,6 +494,7 @@ autobenches = false
491494
autobins = false
492495
autoexamples = false
493496
autotests = false
497+
build = false
494498
edition = "2021"
495499
name = "test-"
496500
publish = false
@@ -520,6 +524,7 @@ autobenches = false
520524
autobins = false
521525
autoexamples = false
522526
autotests = false
527+
build = false
523528
edition = "2021"
524529
name = "test-"
525530
publish = false

tests/testsuite/script.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,16 @@ fn main() {
523523

524524
p.cargo("-Zscript script.rs --help")
525525
.masquerade_as_nightly_cargo(&["script"])
526-
.with_status(101)
527-
.with_stdout(r#""#)
528-
.with_stderr_contains(
526+
.with_stdout(
527+
r#"Hello world!
528+
"#,
529+
)
530+
.with_stderr(
529531
"\
530-
[ERROR] could not compile `script` (build script) due to previous error
532+
[WARNING] `package.edition` is unspecifiead, defaulting to `2021`
533+
[COMPILING] script v0.0.0 ([ROOT]/foo)
534+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
535+
[RUNNING] `[..]/debug/script[EXE] --help`
531536
",
532537
)
533538
.run();

0 commit comments

Comments
 (0)