From 3ee43259ac9ddb7d5e050e9c7e65c848550045da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Tue, 12 Mar 2024 02:12:28 +0100 Subject: [PATCH 1/6] Link `std` statically in `rustc_driver` --- compiler/rustc/src/main.rs | 3 ++ .../rustc_metadata/src/dependency_format.rs | 36 +++++++++++++++---- src/bootstrap/src/bin/rustc.rs | 20 +++++++++-- src/bootstrap/src/core/build_steps/compile.rs | 7 +++- src/bootstrap/src/core/builder.rs | 2 +- src/tools/clippy/src/main.rs | 3 ++ src/tools/clippy/tests/compile-test.rs | 3 ++ src/tools/rustdoc/main.rs | 3 ++ src/tools/rustfmt/src/git-rustfmt/main.rs | 4 +++ 9 files changed, 70 insertions(+), 11 deletions(-) diff --git a/compiler/rustc/src/main.rs b/compiler/rustc/src/main.rs index 29766fc9d87..e9a7397557e 100644 --- a/compiler/rustc/src/main.rs +++ b/compiler/rustc/src/main.rs @@ -1,3 +1,6 @@ +// We need this feature as it changes `dylib` linking behavior and allows us to link to `rustc_driver`. +#![feature(rustc_private)] + // A note about jemalloc: rustc uses jemalloc when built for CI and // distribution. The obvious way to do this is with the `#[global_allocator]` // mechanism. However, for complicated reasons (see diff --git a/compiler/rustc_metadata/src/dependency_format.rs b/compiler/rustc_metadata/src/dependency_format.rs index 17fd260fd79..95b1a40d892 100644 --- a/compiler/rustc_metadata/src/dependency_format.rs +++ b/compiler/rustc_metadata/src/dependency_format.rs @@ -51,7 +51,7 @@ //! Additionally, the algorithm is geared towards finding *any* solution rather //! than finding a number of solutions (there are normally quite a few). -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def_id::CrateNum; use rustc_middle::bug; use rustc_middle::middle::dependency_format::{Dependencies, DependencyList, Linkage}; @@ -160,18 +160,43 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList { Linkage::Dynamic | Linkage::IncludedFromDylib => {} } + let all_dylibs = || { + tcx.crates(()).iter().filter(|&&cnum| { + !tcx.dep_kind(cnum).macros_only() && tcx.used_crate_source(cnum).dylib.is_some() + }) + }; + + let mut upstream_in_dylibs = FxHashSet::default(); + + if tcx.features().rustc_private { + // We need this to prevent users of `rustc_driver` from linking dynamically to `std` + // which does not work as `std` is also statically linked into `rustc_driver`. + + // Find all libraries statically linked to upstream dylibs. + for &cnum in all_dylibs() { + let deps = tcx.dylib_dependency_formats(cnum); + for &(depnum, style) in deps.iter() { + if let RequireStatic = style { + upstream_in_dylibs.insert(depnum); + } + } + } + } + let mut formats = FxHashMap::default(); // Sweep all crates for found dylibs. Add all dylibs, as well as their // dependencies, ensuring there are no conflicts. The only valid case for a // dependency to be relied upon twice is for both cases to rely on a dylib. - for &cnum in tcx.crates(()).iter() { - if tcx.dep_kind(cnum).macros_only() { + for &cnum in all_dylibs() { + if upstream_in_dylibs.contains(&cnum) { + info!("skipping dylib: {}", tcx.crate_name(cnum)); + // If this dylib is also available statically linked to another dylib + // we try to use that instead. continue; } + let name = tcx.crate_name(cnum); - let src = tcx.used_crate_source(cnum); - if src.dylib.is_some() { info!("adding dylib: {}", name); add_library(tcx, cnum, RequireDynamic, &mut formats, &mut unavailable_as_static); let deps = tcx.dylib_dependency_formats(cnum); @@ -180,7 +205,6 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList { add_library(tcx, depnum, style, &mut formats, &mut unavailable_as_static); } } - } // Collect what we've got so far in the return vector. let last_crate = tcx.crates(()).len(); diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs index 011c289d932..f3198338dc3 100644 --- a/src/bootstrap/src/bin/rustc.rs +++ b/src/bootstrap/src/bin/rustc.rs @@ -89,6 +89,23 @@ fn main() { rustc_real }; + // Get the name of the crate we're compiling, if any. + let crate_name = parse_value_from_args(&orig_args, "--crate-name"); + + // We want everything statically linked into `rustc_driver`, so remove `-C prefer-dynamic` + if crate_name == Some("rustc_driver") && stage != "0" { + // Remove `-C prefer-dynamic` to link `std` statically into `rustc_driver` + if let Some(pos) = args.iter().enumerate().position(|(i, a)| { + a == "-C" && args.get(i + 1).map(|a| a == "prefer-dynamic").unwrap_or(false) + }) { + args.remove(pos); + args.remove(pos); + } + if let Some(pos) = args.iter().position(|a| a == "-Cprefer-dynamic") { + args.remove(pos); + } + } + let mut cmd = match env::var_os("RUSTC_WRAPPER_REAL") { Some(wrapper) if !wrapper.is_empty() => { let mut cmd = Command::new(wrapper); @@ -99,9 +116,6 @@ fn main() { }; cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap()); - // Get the name of the crate we're compiling, if any. - let crate_name = parse_value_from_args(&orig_args, "--crate-name"); - if let Some(crate_name) = crate_name { if let Some(target) = env::var_os("RUSTC_TIME") { if target == "all" diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index c09180e542f..76006bfe0e5 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1836,7 +1836,12 @@ fn run(self, builder: &Builder<'_>) -> Compiler { let src_libdir = builder.sysroot_libdir(build_compiler, host); for f in builder.read_dir(&src_libdir) { let filename = f.file_name().into_string().unwrap(); - if (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename) + let can_be_rustc_dep = filename.starts_with("rustc_driver-") + || filename.starts_with("librustc_driver-") + || build_compiler.stage == 0; + if can_be_rustc_dep + && (is_dylib(&filename) || is_debug_info(&filename)) + && !proc_macros.contains(&filename) { builder.copy_link(&f.path(), &rustc_libdir.join(&filename)); } diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 84c23c059e9..41837c0eb89 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -2162,7 +2162,7 @@ fn cargo( // When we build Rust dylibs they're all intended for intermediate // usage, so make sure we pass the -Cprefer-dynamic flag instead of // linking all deps statically into the dylib. - if matches!(mode, Mode::Std | Mode::Rustc) { + if matches!(mode, Mode::Std) { rustflags.arg("-Cprefer-dynamic"); } diff --git a/src/tools/clippy/src/main.rs b/src/tools/clippy/src/main.rs index c9af2138a72..c9853e53f3b 100644 --- a/src/tools/clippy/src/main.rs +++ b/src/tools/clippy/src/main.rs @@ -1,3 +1,6 @@ +// We need this feature as it changes `dylib` linking behavior and allows us to link to +// `rustc_driver`. +#![feature(rustc_private)] // warn on lints, that are included in `rust-lang/rust`s bootstrap #![warn(rust_2018_idioms, unused_lifetimes)] diff --git a/src/tools/clippy/tests/compile-test.rs b/src/tools/clippy/tests/compile-test.rs index c7080e5dcdc..64253514fbe 100644 --- a/src/tools/clippy/tests/compile-test.rs +++ b/src/tools/clippy/tests/compile-test.rs @@ -1,3 +1,6 @@ +// We need this feature as it changes `dylib` linking behavior and allows us to link to +// `rustc_driver`. +#![feature(rustc_private)] #![warn(rust_2018_idioms, unused_lifetimes)] #![allow(unused_extern_crates)] diff --git a/src/tools/rustdoc/main.rs b/src/tools/rustdoc/main.rs index 5b499a1fa1f..d4099cafe5d 100644 --- a/src/tools/rustdoc/main.rs +++ b/src/tools/rustdoc/main.rs @@ -1,3 +1,6 @@ +// We need this feature as it changes `dylib` linking behavior and allows us to link to `rustc_driver`. +#![feature(rustc_private)] + fn main() { rustdoc::main() } diff --git a/src/tools/rustfmt/src/git-rustfmt/main.rs b/src/tools/rustfmt/src/git-rustfmt/main.rs index 3059d917c6b..5674f40bef9 100644 --- a/src/tools/rustfmt/src/git-rustfmt/main.rs +++ b/src/tools/rustfmt/src/git-rustfmt/main.rs @@ -1,3 +1,7 @@ +// We need this feature as it changes `dylib` linking behavior and allows us to link to +// `rustc_driver`. +#![feature(rustc_private)] + #[macro_use] extern crate tracing; From 736a249954aedaff9b3562f073e295d6c4c6d94d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Fri, 22 Mar 2024 11:42:53 +0100 Subject: [PATCH 2/6] Ask the user to use `feature(rustc_private)` when linking to `rustc_driver` --- compiler/rustc_metadata/messages.ftl | 3 +++ .../rustc_metadata/src/dependency_format.rs | 21 ++++++++++++------- compiler/rustc_metadata/src/errors.rs | 6 ++++++ compiler/rustc_span/src/symbol.rs | 1 + 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_metadata/messages.ftl b/compiler/rustc_metadata/messages.ftl index 415399ed06c..24fe1ebc07e 100644 --- a/compiler/rustc_metadata/messages.ftl +++ b/compiler/rustc_metadata/messages.ftl @@ -41,6 +41,9 @@ metadata_crate_dep_multiple = metadata_crate_dep_not_static = `{$crate_name}` was unavailable as a static crate, preventing fully static linking +metadata_crate_dep_rustc_driver = + `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library + metadata_crate_location_unknown_type = extern location for {$crate_name} is of an unknown type: {$path} diff --git a/compiler/rustc_metadata/src/dependency_format.rs b/compiler/rustc_metadata/src/dependency_format.rs index 95b1a40d892..39fa23766b5 100644 --- a/compiler/rustc_metadata/src/dependency_format.rs +++ b/compiler/rustc_metadata/src/dependency_format.rs @@ -59,12 +59,14 @@ use rustc_session::config::CrateType; use rustc_session::cstore::CrateDepKind; use rustc_session::cstore::LinkagePreference::{self, RequireDynamic, RequireStatic}; +use rustc_span::sym; use tracing::info; use crate::creader::CStore; use crate::errors::{ BadPanicStrategy, CrateDepMultiple, IncompatiblePanicInDropStrategy, LibRequired, - NonStaticCrateDep, RequiredPanicStrategy, RlibRequired, RustcLibRequired, TwoPanicRuntimes, + NonStaticCrateDep, RequiredPanicStrategy, RlibRequired, RustcDriverHelp, RustcLibRequired, + TwoPanicRuntimes, }; pub(crate) fn calculate(tcx: TyCtxt<'_>) -> Dependencies { @@ -197,14 +199,14 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList { } let name = tcx.crate_name(cnum); - info!("adding dylib: {}", name); - add_library(tcx, cnum, RequireDynamic, &mut formats, &mut unavailable_as_static); - let deps = tcx.dylib_dependency_formats(cnum); - for &(depnum, style) in deps.iter() { - info!("adding {:?}: {}", style, tcx.crate_name(depnum)); - add_library(tcx, depnum, style, &mut formats, &mut unavailable_as_static); - } + info!("adding dylib: {}", name); + add_library(tcx, cnum, RequireDynamic, &mut formats, &mut unavailable_as_static); + let deps = tcx.dylib_dependency_formats(cnum); + for &(depnum, style) in deps.iter() { + info!("adding {:?}: {}", style, tcx.crate_name(depnum)); + add_library(tcx, depnum, style, &mut formats, &mut unavailable_as_static); } + } // Collect what we've got so far in the return vector. let last_crate = tcx.crates(()).len(); @@ -292,12 +294,15 @@ fn add_library( // This error is probably a little obscure, but I imagine that it // can be refined over time. if link2 != link || link == RequireStatic { + let linking_to_rustc_driver = tcx.sess.psess.unstable_features.is_nightly_build() + && tcx.crates(()).iter().any(|&cnum| tcx.crate_name(cnum) == sym::rustc_driver); tcx.dcx().emit_err(CrateDepMultiple { crate_name: tcx.crate_name(cnum), non_static_deps: unavailable_as_static .drain(..) .map(|cnum| NonStaticCrateDep { crate_name: tcx.crate_name(cnum) }) .collect(), + rustc_driver_help: linking_to_rustc_driver.then_some(RustcDriverHelp), }); } } diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs index 89970dddf9f..42dec978b78 100644 --- a/compiler/rustc_metadata/src/errors.rs +++ b/compiler/rustc_metadata/src/errors.rs @@ -38,6 +38,8 @@ pub struct CrateDepMultiple { pub crate_name: Symbol, #[subdiagnostic] pub non_static_deps: Vec, + #[subdiagnostic] + pub rustc_driver_help: Option, } #[derive(Subdiagnostic)] @@ -46,6 +48,10 @@ pub struct NonStaticCrateDep { pub crate_name: Symbol, } +#[derive(Subdiagnostic)] +#[help(metadata_crate_dep_rustc_driver)] +pub struct RustcDriverHelp; + #[derive(Diagnostic)] #[diag(metadata_two_panic_runtimes)] pub struct TwoPanicRuntimes { diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 32fca6733bb..9cb729ec485 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1619,6 +1619,7 @@ rustc_dirty, rustc_do_not_const_check, rustc_doc_primitive, + rustc_driver, rustc_dummy, rustc_dump_def_parents, rustc_dump_item_bounds, From 486864f23593d7aedddf1831f748660311f9ff3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 10 Aug 2024 08:11:22 +0200 Subject: [PATCH 3/6] Don't statically link `std` into `rustc_driver` for `windows-gnu` --- src/bootstrap/src/bin/rustc.rs | 8 +++++--- src/bootstrap/src/core/build_steps/compile.rs | 12 +++++++++++- src/bootstrap/src/core/builder.rs | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs index f3198338dc3..d04e2fbeb78 100644 --- a/src/bootstrap/src/bin/rustc.rs +++ b/src/bootstrap/src/bin/rustc.rs @@ -92,9 +92,11 @@ fn main() { // Get the name of the crate we're compiling, if any. let crate_name = parse_value_from_args(&orig_args, "--crate-name"); - // We want everything statically linked into `rustc_driver`, so remove `-C prefer-dynamic` - if crate_name == Some("rustc_driver") && stage != "0" { - // Remove `-C prefer-dynamic` to link `std` statically into `rustc_driver` + // When statically linking `std` into `rustc_driver`, remove `-C prefer-dynamic` + if env::var("RUSTC_LINK_STD_INTO_RUSTC_DRIVER").unwrap() == "1" + && crate_name == Some("rustc_driver") + && stage != "0" + { if let Some(pos) = args.iter().enumerate().position(|(i, a)| { a == "-C" && args.get(i + 1).map(|a| a == "prefer-dynamic").unwrap_or(false) }) { diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 76006bfe0e5..2e521ff7544 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1830,15 +1830,25 @@ fn run(self, builder: &Builder<'_>) -> Compiler { }) .collect::>(); + let link_std_into_rustc_driver = builder.link_std_into_rustc_driver(target_compiler.host); let sysroot = builder.sysroot(target_compiler); let rustc_libdir = builder.rustc_libdir(target_compiler); t!(fs::create_dir_all(&rustc_libdir)); let src_libdir = builder.sysroot_libdir(build_compiler, host); for f in builder.read_dir(&src_libdir) { let filename = f.file_name().into_string().unwrap(); + + // For the later stages which gets distributed only copy over the + // `rustc_driver` library so we don't end up with an extra copy of `std`. + // If we're not statically linking `std` into `rustc_driver`, just copy every library + // to ensure `std` is included. + // We still need `std` for the initial stage as the bootstrap compiler may not + // have the new `rustc_private` linking behavior. let can_be_rustc_dep = filename.starts_with("rustc_driver-") || filename.starts_with("librustc_driver-") - || build_compiler.stage == 0; + || build_compiler.stage == 0 + || !link_std_into_rustc_driver; + if can_be_rustc_dep && (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename) diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 41837c0eb89..ccdeb442af4 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -1106,6 +1106,12 @@ fn run_step_descriptions(&self, v: &[StepDescription], paths: &[PathBuf]) { StepDescription::run(v, self, paths); } + /// Returns if `std` should be statically linked into `rustc_driver`. + /// It's currently not done on `windows-gnu` due to linker bugs. + pub fn link_std_into_rustc_driver(&self, target: TargetSelection) -> bool { + !target.triple.ends_with("-windows-gnu") + } + /// Obtain a compiler at a given stage and for a given host (i.e., this is the target that the /// compiler will run on, *not* the target it will build code for). Explicitly does not take /// `Compiler` since all `Compiler` instances are meant to be obtained through this function, @@ -2165,6 +2171,14 @@ fn cargo( if matches!(mode, Mode::Std) { rustflags.arg("-Cprefer-dynamic"); } + if matches!(mode, Mode::Rustc) && !self.link_std_into_rustc_driver(target) { + rustflags.arg("-Cprefer-dynamic"); + } + + cargo.env( + "RUSTC_LINK_STD_INTO_RUSTC_DRIVER", + if self.link_std_into_rustc_driver(target) { "1" } else { "0" }, + ); // When building incrementally we default to a lower ThinLTO import limit // (unless explicitly specified otherwise). This will produce a somewhat From 56beb1d744cf5d5b6ab9e802efdf716e15b088f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 10 Aug 2024 08:29:12 +0200 Subject: [PATCH 4/6] Update the unstable book --- .../src/language-features/rustc-private.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/rustc-private.md diff --git a/src/doc/unstable-book/src/language-features/rustc-private.md b/src/doc/unstable-book/src/language-features/rustc-private.md new file mode 100644 index 00000000000..97fce5980e4 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/rustc-private.md @@ -0,0 +1,11 @@ +# `rustc_private` + +The tracking issue for this feature is: [#27812] + +[#27812]: https://github.com/rust-lang/rust/issues/27812 + +------------------------ + +This feature allows access to unstable internal compiler crates. + +Additionally it changes the linking behavior of crates which have this feature enabled. It will prevent linking to a dylib if there's a static variant of it already statically linked into another dylib dependency. This is required to successfully link to `rustc_driver`. From dd3f7578ee52af74de732f8a8e6dc5d02b284daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 10 Aug 2024 23:56:43 +0200 Subject: [PATCH 5/6] Exclude just `std` from rustc deps --- src/bootstrap/src/core/build_steps/compile.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 2e521ff7544..db0aa1ecff1 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1838,17 +1838,13 @@ fn run(self, builder: &Builder<'_>) -> Compiler { for f in builder.read_dir(&src_libdir) { let filename = f.file_name().into_string().unwrap(); - // For the later stages which gets distributed only copy over the - // `rustc_driver` library so we don't end up with an extra copy of `std`. - // If we're not statically linking `std` into `rustc_driver`, just copy every library - // to ensure `std` is included. + // For the later stages which gets distributed avoid copying `std` if we're + // statically linking `std` into `rustc_driver`. // We still need `std` for the initial stage as the bootstrap compiler may not // have the new `rustc_private` linking behavior. - let can_be_rustc_dep = filename.starts_with("rustc_driver-") - || filename.starts_with("librustc_driver-") - || build_compiler.stage == 0 - || !link_std_into_rustc_driver; - + let is_std = filename.starts_with("std-") || filename.starts_with("libstd-"); + let can_be_rustc_dep = + !is_std || !link_std_into_rustc_driver || build_compiler.stage == 0; // cfg(bootstrap) if can_be_rustc_dep && (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename) From b22253c45489716a27164b3584a580140afa6967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 11 Aug 2024 05:43:32 +0200 Subject: [PATCH 6/6] Keep rustc's std copy --- src/bootstrap/src/core/build_steps/compile.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index db0aa1ecff1..c09180e542f 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1830,24 +1830,13 @@ fn run(self, builder: &Builder<'_>) -> Compiler { }) .collect::>(); - let link_std_into_rustc_driver = builder.link_std_into_rustc_driver(target_compiler.host); let sysroot = builder.sysroot(target_compiler); let rustc_libdir = builder.rustc_libdir(target_compiler); t!(fs::create_dir_all(&rustc_libdir)); let src_libdir = builder.sysroot_libdir(build_compiler, host); for f in builder.read_dir(&src_libdir) { let filename = f.file_name().into_string().unwrap(); - - // For the later stages which gets distributed avoid copying `std` if we're - // statically linking `std` into `rustc_driver`. - // We still need `std` for the initial stage as the bootstrap compiler may not - // have the new `rustc_private` linking behavior. - let is_std = filename.starts_with("std-") || filename.starts_with("libstd-"); - let can_be_rustc_dep = - !is_std || !link_std_into_rustc_driver || build_compiler.stage == 0; // cfg(bootstrap) - if can_be_rustc_dep - && (is_dylib(&filename) || is_debug_info(&filename)) - && !proc_macros.contains(&filename) + if (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename) { builder.copy_link(&f.path(), &rustc_libdir.join(&filename)); }