Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't include metadata in wasm binary examples. #6812

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/context/compilation_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ fn compute_metadata<'a, 'cfg>(
if !(unit.mode.is_any_test() || unit.mode.is_check())
&& (unit.target.is_dylib()
|| unit.target.is_cdylib()
|| (unit.target.is_bin() && bcx.target_triple().starts_with("wasm32-")))
|| (unit.target.is_executable() && bcx.target_triple().starts_with("wasm32-")))
&& unit.pkg.package_id().source_id().is_path()
&& __cargo_default_lib_metadata.is_err()
{
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/core/compiler/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
unit.target.clone(),
output.path.clone(),
));
} else if unit.target.is_bin() || unit.target.is_bin_example() {
} else if unit.target.is_executable() {
self.compilation.binaries.push(bindst.clone());
}
}
Expand Down Expand Up @@ -276,7 +276,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
continue;
}

let is_binary = unit.target.is_bin() || unit.target.is_bin_example();
let is_binary = unit.target.is_executable();
let is_test = unit.mode.is_any_test() && !unit.mode.is_check();

if is_binary || is_test {
Expand Down
9 changes: 8 additions & 1 deletion src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,14 @@ impl Target {
}
}

pub fn is_bin_example(&self) -> bool {
/// Returns `true` if it is a binary or executable example.
/// NOTE: Tests are `false`!
pub fn is_executable(&self) -> bool {
self.is_bin() || self.is_exe_example()
}

/// Returns `true` if it is an executable example.
pub fn is_exe_example(&self) -> bool {
// Needed for --all-examples in contexts where only runnable examples make sense
match self.kind {
TargetKind::ExampleBin => true,
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ fn find_duplicates(
let all_examples: Vec<String> = examples.try_collect().unwrap_or_else(|| {
pkg.targets()
.iter()
.filter(|t| t.is_bin_example())
.filter(|t| t.is_exe_example())
.map(|t| t.name().to_string())
.collect()
});
Expand Down