Rollup merge of #149911 - Zalathar:no-color, r=jieyouxu

bootstrap: Don't pass an unused `--color` to compiletest

- Follow-up to https://github.com/rust-lang/rust/pull/149850

---

This flag was an artifact of compiletest's old libtest-based test executor, and currently doesn't influence compiletest's output at all.

A follow-up commit also inlines `force_coloring_in_ci` into its only remaining caller, and updates its comment.
This commit is contained in:
Jacob Pratt 2025-12-13 00:55:58 -05:00 committed by GitHub
commit aec47812cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 17 deletions

View file

@ -2401,7 +2401,6 @@ Please disable assertions with `rust.debug-assertions = false`.
let git_config = builder.config.git_config();
cmd.arg("--nightly-branch").arg(git_config.nightly_branch);
cmd.arg("--git-merge-commit-email").arg(git_config.git_merge_commit_email);
cmd.force_coloring_in_ci();
#[cfg(feature = "build-metrics")]
builder.metrics.begin_test_suite(

View file

@ -2,6 +2,8 @@ use std::env;
use std::ffi::{OsStr, OsString};
use std::path::{Path, PathBuf};
use build_helper::ci::CiEnv;
use super::{Builder, Kind};
use crate::core::build_steps::test;
use crate::core::build_steps::tool::SourceType;
@ -1334,7 +1336,13 @@ impl Builder<'_> {
// Try to use a sysroot-relative bindir, in case it was configured absolutely.
cargo.env("RUSTC_INSTALL_BINDIR", self.config.bindir_relative());
cargo.force_coloring_in_ci();
if CiEnv::is_ci() {
// Tell cargo to use colored output for nicer logs in CI, even
// though CI isn't printing to a terminal.
// Also set an explicit `TERM=xterm` so that cargo doesn't warn
// about TERM not being set.
cargo.env("TERM", "xterm").args(["--color=always"]);
};
// When we build Rust dylibs they're all intended for intermediate
// usage, so make sure we pass the -Cprefer-dynamic flag instead of

View file

@ -21,7 +21,6 @@ use std::process::{
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
use build_helper::ci::CiEnv;
use build_helper::drop_bomb::DropBomb;
use build_helper::exit;
@ -390,18 +389,6 @@ impl<'a> BootstrapCommand {
self.drop_bomb.get_created_location()
}
/// If in a CI environment, forces the command to run with colors.
pub fn force_coloring_in_ci(&mut self) {
if CiEnv::is_ci() {
// Due to use of stamp/docker, the output stream of bootstrap is not
// a TTY in CI, so coloring is by-default turned off.
// The explicit `TERM=xterm` environment is needed for
// `--color always` to actually work. This env var was lost when
// compiling through the Makefile. Very strange.
self.env("TERM", "xterm").args(["--color", "always"]);
}
}
pub fn fingerprint(&self) -> CommandFingerprint {
let command = &self.command;
CommandFingerprint {

View file

@ -136,8 +136,6 @@ fn parse_config(args: Vec<String>) -> Config {
)
.optflag("", "fail-fast", "stop as soon as possible after any test fails")
.optopt("", "target", "the target to build for", "TARGET")
// FIXME: Should be removed once `bootstrap` will be updated to not use this option.
.optopt("", "color", "coloring: auto, always, never", "WHEN")
.optopt("", "host", "the host to build for", "HOST")
.optopt("", "cdb", "path to CDB to use for CDB debuginfo tests", "PATH")
.optopt("", "gdb", "path to GDB to use for GDB debuginfo tests", "PATH")