Skip to content

Commit cb5d8c8

Browse files
committed
Add config file for tools enabling stage1 downloads by default
Otherwise no one will be able to find the setting.
1 parent c8915ee commit cb5d8c8

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

config.toml.example

+6
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,12 @@ changelog-seen = 2
554554
# as generics will be preserved in symbols (rather than erased into opaque T).
555555
#new-symbol-mangling = false
556556

557+
# Download the stage 1 compiler from CI, rather than building it from source.
558+
# If you are not on a master commit, this will download the most recent commit
559+
# that made it to master. This will always rebuild if you have local
560+
# modifications to `compiler/` since the most recent commit.
561+
#download_stage1 = false
562+
557563
# =============================================================================
558564
# Options for specific targets
559565
#
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# These defaults are meant for contributors to tools which build on the
2+
# compiler, but do not modify it directly.
3+
[rust]
4+
# This enables `RUSTC_LOG=debug`, avoiding confusing situations
5+
# where adding `debug!()` appears to do nothing.
6+
# However, it makes running the compiler slightly slower.
7+
debug-logging = true
8+
# This greatly increases the speed of rebuilds, especially when there are only minor changes. However, it makes the initial build slightly slower.
9+
incremental = true
10+
# This avoids recompiling rustc if you haven't changed it
11+
download_stage1 = true
12+
13+
[llvm]
14+
# Will download LLVM from CI if available on your platform (Linux only for now)
15+
# https://github.com/rust-lang/rust/issues/77084 tracks support for more platforms
16+
download-ci-llvm = "if-available"

src/bootstrap/setup.rs

+17-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub enum Profile {
1313
Compiler,
1414
Codegen,
1515
Library,
16+
Tools,
1617
User,
1718
}
1819

@@ -24,15 +25,16 @@ impl Profile {
2425
pub fn all() -> impl Iterator<Item = Self> {
2526
use Profile::*;
2627
// N.B. these are ordered by how they are displayed, not alphabetically
27-
[Library, Compiler, Codegen, User].iter().copied()
28+
[Library, Compiler, Codegen, Tools, User].iter().copied()
2829
}
2930

3031
pub fn purpose(&self) -> String {
3132
use Profile::*;
3233
match self {
3334
Library => "Contribute to the standard library",
34-
Compiler => "Contribute to the compiler or rustdoc",
35+
Compiler => "Contribute to the compiler itself",
3536
Codegen => "Contribute to the compiler, and also modify LLVM or codegen",
37+
Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)",
3638
User => "Install Rust from source",
3739
}
3840
.to_string()
@@ -53,9 +55,12 @@ impl FromStr for Profile {
5355
fn from_str(s: &str) -> Result<Self, Self::Err> {
5456
match s {
5557
"lib" | "library" => Ok(Profile::Library),
56-
"compiler" | "rustdoc" => Ok(Profile::Compiler),
58+
"compiler" => Ok(Profile::Compiler),
5759
"llvm" | "codegen" => Ok(Profile::Codegen),
5860
"maintainer" | "user" => Ok(Profile::User),
61+
"tools" | "tool" | "rustdoc" | "clippy" | "miri" | "rustfmt" | "rls" => {
62+
Ok(Profile::Tools)
63+
}
5964
_ => Err(format!("unknown profile: '{}'", s)),
6065
}
6166
}
@@ -68,6 +73,7 @@ impl fmt::Display for Profile {
6873
Profile::Codegen => write!(f, "codegen"),
6974
Profile::Library => write!(f, "library"),
7075
Profile::User => write!(f, "user"),
76+
Profile::Tools => write!(f, "tools"),
7177
}
7278
}
7379
}
@@ -103,6 +109,14 @@ pub fn setup(src_path: &Path, profile: Profile) {
103109

104110
let suggestions = match profile {
105111
Profile::Codegen | Profile::Compiler => &["check", "build", "test"][..],
112+
Profile::Tools => &[
113+
"check",
114+
"build",
115+
"test src/test/rustdoc*",
116+
"test src/tools/clippy",
117+
"test src/tools/miri",
118+
"test src/tools/rustfmt",
119+
],
106120
Profile::Library => &["check", "build", "test library/std", "doc"],
107121
Profile::User => &["dist", "build"],
108122
};

0 commit comments

Comments
 (0)