Skip to content

Commit ebb6a36

Browse files
committed
Auto merge of #14061 - weihanglo:revert-13630, r=epage
Revert #13630 as rustc ignores `-C strip` on MSVC This reverts commit fa619a9, reversing changes made to 1f6857d. See also <rust-lang/rust#115120>.
2 parents 5f0294b + 4f002a5 commit ebb6a36

File tree

3 files changed

+1
-41
lines changed

3 files changed

+1
-41
lines changed

src/cargo/ops/cargo_compile/mod.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
//! [`drain_the_queue`]: crate::core::compiler::job_queue
3636
//! ["Cargo Target"]: https://doc.rust-lang.org/nightly/cargo/reference/cargo-targets.html
3737
38-
use cargo_platform::Cfg;
3938
use std::collections::{HashMap, HashSet};
4039
use std::hash::{Hash, Hasher};
4140
use std::sync::Arc;
@@ -439,7 +438,6 @@ pub fn create_bcx<'a, 'gctx>(
439438
&units,
440439
&scrape_units,
441440
host_kind_requested.then_some(explicit_host_kind),
442-
&target_data,
443441
);
444442

445443
let mut extra_compiler_args = HashMap::new();
@@ -579,7 +577,6 @@ fn rebuild_unit_graph_shared(
579577
roots: &[Unit],
580578
scrape_units: &[Unit],
581579
to_host: Option<CompileKind>,
582-
target_data: &RustcTargetData<'_>,
583580
) -> (Vec<Unit>, Vec<Unit>, UnitGraph) {
584581
let mut result = UnitGraph::new();
585582
// Map of the old unit to the new unit, used to avoid recursing into units
@@ -596,7 +593,6 @@ fn rebuild_unit_graph_shared(
596593
root,
597594
false,
598595
to_host,
599-
target_data,
600596
)
601597
})
602598
.collect();
@@ -623,7 +619,6 @@ fn traverse_and_share(
623619
unit: &Unit,
624620
unit_is_for_host: bool,
625621
to_host: Option<CompileKind>,
626-
target_data: &RustcTargetData<'_>,
627622
) -> Unit {
628623
if let Some(new_unit) = memo.get(unit) {
629624
// Already computed, no need to recompute.
@@ -641,7 +636,6 @@ fn traverse_and_share(
641636
&dep.unit,
642637
dep.unit_for.is_for_host(),
643638
to_host,
644-
target_data,
645639
);
646640
new_dep_unit.hash(&mut dep_hash);
647641
UnitDep {
@@ -665,13 +659,8 @@ fn traverse_and_share(
665659
_ => unit.kind,
666660
};
667661

668-
let cfg = target_data.cfg(unit.kind);
669-
let is_target_windows_msvc = cfg.contains(&Cfg::Name("windows".to_string()))
670-
&& cfg.contains(&Cfg::KeyPair("target_env".to_string(), "msvc".to_string()));
671662
let mut profile = unit.profile.clone();
672-
// For MSVC, rustc currently treats -Cstrip=debuginfo same as -Cstrip=symbols, which causes
673-
// this optimization to also remove symbols and thus break backtraces.
674-
if profile.strip.is_deferred() && !is_target_windows_msvc {
663+
if profile.strip.is_deferred() {
675664
// If strip was not manually set, and all dependencies of this unit together
676665
// with this unit have debuginfo turned off, we enable debuginfo stripping.
677666
// This will remove pre-existing debug symbols coming from the standard library.

tests/testsuite/profiles.rs

-27
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,7 @@ fn strip_accepts_false_to_disable_strip() {
634634
.run();
635635
}
636636

637-
// Temporarily disabled on Windows due to https://github.com/rust-lang/rust/issues/122857
638637
#[cargo_test]
639-
#[cfg(not(windows))]
640638
fn strip_debuginfo_in_release() {
641639
let p = project()
642640
.file(
@@ -660,32 +658,7 @@ fn strip_debuginfo_in_release() {
660658
.run();
661659
}
662660

663-
// Using -Cstrip=debuginfo in release mode by default is temporarily disabled on Windows due to
664-
// https://github.com/rust-lang/rust/issues/122857
665661
#[cargo_test]
666-
#[cfg(all(target_os = "windows", target_env = "msvc"))]
667-
fn do_not_strip_debuginfo_in_release_on_windows() {
668-
let p = project()
669-
.file(
670-
"Cargo.toml",
671-
r#"
672-
[package]
673-
name = "foo"
674-
version = "0.1.0"
675-
edition = "2015"
676-
"#,
677-
)
678-
.file("src/main.rs", "fn main() {}")
679-
.build();
680-
681-
p.cargo("build --release -v")
682-
.with_stderr_does_not_contain("[..]strip=debuginfo[..]")
683-
.run();
684-
}
685-
686-
// Temporarily disabled on Windows due to https://github.com/rust-lang/rust/issues/122857
687-
#[cargo_test]
688-
#[cfg(not(windows))]
689662
fn strip_debuginfo_without_debug() {
690663
let p = project()
691664
.file(

tests/testsuite/run.rs

-2
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,7 @@ fn one_bin_multiple_examples() {
742742
.run();
743743
}
744744

745-
// Temporarily disabled on Windows due to https://github.com/rust-lang/rust/issues/122857
746745
#[cargo_test]
747-
#[cfg(not(windows))]
748746
fn example_with_release_flag() {
749747
let p = project()
750748
.file(

0 commit comments

Comments
 (0)