Skip to content

Commit

Permalink
Auto merge of #7476 - tlively:emscripten-wasm-aux, r=alexcrichton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Oct 4, 2019
2 parents 0a59a76 + c8c6839 commit 0fe1638
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/cargo/core/compiler/build_context/target_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pub struct TargetInfo {
pub enum FileFlavor {
/// Not a special file type.
Normal,
/// Like `Normal`, but not directly executable
Auxiliary,
/// Something you can link against (e.g., a library).
Linkable { rmeta: bool },
/// Piece of external debug information (e.g., `.dSYM`/`.pdb` file).
Expand Down Expand Up @@ -231,7 +233,7 @@ impl TargetInfo {
ret.push(FileType {
suffix: ".wasm".to_string(),
prefix: prefix.clone(),
flavor: FileFlavor::Normal,
flavor: FileFlavor::Auxiliary,
should_replace_hyphens: true,
})
}
Expand Down
3 changes: 2 additions & 1 deletion src/cargo/core/compiler/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ impl<'a, 'cfg> Context<'a, 'cfg> {

for unit in units.iter() {
for output in self.outputs(unit)?.iter() {
if output.flavor == FileFlavor::DebugInfo {
if output.flavor == FileFlavor::DebugInfo || output.flavor == FileFlavor::Auxiliary
{
continue;
}

Expand Down

0 comments on commit 0fe1638

Please sign in to comment.