Rollup merge of #95635 - davidtwco:terminal-width-stabilization, r=oli-obk

sess: stabilize `--terminal-width` as `--diagnostic-width`

Formerly `-Zterminal-width`, `--terminal-width` allows the user or build
tool to inform rustc of the width of the terminal so that diagnostics
can be truncated.

Pending agreement to stabilize, see tracking issue at #84673.

r? ```@oli-obk```
This commit is contained in:
Matthias Krüger 2022-07-08 08:00:36 +02:00 committed by GitHub
commit b36e58a458
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 101 additions and 46 deletions

View file

@ -63,7 +63,7 @@ impl HumanReadableErrorType {
bundle: Option<Lrc<FluentBundle>>,
fallback_bundle: LazyFallbackBundle,
teach: bool,
terminal_width: Option<usize>,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
) -> EmitterWriter {
let (short, color_config) = self.unzip();
@ -76,7 +76,7 @@ impl HumanReadableErrorType {
short,
teach,
color,
terminal_width,
diagnostic_width,
macro_backtrace,
)
}
@ -710,7 +710,7 @@ pub struct EmitterWriter {
short_message: bool,
teach: bool,
ui_testing: bool,
terminal_width: Option<usize>,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
}
@ -730,7 +730,7 @@ impl EmitterWriter {
fallback_bundle: LazyFallbackBundle,
short_message: bool,
teach: bool,
terminal_width: Option<usize>,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
) -> EmitterWriter {
let dst = Destination::from_stderr(color_config);
@ -742,7 +742,7 @@ impl EmitterWriter {
short_message,
teach,
ui_testing: false,
terminal_width,
diagnostic_width,
macro_backtrace,
}
}
@ -755,7 +755,7 @@ impl EmitterWriter {
short_message: bool,
teach: bool,
colored: bool,
terminal_width: Option<usize>,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
) -> EmitterWriter {
EmitterWriter {
@ -766,7 +766,7 @@ impl EmitterWriter {
short_message,
teach,
ui_testing: false,
terminal_width,
diagnostic_width,
macro_backtrace,
}
}
@ -1615,7 +1615,7 @@ impl EmitterWriter {
width_offset + annotated_file.multiline_depth + 1
};
let column_width = if let Some(width) = self.terminal_width {
let column_width = if let Some(width) = self.diagnostic_width {
width.saturating_sub(code_offset)
} else if self.ui_testing {
DEFAULT_COLUMN_WIDTH

View file

@ -42,7 +42,7 @@ pub struct JsonEmitter {
pretty: bool,
ui_testing: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
}
@ -54,7 +54,7 @@ impl JsonEmitter {
fallback_bundle: LazyFallbackBundle,
pretty: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
@ -66,7 +66,7 @@ impl JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
terminal_width,
diagnostic_width,
macro_backtrace,
}
}
@ -76,7 +76,7 @@ impl JsonEmitter {
json_rendered: HumanReadableErrorType,
fluent_bundle: Option<Lrc<FluentBundle>>,
fallback_bundle: LazyFallbackBundle,
terminal_width: Option<usize>,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
let file_path_mapping = FilePathMapping::empty();
@ -87,7 +87,7 @@ impl JsonEmitter {
fallback_bundle,
pretty,
json_rendered,
terminal_width,
diagnostic_width,
macro_backtrace,
)
}
@ -100,7 +100,7 @@ impl JsonEmitter {
fallback_bundle: LazyFallbackBundle,
pretty: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
diagnostic_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
@ -112,7 +112,7 @@ impl JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
terminal_width,
diagnostic_width,
macro_backtrace,
}
}
@ -345,7 +345,7 @@ impl Diagnostic {
je.fluent_bundle.clone(),
je.fallback_bundle.clone(),
false,
je.terminal_width,
je.diagnostic_width,
je.macro_backtrace,
)
.ui_testing(je.ui_testing)