Skip to content

Commit 0fe1638

Browse files
committed
Auto merge of #7476 - tlively:emscripten-wasm-aux, r=alexcrichton
Mark Emscripten's .wasm files auxiliary This fixes #7471 and fixes #7255 by preventing the .wasm file from being treated as an executable binary, so `cargo test` and `cargo run` will no longer try to execute it directly. This change is only made for Emscripten, which outputs a .js file as the primary executable entry point, as opposed to other WebAssembly targets for which the .wasm file is the only output.
2 parents 0a59a76 + c8c6839 commit 0fe1638

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/cargo/core/compiler/build_context/target_info.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ pub struct TargetInfo {
4141
pub enum FileFlavor {
4242
/// Not a special file type.
4343
Normal,
44+
/// Like `Normal`, but not directly executable
45+
Auxiliary,
4446
/// Something you can link against (e.g., a library).
4547
Linkable { rmeta: bool },
4648
/// Piece of external debug information (e.g., `.dSYM`/`.pdb` file).
@@ -231,7 +233,7 @@ impl TargetInfo {
231233
ret.push(FileType {
232234
suffix: ".wasm".to_string(),
233235
prefix: prefix.clone(),
234-
flavor: FileFlavor::Normal,
236+
flavor: FileFlavor::Auxiliary,
235237
should_replace_hyphens: true,
236238
})
237239
}

src/cargo/core/compiler/context/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
168168

169169
for unit in units.iter() {
170170
for output in self.outputs(unit)?.iter() {
171-
if output.flavor == FileFlavor::DebugInfo {
171+
if output.flavor == FileFlavor::DebugInfo || output.flavor == FileFlavor::Auxiliary
172+
{
172173
continue;
173174
}
174175

0 commit comments

Comments
 (0)