Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
7 changes: 4 additions & 3 deletions src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ impl Cargo {
let mut cargo = builder.cargo(compiler, mode, source_type, target, cmd_kind);

match cmd_kind {
// No need to configure the target linker for these command types,
// as they don't invoke rustc at all.
Kind::Clean | Kind::Suggest | Kind::Format | Kind::Setup => {}
// No need to configure the target linker for these command types.
Kind::Clean | Kind::Check | Kind::Suggest | Kind::Format | Kind::Setup => {}
_ => {
cargo.configure_linker(builder);
}
Expand Down Expand Up @@ -205,6 +204,8 @@ impl Cargo {
self
}

// FIXME(onur-ozkan): Add coverage to make sure modifications to this function
// doesn't cause cache invalidations (e.g., #130108).
fn configure_linker(&mut self, builder: &Builder<'_>) -> &mut Cargo {
let target = self.target;
let compiler = self.compiler;
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/utils/cc_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub fn find(build: &Build) {
let targets: HashSet<_> = match build.config.cmd {
// We don't need to check cross targets for these commands.
crate::Subcommand::Clean { .. }
| crate::Subcommand::Check { .. }
| crate::Subcommand::Suggest { .. }
| crate::Subcommand::Format { .. }
| crate::Subcommand::Setup { .. } => {
Expand Down
12 changes: 6 additions & 6 deletions src/bootstrap/src/utils/cc_detect/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fn test_language_clang() {

#[test]
fn test_new_cc_build() {
let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
let build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
let target = TargetSelection::from_user("x86_64-unknown-linux-gnu");
let cfg = new_cc_build(&build, target.clone());
let compiler = cfg.get_compiler();
Expand All @@ -190,7 +190,7 @@ fn test_new_cc_build() {

#[test]
fn test_default_compiler_wasi() {
let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
let build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
let target = TargetSelection::from_user("wasm32-wasi");
let wasi_sdk = PathBuf::from("/wasi-sdk");
// SAFETY: bootstrap tests run on a single thread
Expand All @@ -215,7 +215,7 @@ fn test_default_compiler_wasi() {

#[test]
fn test_default_compiler_fallback() {
let build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
let build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
let target = TargetSelection::from_user("x86_64-unknown-linux-gnu");
let mut cfg = cc::Build::new();
let result = default_compiler(&mut cfg, Language::C, target, &build);
Expand All @@ -224,7 +224,7 @@ fn test_default_compiler_fallback() {

#[test]
fn test_find_target_with_config() {
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
let target = TargetSelection::from_user("x86_64-unknown-linux-gnu");
let mut target_config = Target::default();
target_config.cc = Some(PathBuf::from("dummy-cc"));
Expand All @@ -249,7 +249,7 @@ fn test_find_target_with_config() {

#[test]
fn test_find_target_without_config() {
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
let target = TargetSelection::from_user("x86_64-unknown-linux-gnu");
build.config.target_config.clear();
find_target(&build, target.clone());
Expand All @@ -262,7 +262,7 @@ fn test_find_target_without_config() {

#[test]
fn test_find() {
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["check".to_owned()])) });
let mut build = Build::new(Config { ..Config::parse(Flags::parse(&["build".to_owned()])) });
let target1 = TargetSelection::from_user("x86_64-unknown-linux-gnu");
let target2 = TargetSelection::from_user("x86_64-unknown-openbsd");
build.targets.push(target1.clone());
Expand Down
Loading