Skip to content

Commit 173a7db

Browse files
committed
Use early_error
1 parent 8ad1a1c commit 173a7db

File tree

1 file changed

+12
-5
lines changed
  • compiler/rustc_driver/src

1 file changed

+12
-5
lines changed

compiler/rustc_driver/src/lib.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -1288,12 +1288,19 @@ pub fn init_env_logger(env: &str) {
12881288
"always" => true,
12891289
"never" => false,
12901290
"auto" => stdout_isatty(),
1291-
_ => panic!("invalid log color value '{}': expected one of always, never, or auto", value),
1291+
_ => early_error(
1292+
ErrorOutputType::default(),
1293+
&format!(
1294+
"invalid log color value '{}': expected one of always, never, or auto",
1295+
value
1296+
),
1297+
),
12921298
},
12931299
Err(std::env::VarError::NotPresent) => stdout_isatty(),
1294-
Err(std::env::VarError::NotUnicode(_value)) => {
1295-
panic!("non-unicode log color value: expected one of always, never, or auto")
1296-
}
1300+
Err(std::env::VarError::NotUnicode(_value)) => early_error(
1301+
ErrorOutputType::default(),
1302+
"non-Unicode log color value: expected one of always, never, or auto",
1303+
),
12971304
};
12981305
let filter = tracing_subscriber::EnvFilter::from_env(env);
12991306
let layer = tracing_tree::HierarchicalLayer::default()
@@ -1324,7 +1331,7 @@ pub fn main() -> ! {
13241331
arg.into_string().unwrap_or_else(|arg| {
13251332
early_error(
13261333
ErrorOutputType::default(),
1327-
&format!("Argument {} is not valid Unicode: {:?}", i, arg),
1334+
&format!("argument {} is not valid Unicode: {:?}", i, arg),
13281335
)
13291336
})
13301337
})

0 commit comments

Comments
 (0)