Update setup.rs

This commit is contained in:
Gary 2023-06-01 21:03:42 +05:30 committed by GitHub
parent 642c92e630
commit a45fc94652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@ pub enum Profile {
Codegen, Codegen,
Library, Library,
Tools, Tools,
User, Dist,
None, None,
} }
@ -42,7 +42,7 @@ impl Profile {
pub fn all() -> impl Iterator<Item = Self> { pub fn all() -> impl Iterator<Item = Self> {
use Profile::*; use Profile::*;
// N.B. these are ordered by how they are displayed, not alphabetically // N.B. these are ordered by how they are displayed, not alphabetically
[Library, Compiler, Codegen, Tools, User, None].iter().copied() [Library, Compiler, Codegen, Tools, Dist, None].iter().copied()
} }
pub fn purpose(&self) -> String { pub fn purpose(&self) -> String {
@ -52,7 +52,7 @@ impl Profile {
Compiler => "Contribute to the compiler itself", Compiler => "Contribute to the compiler itself",
Codegen => "Contribute to the compiler, and also modify LLVM or codegen", Codegen => "Contribute to the compiler, and also modify LLVM or codegen",
Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)", Tools => "Contribute to tools which depend on the compiler, but do not modify it directly (e.g. rustdoc, clippy, miri)",
User => "Install Rust from source", Dist => "Install Rust from source",
None => "Do not modify `config.toml`" None => "Do not modify `config.toml`"
} }
.to_string() .to_string()
@ -72,7 +72,7 @@ impl Profile {
Profile::Codegen => "codegen", Profile::Codegen => "codegen",
Profile::Library => "library", Profile::Library => "library",
Profile::Tools => "tools", Profile::Tools => "tools",
Profile::User => "user", Profile::Dist => "dist",
Profile::None => "none", Profile::None => "none",
} }
} }
@ -86,7 +86,7 @@ impl FromStr for Profile {
"lib" | "library" => Ok(Profile::Library), "lib" | "library" => Ok(Profile::Library),
"compiler" => Ok(Profile::Compiler), "compiler" => Ok(Profile::Compiler),
"llvm" | "codegen" => Ok(Profile::Codegen), "llvm" | "codegen" => Ok(Profile::Codegen),
"maintainer" | "user" => Ok(Profile::User), "maintainer" | "dist" => Ok(Profile::Dist),
"tools" | "tool" | "rustdoc" | "clippy" | "miri" | "rustfmt" | "rls" => { "tools" | "tool" | "rustdoc" | "clippy" | "miri" | "rustfmt" | "rls" => {
Ok(Profile::Tools) Ok(Profile::Tools)
} }
@ -159,7 +159,7 @@ pub fn setup(config: &Config, profile: Profile) {
"test src/tools/rustfmt", "test src/tools/rustfmt",
], ],
Profile::Library => &["check", "build", "test library/std", "doc"], Profile::Library => &["check", "build", "test library/std", "doc"],
Profile::User => &["dist", "build"], Profile::Dist => &["dist", "build"],
}; };
println!(); println!();
@ -169,7 +169,7 @@ pub fn setup(config: &Config, profile: Profile) {
println!("- `x.py {}`", cmd); println!("- `x.py {}`", cmd);
} }
if profile != Profile::User { if profile != Profile::Dist {
println!( println!(
"For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html" "For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html"
); );