Skip to content

Commit 743af95

Browse files
Update a few comments.
1 parent 6766abb commit 743af95

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/bootstrap/bin/rustc.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,11 @@ fn main() {
7575
Err(_) => 0,
7676
};
7777

78-
// Build scripts always use the snapshot compiler which is guaranteed to be
79-
// able to produce an executable, whereas intermediate compilers may not
80-
// have the standard library built yet and may not be able to produce an
81-
// executable. Otherwise we just use the standard compiler we're
82-
// bootstrapping with.
83-
//
84-
// Also note that cargo will detect the version of the compiler to trigger
85-
// a rebuild when the compiler changes. If this happens, we want to make
86-
// sure to use the actual compiler instead of the snapshot compiler becase
87-
// that's the one that's actually changing.
78+
// Use a different compiler for build scripts, since there may not yet be a
79+
// libstd for the real compiler to use. However, if Cargo is attempting to
80+
// determine the version of the compiler, the real compiler needs to be
81+
// used. Currently, these two states are differentiated based on whether
82+
// --target and -vV is/isn't passed.
8883
let (rustc, libdir) = if target.is_none() && version.is_none() {
8984
("RUSTC_SNAPSHOT", "RUSTC_SNAPSHOT_LIBDIR")
9085
} else {

src/bootstrap/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ pub struct Build {
175175
lldb_python_dir: Option<String>,
176176

177177
// Runtime state filled in later on
178+
// target -> (cc, ar)
178179
cc: HashMap<String, (gcc::Tool, Option<PathBuf>)>,
180+
// host -> (cc, ar)
179181
cxx: HashMap<String, gcc::Tool>,
180182
crates: HashMap<String, Crate>,
181183
is_sudo: bool,
@@ -202,20 +204,16 @@ struct Crate {
202204
/// build system, with each mod generating output in a different directory.
203205
#[derive(Clone, Copy, PartialEq, Eq)]
204206
pub enum Mode {
205-
/// This cargo is going to build the standard library, placing output in the
206-
/// "stageN-std" directory.
207+
/// Build the standard library, placing output in the "stageN-std" directory.
207208
Libstd,
208209

209-
/// This cargo is going to build libtest, placing output in the
210-
/// "stageN-test" directory.
210+
/// Build libtest, placing output in the "stageN-test" directory.
211211
Libtest,
212212

213-
/// This cargo is going to build librustc and compiler libraries, placing
214-
/// output in the "stageN-rustc" directory.
213+
/// Build librustc and compiler libraries, placing output in the "stageN-rustc" directory.
215214
Librustc,
216215

217-
/// This cargo is going to build some tool, placing output in the
218-
/// "stageN-tools" directory.
216+
/// Build some tool, placing output in the "stageN-tools" directory.
219217
Tool,
220218
}
221219

0 commit comments

Comments
 (0)