Skip to content

Commit f8325ac

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 f8325ac

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/cargo/util/toml/embedded.rs

Lines changed: 3 additions & 0 deletions
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));

tests/testsuite/script.rs

Lines changed: 9 additions & 4 deletions
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)