Skip to content

Commit 8e8c62b

Browse files
committed
Auto merge of #8135 - ehuss:allows-dashes, r=Eh2406
Rename allows_underscores to allows_dashes. I think this better reflects what it means.
2 parents 235beb0 + 2a14979 commit 8e8c62b

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> {
305305

306306
/// Returns the bin filename for a given target, without extension and metadata.
307307
fn bin_stem(&self, unit: &Unit<'_>) -> String {
308-
if unit.target.allows_underscores() {
308+
if unit.target.allows_dashes() {
309309
unit.target.name().to_string()
310310
} else {
311311
unit.target.crate_name()

src/cargo/core/compiler/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ fn rustc<'a, 'cfg>(
193193
// don't pass the `-l` flags.
194194
let pass_l_flag = unit.target.is_lib() || !unit.pkg.targets().iter().any(|t| t.is_lib());
195195
let pass_cdylib_link_args = unit.target.is_cdylib();
196-
let do_rename = unit.target.allows_underscores() && !unit.mode.is_any_test();
196+
let do_rename = unit.target.allows_dashes() && !unit.mode.is_any_test();
197197
let real_name = unit.target.name().to_string();
198198
let crate_name = unit.target.crate_name();
199199

src/cargo/core/manifest.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,11 @@ impl Target {
792792
}
793793
}
794794

795-
pub fn allows_underscores(&self) -> bool {
795+
/// Whether or not this target allows dashes in its filename.
796+
///
797+
/// Rustc will always emit filenames with underscores, and Cargo will
798+
/// rename them back to dashes if this is true.
799+
pub fn allows_dashes(&self) -> bool {
796800
self.is_bin() || self.is_example() || self.is_custom_build()
797801
}
798802

0 commit comments

Comments
 (0)