avoid intermediate allocations in show_error macro
This commit is contained in:
parent
1164815750
commit
b99d7bc77f
@ -11,7 +11,7 @@
|
||||
|
||||
use std::{env, iter};
|
||||
|
||||
use crate::{phases::*, util::*};
|
||||
use crate::phases::*;
|
||||
|
||||
fn main() {
|
||||
// Rustc does not support non-UTF-8 arguments so we make no attempt either.
|
||||
|
@ -14,13 +14,13 @@
|
||||
|
||||
pub use crate::arg::*;
|
||||
|
||||
pub fn show_error(msg: &str) -> ! {
|
||||
pub fn show_error(msg: &impl std::fmt::Display) -> ! {
|
||||
eprintln!("fatal error: {msg}");
|
||||
std::process::exit(1)
|
||||
}
|
||||
|
||||
macro_rules! show_error {
|
||||
($($tt:tt)*) => { show_error(&format!($($tt)*)) };
|
||||
($($tt:tt)*) => { crate::util::show_error(&format_args!($($tt)*)) };
|
||||
}
|
||||
|
||||
/// The information to run a crate with the given environment.
|
||||
|
@ -152,13 +152,13 @@ fn config(&mut self, config: &mut Config) {
|
||||
}
|
||||
}
|
||||
|
||||
fn show_error(msg: &str) -> ! {
|
||||
fn show_error(msg: &impl std::fmt::Display) -> ! {
|
||||
eprintln!("fatal error: {msg}");
|
||||
std::process::exit(1)
|
||||
}
|
||||
|
||||
macro_rules! show_error {
|
||||
($($tt:tt)*) => { show_error(&format!($($tt)*)) };
|
||||
($($tt:tt)*) => { show_error(&format_args!($($tt)*)) };
|
||||
}
|
||||
|
||||
fn init_early_loggers() {
|
||||
|
Loading…
Reference in New Issue
Block a user