Skip to content

Commit bc5ed2c

Browse files
committed
remove types and move the content to toml/common
1 parent a106c0b commit bc5ed2c

File tree

4 files changed

+47
-52
lines changed

4 files changed

+47
-52
lines changed

src/bootstrap/src/core/config/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ use crate::core::config::flags::Color;
2626
pub use crate::core::config::flags::Subcommand;
2727
use crate::core::config::toml::change_id::ChangeId;
2828
use crate::core::config::toml::common::{
29-
DebuginfoLevel, LlvmLibunwind, SplitDebuginfo, StringOrBool,
29+
DebuginfoLevel, DryRun, GccCiMode, LlvmLibunwind, RustcLto, SplitDebuginfo, StringOrBool,
3030
};
3131
use crate::core::config::toml::rust::{
3232
LldMode, RustOptimize, check_incompatible_options_for_ci_rustc,
3333
};
3434
use crate::core::config::toml::target::Target;
35-
use crate::core::config::types::{DryRun, GccCiMode, RustcLto};
3635
use crate::core::download::is_download_ci_available;
3736
use crate::utils::channel;
3837
use crate::{Command, Flags, GitInfo, OnceLock, TargetSelection, helpers, output, t};

src/bootstrap/src/core/config/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pub mod target_selection;
66
#[cfg(test)]
77
mod tests;
88
pub mod toml;
9-
pub mod types;
109

1110
pub use config::*;
1211
pub use target_selection::TargetSelection;
@@ -15,4 +14,3 @@ pub use toml::change_id::ChangeId;
1514
pub use toml::common::*;
1615
pub use toml::rust::LldMode;
1716
pub use toml::target::Target;
18-
pub use types::*;

src/bootstrap/src/core/config/toml/common.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,52 @@ pub enum ReplaceOpt {
143143
ErrorOnDuplicate,
144144
}
145145

146+
#[derive(Clone, Default)]
147+
pub enum DryRun {
148+
/// This isn't a dry run.
149+
#[default]
150+
Disabled,
151+
/// This is a dry run enabled by bootstrap itself, so it can verify that no work is done.
152+
SelfCheck,
153+
/// This is a dry run enabled by the `--dry-run` flag.
154+
UserSelected,
155+
}
156+
157+
/// LTO mode used for compiling rustc itself.
158+
#[derive(Default, Clone, PartialEq, Debug)]
159+
pub enum RustcLto {
160+
Off,
161+
#[default]
162+
ThinLocal,
163+
Thin,
164+
Fat,
165+
}
166+
167+
impl std::str::FromStr for RustcLto {
168+
type Err = String;
169+
170+
fn from_str(s: &str) -> Result<Self, Self::Err> {
171+
match s {
172+
"thin-local" => Ok(RustcLto::ThinLocal),
173+
"thin" => Ok(RustcLto::Thin),
174+
"fat" => Ok(RustcLto::Fat),
175+
"off" => Ok(RustcLto::Off),
176+
_ => Err(format!("Invalid value for rustc LTO: {s}")),
177+
}
178+
}
179+
}
180+
181+
/// Determines how will GCC be provided.
182+
#[derive(Default, Clone)]
183+
pub enum GccCiMode {
184+
/// Build GCC from the local `src/gcc` submodule.
185+
#[default]
186+
BuildLocally,
187+
/// Try to download GCC from CI.
188+
/// If it is not available on CI, it will be built locally instead.
189+
DownloadFromCi,
190+
}
191+
146192
pub fn set<T>(field: &mut T, val: Option<T>) {
147193
if let Some(v) = val {
148194
*field = v;

src/bootstrap/src/core/config/types.rs

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)