Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when cargo build is used to build the compiler #120475

Merged
merged 1 commit into from
Jan 30, 2024
Merged
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
16 changes: 16 additions & 0 deletions compiler/rustc_macros/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");
if !std::env::var("RUSTC_BOOTSTRAP").is_ok() {
eprintln!(
"error: you are attempting to build the compiler without going through bootstrap"
);
eprintln!(
"help: see https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html for how to build the compiler"
);
eprintln!(
"help: if you know what you're doing, set the RUSTC_BOOTSTRAP environment variable to any value"
);
panic!("wrong command used for building");
}
}
Loading