diff --git a/src/bootstrap/src/cli_main.rs b/src/bootstrap/src/cli_main.rs index 59f3c1a1e5e1c..c11e1478f4d42 100644 --- a/src/bootstrap/src/cli_main.rs +++ b/src/bootstrap/src/cli_main.rs @@ -14,8 +14,8 @@ use std::time::Instant; use std::{env, process}; use crate::core::builder::StepStack; -use crate::core::config::flags::Flags; -use crate::core::config::{ChangeId, Config, Subcommand}; +use crate::core::config::flags::{Flags, Subcommand}; +use crate::core::config::{ChangeId, Config}; use crate::utils::change_tracker::{ CONFIG_CHANGE_HISTORY, find_recent_config_change_ids, human_readable_changes, }; diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index 82b7a11d0183c..ff16a814c456d 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -16,7 +16,8 @@ use crate::core::builder::{ self, Alias, Builder, Cargo, CommandLineStep, Kind, RunConfig, ShouldRun, Step, StepMetadata, crate_description, }; -use crate::core::config::{Subcommand, TargetSelection}; +use crate::core::config::TargetSelection; +use crate::core::config::flags::Subcommand; use crate::utils::build_stamp::{self, BuildStamp}; use crate::utils::helpers::t; use crate::{CodegenBackendKind, Compiler, Mode}; diff --git a/src/bootstrap/src/core/build_steps/clean.rs b/src/bootstrap/src/core/build_steps/clean.rs index 57a5ccdeadfac..b7dae28c42ab3 100644 --- a/src/bootstrap/src/core/build_steps/clean.rs +++ b/src/bootstrap/src/core/build_steps/clean.rs @@ -12,7 +12,7 @@ use std::path::Path; use crate::core::builder::{ Builder, CommandLineStep, Kind, RunConfig, ShouldRun, crate_description, }; -use crate::core::config::Subcommand; +use crate::core::config::flags::Subcommand; use crate::utils::build_stamp::BuildStamp; use crate::utils::helpers::t; use crate::{Build, Compiler, Mode}; diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs index e3b550b603359..0d5dd410a57c6 100644 --- a/src/bootstrap/src/core/build_steps/clippy.rs +++ b/src/bootstrap/src/core/build_steps/clippy.rs @@ -18,11 +18,12 @@ use crate::core::build_steps::check::{CompilerForCheck, prepare_compiler_for_che use crate::core::build_steps::compile::{ ArtifactKeepMode, run_cargo, rustc_cargo, std_cargo, std_crates_for_make_run, }; -use crate::core::builder; use crate::core::builder::{ - Alias, Builder, CommandLineStep, Kind, RunConfig, ShouldRun, StepMetadata, crate_description, + self, Alias, Builder, CommandLineStep, Kind, RunConfig, ShouldRun, StepMetadata, + crate_description, }; -use crate::core::config::{Subcommand, TargetSelection}; +use crate::core::config::TargetSelection; +use crate::core::config::flags::Subcommand; use crate::utils::build_stamp::{self, BuildStamp}; use crate::utils::helpers; use crate::{Compiler, Mode}; diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index 8894a7d257de1..21f1395351a80 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -16,12 +16,12 @@ use crate::core::build_steps::tool::{ self, RustcPrivateCompilers, SourceType, Tool, prepare_tool_cargo, }; use crate::core::builder::{ - self, Builder, CommandLineStep, Compiler, Kind, RunConfig, ShouldRun, Step, StepMetadata, + self, Builder, CommandLineStep, Kind, RunConfig, ShouldRun, Step, StepMetadata, crate_description, }; use crate::core::config::{Config, TargetSelection}; use crate::utils::helpers::{submodule_path_of, symlink_dir, t, up_to_date}; -use crate::{FileType, Mode}; +use crate::{Compiler, FileType, Mode}; macro_rules! book { ($($name:ident, $path:expr, $book_name:expr, $lang:expr ;)+) => { diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 762bf0a271704..8fa1ce956c3ca 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -31,8 +31,8 @@ use crate::core::build_steps::tool::{ use crate::core::build_steps::toolstate::ToolState; use crate::core::build_steps::{compile, dist, llvm}; use crate::core::builder::{ - self, Alias, Builder, CommandLineStep, Compiler, Kind, RunConfig, ShouldRun, Step, - StepMetadata, crate_description, + self, Alias, Builder, CommandLineStep, Kind, RunConfig, ShouldRun, Step, StepMetadata, + crate_description, }; use crate::core::config::TargetSelection; use crate::core::config::flags::{Subcommand, get_completion, top_level_help}; @@ -45,7 +45,7 @@ use crate::utils::helpers::{ up_to_date, }; use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests}; -use crate::{CLang, CodegenBackendKind, GitRepo, Mode, TestTarget, envify}; +use crate::{CLang, CodegenBackendKind, Compiler, GitRepo, Mode, TestTarget, envify}; mod compiletest; pub mod failed_tests; diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index cd4e40a58ffc3..1ae2f69ccfe84 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -12,7 +12,8 @@ use crate::utils::build_stamp; use crate::utils::exec::{BootstrapCommand, command}; use crate::utils::helpers::{self, LldThreads, check_cfg_arg, linker_flags, t}; use crate::{ - CLang, Compiler, EXTRA_CHECK_CFGS, GitRepo, Mode, RemapScheme, prepare_behaviour_dump_dir, + CLang, Compiler, EXTRA_CHECK_CFGS, GitRepo, Mode, RemapScheme, envify, + prepare_behaviour_dump_dir, }; /// Represents flag values in `String` form with a `\x1f` delimiter to pass to the compiler later. @@ -349,7 +350,7 @@ impl Cargo { // any fingerprint difference between host==target versus cross-compiled targets // when it comes to those host build artifacts. if let Some(host_linker) = builder.linker(compiler.host) { - let host = crate::envify(&compiler.host.triple); + let host = envify(&compiler.host.triple); self.command.env(format!("CARGO_TARGET_{host}_LINKER"), host_linker); } for arg in linker_flags(builder, compiler.host, LldThreads::Yes) { @@ -357,7 +358,7 @@ impl Cargo { } if let Some(target_linker) = builder.linker(target) { - let target = crate::envify(&target.triple); + let target = envify(&target.triple); self.command.env(format!("CARGO_TARGET_{target}_LINKER"), target_linker); } // We want to set -Clinker using Cargo, therefore we only call `linker_flags` and not diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index c21322740fa61..e941e26e43efb 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -14,7 +14,6 @@ use clap::ValueEnum; use tracing::instrument; pub use self::cargo::{Cargo, apply_pgo, cargo_profile_var}; -pub use crate::Compiler; use crate::core::build_steps::compile::{Std, StdLink, looks_like_codegen_backend}; use crate::core::build_steps::tool::RustcPrivateCompilers; use crate::core::build_steps::{ @@ -29,7 +28,7 @@ use crate::utils::cache::Cache; use crate::utils::exec::{BootstrapCommand, ExecutionContext, command}; use crate::utils::helpers::{self, LldThreads, add_dylib_path, exe, libdir, linker_args, t}; use crate::utils::tracing::format_location; -use crate::{Build, Crate, trace}; +use crate::{Build, Compiler, Crate, trace}; mod cargo; mod cli_paths; diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 20319e4f400f3..f4d8db99aaf69 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -32,8 +32,7 @@ use crate::CodegenBackendKind; use crate::core::build_steps::llvm; use crate::core::build_steps::llvm::LLVM_INVALIDATION_PATHS; use crate::core::build_steps::test::failed_tests::collect_previously_failed_tests; -pub use crate::core::config::flags::Subcommand; -use crate::core::config::flags::{Color, Flags, Warnings}; +use crate::core::config::flags::{Color, Flags, Subcommand, Warnings}; use crate::core::config::macros::check_ci_llvm; use crate::core::config::target_selection::TargetSelectionList; use crate::core::config::toml::TomlConfig; diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs index ad0859727c8fc..2c5a4b22e3c89 100644 --- a/src/bootstrap/src/core/config/tests.rs +++ b/src/bootstrap/src/core/config/tests.rs @@ -14,6 +14,7 @@ use super::toml::rust::parse_codegen_backends; use super::{Config, DebuggerPath, RUSTC_IF_UNCHANGED_ALLOWED_PATHS}; use crate::core::build_steps::clippy::{LintConfig, get_clippy_rules_in_order}; use crate::core::build_steps::llvm::LLVM_INVALIDATION_PATHS; +use crate::core::config::flags::Subcommand; use crate::core::config::{ BootstrapOverrideLld, ChangeId, CompilerBuiltins, Target, TargetSelection, }; @@ -287,7 +288,7 @@ fn order_of_clippy_rules() { let config = TestCtx::new().config(&args[0]).args(&args[1..]).create_config(); let actual = match config.cmd.clone() { - crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => { + Subcommand::Clippy { allow, deny, warn, forbid, .. } => { let cfg = LintConfig { allow, deny, warn, forbid }; let args_vec: Vec = args.iter().map(|s| s.to_string()).collect(); get_clippy_rules_in_order(&args_vec, &cfg) @@ -311,7 +312,7 @@ fn clippy_rule_separate_prefix() { let config = TestCtx::new().config(&args[0]).args(&args[1..]).create_config(); let actual = match config.cmd.clone() { - crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => { + Subcommand::Clippy { allow, deny, warn, forbid, .. } => { let cfg = LintConfig { allow, deny, warn, forbid }; let args_vec: Vec = args.iter().map(|s| s.to_string()).collect(); get_clippy_rules_in_order(&args_vec, &cfg) diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index 0256aabe54edb..e9996b16708d1 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -17,7 +17,8 @@ use std::{env, fs}; use crate::Build; use crate::core::build_steps::tool; use crate::core::builder::Builder; -use crate::core::config::{CompilerBuiltins, DebuggerPath, Subcommand, Target}; +use crate::core::config::flags::Subcommand; +use crate::core::config::{CompilerBuiltins, DebuggerPath, Target}; use crate::utils::exec::command; use crate::utils::helpers::{self, t}; diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index eb68daa0cf074..116099ee3972f 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -30,14 +30,13 @@ use std::time::{Instant, SystemTime}; use std::{env, fs, io, str}; use build_helper::ci::gha; -use cc::Tool; use termcolor::{ColorChoice, StandardStream, WriteColor}; #[cfg(feature = "tracing")] use tracing::{instrument, span}; use crate::core::build_steps::format::InternalRustfmt; use crate::core::build_steps::vendor::VENDOR_DIR; -use crate::core::builder::{self, Kind}; +use crate::core::builder::{Builder, Kind}; use crate::core::config::flags::{self, Subcommand}; use crate::core::config::{BootstrapOverrideLld, Config, DryRun, LlvmLibunwind, TargetSelection}; use crate::utils::build_stamp::BuildStamp; @@ -597,7 +596,7 @@ impl Build { } build.do_if_verbose(|| println!("finding compilers")); - utils::cc_detect::fill_compilers(&mut build); + crate::utils::cc_detect::fill_compilers(&mut build); // When running `setup`, the profile is about to change, so any requirements we have now may // be different on the next invocation. Don't check for them until the next time x.py is // run. This is ok because `setup` never runs any build commands, so it won't fail if commands are missing. @@ -752,12 +751,12 @@ impl Build { match &self.config.cmd { Subcommand::Format { check, all } => { - let builder = builder::Builder::new(self); + let builder = Builder::new(self); let rustfmt_path = builder.ensure(InternalRustfmt).unwrap_or_else(|| { eprintln!("fmt error: `x fmt` is not supported on this channel"); helpers::exit_process(1); }); - return core::build_steps::format::format( + return crate::core::build_steps::format::format( &builder, rustfmt_path, *check, @@ -766,7 +765,7 @@ impl Build { ); } Subcommand::Perf(args) => { - return core::build_steps::perf::perf(&builder::Builder::new(self), args); + return crate::core::build_steps::perf::perf(&Builder::new(self), args); } _cmd => { debug!(cmd = ?_cmd, "not a hardcoded subcommand; returning to normal handling"); @@ -787,7 +786,7 @@ impl Build { let _sanity_check_span = span!(tracing::Level::DEBUG, "(1) executing dry-run sanity-check").entered(); self.config.set_dry_run(DryRun::SelfCheck); - let builder = builder::Builder::new(self); + let builder = Builder::new(self); builder.execute_cli(); } @@ -797,14 +796,14 @@ impl Build { let _actual_run_span = span!(tracing::Level::DEBUG, "(2) executing actual run").entered(); self.config.set_dry_run(DryRun::Disabled); - let builder = builder::Builder::new(self); + let builder = Builder::new(self); builder.execute_cli(); } } else { #[cfg(feature = "tracing")] let _dry_run_span = span!(tracing::Level::DEBUG, "executing dry run").entered(); - let builder = builder::Builder::new(self); + let builder = Builder::new(self); builder.execute_cli(); } @@ -1207,12 +1206,12 @@ impl Build { } /// Returns the internal `cc::Tool` for the C compiler. - fn cc_tool(&self, target: TargetSelection) -> Tool { + fn cc_tool(&self, target: TargetSelection) -> cc::Tool { self.cc[&target].clone() } /// Returns the internal `cc::Tool` for the C++ compiler. - fn cxx_tool(&self, target: TargetSelection) -> Tool { + fn cxx_tool(&self, target: TargetSelection) -> cc::Tool { self.cxx[&target].clone() } diff --git a/src/bootstrap/src/utils/build_stamp/tests.rs b/src/bootstrap/src/utils/build_stamp/tests.rs index ae70c6085e7fb..6ca1c8bd4f1f5 100644 --- a/src/bootstrap/src/utils/build_stamp/tests.rs +++ b/src/bootstrap/src/utils/build_stamp/tests.rs @@ -1,6 +1,6 @@ use tempfile::TempDir; -use crate::BuildStamp; +use crate::utils::build_stamp::BuildStamp; #[test] #[should_panic(expected = "prefix can not start or end with '.'")] diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index 5a3fac5afeadf..977b4a31eadc4 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -25,7 +25,8 @@ use std::collections::HashSet; use std::iter; use std::path::{Path, PathBuf}; -use crate::core::config::{CompressDebuginfo, Subcommand, TargetSelection}; +use crate::core::config::flags::Subcommand; +use crate::core::config::{CompressDebuginfo, TargetSelection}; use crate::utils::exec::{BootstrapCommand, command}; use crate::{Build, CLang, GitRepo}; diff --git a/src/bootstrap/src/utils/step_graph.rs b/src/bootstrap/src/utils/step_graph.rs index d6a2d89482ee4..92f14f3fba805 100644 --- a/src/bootstrap/src/utils/step_graph.rs +++ b/src/bootstrap/src/utils/step_graph.rs @@ -5,7 +5,7 @@ use std::panic::Location; use std::path::Path; use crate::core::builder::{AnyDebug, Step, pretty_step_name}; -use crate::t; +use crate::utils::helpers::t; use crate::utils::tracing::format_location; /// Records the executed steps and their dependencies in a directed graph, diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs index 87e975e8dfad9..41ad6b022ac18 100644 --- a/src/bootstrap/src/utils/tarball.rs +++ b/src/bootstrap/src/utils/tarball.rs @@ -11,9 +11,9 @@ use crate::FileType; use crate::core::build_steps::dist::distdir; use crate::core::builder::{Builder, Kind}; use crate::core::config::BUILDER_CONFIG_FILENAME; +use crate::utils::channel; use crate::utils::exec::BootstrapCommand; -use crate::utils::helpers::{move_file, t}; -use crate::utils::{channel, helpers}; +use crate::utils::helpers::{self, move_file, t}; #[derive(Copy, Clone)] pub(crate) enum OverlayKind { diff --git a/src/bootstrap/src/utils/tracing.rs b/src/bootstrap/src/utils/tracing.rs index 9ab1ca23ee5a8..a614ee865571a 100644 --- a/src/bootstrap/src/utils/tracing.rs +++ b/src/bootstrap/src/utils/tracing.rs @@ -74,7 +74,7 @@ pub fn format_location(location: std::panic::Location<'static>) -> String { const COMMAND_SPAN_TARGET: &str = "COMMAND"; #[cfg(feature = "tracing")] -pub fn trace_cmd(command: &crate::BootstrapCommand) -> tracing::span::EnteredSpan { +pub fn trace_cmd(command: &crate::utils::exec::BootstrapCommand) -> tracing::span::EnteredSpan { let fingerprint = command.fingerprint(); let location = command.get_created_location(); let location = format_location(location);