Skip to content

Commit 44c1fcc

Browse files
committed
session: output-width -> diagnostic-width
Rename the `--output-width` flag to `--diagnostic-width` as this appears to be the preferred name within the compiler team. Signed-off-by: David Wood <[email protected]>
1 parent cd23af6 commit 44c1fcc

29 files changed

+48
-48
lines changed

compiler/rustc_errors/src/emitter.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl HumanReadableErrorType {
6363
bundle: Option<Lrc<FluentBundle>>,
6464
fallback_bundle: LazyFallbackBundle,
6565
teach: bool,
66-
output_width: Option<usize>,
66+
diagnostic_width: Option<usize>,
6767
macro_backtrace: bool,
6868
) -> EmitterWriter {
6969
let (short, color_config) = self.unzip();
@@ -76,7 +76,7 @@ impl HumanReadableErrorType {
7676
short,
7777
teach,
7878
color,
79-
output_width,
79+
diagnostic_width,
8080
macro_backtrace,
8181
)
8282
}
@@ -710,7 +710,7 @@ pub struct EmitterWriter {
710710
short_message: bool,
711711
teach: bool,
712712
ui_testing: bool,
713-
output_width: Option<usize>,
713+
diagnostic_width: Option<usize>,
714714

715715
macro_backtrace: bool,
716716
}
@@ -730,7 +730,7 @@ impl EmitterWriter {
730730
fallback_bundle: LazyFallbackBundle,
731731
short_message: bool,
732732
teach: bool,
733-
output_width: Option<usize>,
733+
diagnostic_width: Option<usize>,
734734
macro_backtrace: bool,
735735
) -> EmitterWriter {
736736
let dst = Destination::from_stderr(color_config);
@@ -742,7 +742,7 @@ impl EmitterWriter {
742742
short_message,
743743
teach,
744744
ui_testing: false,
745-
output_width,
745+
diagnostic_width,
746746
macro_backtrace,
747747
}
748748
}
@@ -755,7 +755,7 @@ impl EmitterWriter {
755755
short_message: bool,
756756
teach: bool,
757757
colored: bool,
758-
output_width: Option<usize>,
758+
diagnostic_width: Option<usize>,
759759
macro_backtrace: bool,
760760
) -> EmitterWriter {
761761
EmitterWriter {
@@ -766,7 +766,7 @@ impl EmitterWriter {
766766
short_message,
767767
teach,
768768
ui_testing: false,
769-
output_width,
769+
diagnostic_width,
770770
macro_backtrace,
771771
}
772772
}
@@ -1615,7 +1615,7 @@ impl EmitterWriter {
16151615
width_offset + annotated_file.multiline_depth + 1
16161616
};
16171617

1618-
let column_width = if let Some(width) = self.output_width {
1618+
let column_width = if let Some(width) = self.diagnostic_width {
16191619
width.saturating_sub(code_offset)
16201620
} else if self.ui_testing {
16211621
DEFAULT_COLUMN_WIDTH

compiler/rustc_errors/src/json.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub struct JsonEmitter {
4242
pretty: bool,
4343
ui_testing: bool,
4444
json_rendered: HumanReadableErrorType,
45-
output_width: Option<usize>,
45+
diagnostic_width: Option<usize>,
4646
macro_backtrace: bool,
4747
}
4848

@@ -54,7 +54,7 @@ impl JsonEmitter {
5454
fallback_bundle: LazyFallbackBundle,
5555
pretty: bool,
5656
json_rendered: HumanReadableErrorType,
57-
output_width: Option<usize>,
57+
diagnostic_width: Option<usize>,
5858
macro_backtrace: bool,
5959
) -> JsonEmitter {
6060
JsonEmitter {
@@ -66,7 +66,7 @@ impl JsonEmitter {
6666
pretty,
6767
ui_testing: false,
6868
json_rendered,
69-
output_width,
69+
diagnostic_width,
7070
macro_backtrace,
7171
}
7272
}
@@ -76,7 +76,7 @@ impl JsonEmitter {
7676
json_rendered: HumanReadableErrorType,
7777
fluent_bundle: Option<Lrc<FluentBundle>>,
7878
fallback_bundle: LazyFallbackBundle,
79-
output_width: Option<usize>,
79+
diagnostic_width: Option<usize>,
8080
macro_backtrace: bool,
8181
) -> JsonEmitter {
8282
let file_path_mapping = FilePathMapping::empty();
@@ -87,7 +87,7 @@ impl JsonEmitter {
8787
fallback_bundle,
8888
pretty,
8989
json_rendered,
90-
output_width,
90+
diagnostic_width,
9191
macro_backtrace,
9292
)
9393
}
@@ -100,7 +100,7 @@ impl JsonEmitter {
100100
fallback_bundle: LazyFallbackBundle,
101101
pretty: bool,
102102
json_rendered: HumanReadableErrorType,
103-
output_width: Option<usize>,
103+
diagnostic_width: Option<usize>,
104104
macro_backtrace: bool,
105105
) -> JsonEmitter {
106106
JsonEmitter {
@@ -112,7 +112,7 @@ impl JsonEmitter {
112112
pretty,
113113
ui_testing: false,
114114
json_rendered,
115-
output_width,
115+
diagnostic_width,
116116
macro_backtrace,
117117
}
118118
}
@@ -345,7 +345,7 @@ impl Diagnostic {
345345
je.fluent_bundle.clone(),
346346
je.fallback_bundle.clone(),
347347
false,
348-
je.output_width,
348+
je.diagnostic_width,
349349
je.macro_backtrace,
350350
)
351351
.ui_testing(je.ui_testing)

compiler/rustc_session/src/config.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ impl Default for Options {
726726
prints: Vec::new(),
727727
cg: Default::default(),
728728
error_format: ErrorOutputType::default(),
729-
output_width: None,
729+
diagnostic_width: None,
730730
externs: Externs(BTreeMap::new()),
731731
crate_name: None,
732732
libs: Vec::new(),
@@ -1430,8 +1430,8 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
14301430
),
14311431
opt::opt_s(
14321432
"",
1433-
"output-width",
1434-
"Inform rustc of the width of the output so that errors can be truncated to fit",
1433+
"diagnostic-width",
1434+
"Inform rustc of the width of the output so that diagnostics can be truncated to fit",
14351435
"WIDTH",
14361436
),
14371437
opt::multi_s(
@@ -2209,8 +2209,8 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
22092209

22102210
let error_format = parse_error_format(matches, color, json_rendered);
22112211

2212-
let output_width = matches.opt_get("output-width").unwrap_or_else(|_| {
2213-
early_error(error_format, "`--output-width` must be an positive integer");
2212+
let diagnostic_width = matches.opt_get("diagnostic-width").unwrap_or_else(|_| {
2213+
early_error(error_format, "`--diagnostic-width` must be an positive integer");
22142214
});
22152215

22162216
let unparsed_crate_types = matches.opt_strs("crate-type");
@@ -2485,7 +2485,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
24852485
prints,
24862486
cg,
24872487
error_format,
2488-
output_width,
2488+
diagnostic_width,
24892489
externs,
24902490
unstable_features: UnstableFeatures::from_environment(crate_name.as_deref()),
24912491
crate_name,

compiler/rustc_session/src/options.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ top_level_options!(
170170

171171
test: bool [TRACKED],
172172
error_format: ErrorOutputType [UNTRACKED],
173-
output_width: Option<usize> [UNTRACKED],
173+
diagnostic_width: Option<usize> [UNTRACKED],
174174

175175
/// If `Some`, enable incremental compilation, using the given
176176
/// directory to store intermediate results.
@@ -1389,7 +1389,7 @@ options! {
13891389
"panic strategy for out-of-memory handling"),
13901390
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
13911391
"pass `-install_name @rpath/...` to the macOS linker (default: no)"),
1392-
output_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
1392+
diagnostic_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
13931393
"set the current output width for diagnostic truncation"),
13941394
panic_abort_tests: bool = (false, parse_bool, [TRACKED],
13951395
"support compiling tests with panic=abort (default: no)"),

compiler/rustc_session/src/session.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ fn default_emitter(
11621162
fallback_bundle,
11631163
short,
11641164
sopts.debugging_opts.teach,
1165-
sopts.output_width,
1165+
sopts.diagnostic_width,
11661166
macro_backtrace,
11671167
),
11681168
Some(dst) => EmitterWriter::new(
@@ -1173,7 +1173,7 @@ fn default_emitter(
11731173
short,
11741174
false, // no teach messages when writing to a buffer
11751175
false, // no colors when writing to a buffer
1176-
None, // no terminal width
1176+
None, // no diagnostic width
11771177
macro_backtrace,
11781178
),
11791179
};
@@ -1188,7 +1188,7 @@ fn default_emitter(
11881188
fallback_bundle,
11891189
pretty,
11901190
json_rendered,
1191-
sopts.output_width,
1191+
sopts.diagnostic_width,
11921192
macro_backtrace,
11931193
)
11941194
.ui_testing(sopts.debugging_opts.ui_testing),
@@ -1202,7 +1202,7 @@ fn default_emitter(
12021202
fallback_bundle,
12031203
pretty,
12041204
json_rendered,
1205-
sopts.output_width,
1205+
sopts.diagnostic_width,
12061206
macro_backtrace,
12071207
)
12081208
.ui_testing(sopts.debugging_opts.ui_testing),

src/librustdoc/config.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ pub(crate) struct Options {
7373
pub(crate) proc_macro_crate: bool,
7474
/// How to format errors and warnings.
7575
pub(crate) error_format: ErrorOutputType,
76-
/// Width of terminal to truncate errors appropriately.
77-
pub(crate) output_width: Option<usize>,
76+
/// Width of output buffer to truncate errors appropriately.
77+
pub(crate) diagnostic_width: Option<usize>,
7878
/// Library search paths to hand to the compiler.
7979
pub(crate) libs: Vec<SearchPath>,
8080
/// Library search paths strings to hand to the compiler.
@@ -336,12 +336,12 @@ impl Options {
336336
let config::JsonConfig { json_rendered, json_unused_externs, .. } =
337337
config::parse_json(matches);
338338
let error_format = config::parse_error_format(matches, color, json_rendered);
339-
let output_width = matches.opt_get("output-width").unwrap_or_default();
339+
let diagnostic_width = matches.opt_get("diagnostic-width").unwrap_or_default();
340340

341341
let codegen_options = CodegenOptions::build(matches, error_format);
342342
let debugging_opts = DebuggingOptions::build(matches, error_format);
343343

344-
let diag = new_handler(error_format, None, output_width, &debugging_opts);
344+
let diag = new_handler(error_format, None, diagnostic_width, &debugging_opts);
345345

346346
// check for deprecated options
347347
check_deprecated_options(matches, &diag);
@@ -705,7 +705,7 @@ impl Options {
705705
input,
706706
proc_macro_crate,
707707
error_format,
708-
output_width,
708+
diagnostic_width,
709709
libs,
710710
lib_strs,
711711
externs,

src/librustdoc/core.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'tcx> DocContext<'tcx> {
154154
pub(crate) fn new_handler(
155155
error_format: ErrorOutputType,
156156
source_map: Option<Lrc<source_map::SourceMap>>,
157-
output_width: Option<usize>,
157+
diagnostic_width: Option<usize>,
158158
debugging_opts: &DebuggingOptions,
159159
) -> rustc_errors::Handler {
160160
let fallback_bundle =
@@ -170,7 +170,7 @@ pub(crate) fn new_handler(
170170
fallback_bundle,
171171
short,
172172
debugging_opts.teach,
173-
output_width,
173+
diagnostic_width,
174174
false,
175175
)
176176
.ui_testing(debugging_opts.ui_testing),
@@ -188,7 +188,7 @@ pub(crate) fn new_handler(
188188
fallback_bundle,
189189
pretty,
190190
json_rendered,
191-
output_width,
191+
diagnostic_width,
192192
false,
193193
)
194194
.ui_testing(debugging_opts.ui_testing),
@@ -209,7 +209,7 @@ pub(crate) fn create_config(
209209
crate_name,
210210
proc_macro_crate,
211211
error_format,
212-
output_width,
212+
diagnostic_width,
213213
libs,
214214
externs,
215215
mut cfgs,
@@ -268,7 +268,7 @@ pub(crate) fn create_config(
268268
actually_rustdoc: true,
269269
debugging_opts,
270270
error_format,
271-
output_width,
271+
diagnostic_width,
272272
edition,
273273
describe_lints,
274274
crate_name,

src/librustdoc/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@ fn opts() -> Vec<RustcOptGroup> {
462462
"human|json|short",
463463
)
464464
}),
465-
unstable("output-width", |o| {
465+
unstable("diagnostic-width", |o| {
466466
o.optopt(
467467
"",
468-
"output-width",
468+
"diagnostic-width",
469469
"Provide width of the output for truncated error messages",
470470
"WIDTH",
471471
)
@@ -744,7 +744,7 @@ fn main_options(options: config::Options) -> MainResult {
744744
let diag = core::new_handler(
745745
options.error_format,
746746
None,
747-
options.output_width,
747+
options.diagnostic_width,
748748
&options.debugging_opts,
749749
);
750750

src/test/run-make/issue-88756-default-output/output-default.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Options:
110110
never = never colorize output
111111
--error-format human|json|short
112112
How errors and other messages are produced
113-
--output-width WIDTH
113+
--diagnostic-width WIDTH
114114
Provide width of the output for truncated error
115115
messages
116116
--json CONFIG Configure the structure of JSON diagnostics

src/test/rustdoc-ui/output-width.rs renamed to src/test/rustdoc-ui/diagnostic-width.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -Zunstable-options --output-width=10
1+
// compile-flags: -Zunstable-options --diagnostic-width=10
22
#![deny(rustdoc::bare_urls)]
33

44
/// This is a long line that contains a http://link.com

src/test/rustdoc-ui/output-width.stderr renamed to src/test/rustdoc-ui/diagnostic-width.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: this URL is not a hyperlink
2-
--> $DIR/output-width.rs:4:41
2+
--> $DIR/diagnostic-width.rs:4:41
33
|
44
LL | ... a http://link.com
55
| ^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://link.com>`
66
|
77
note: the lint level is defined here
8-
--> $DIR/output-width.rs:2:9
8+
--> $DIR/diagnostic-width.rs:2:9
99
|
1010
LL | ...ny(rustdoc::bare_url...
1111
| ^^^^^^^^^^^^^^^^^^

src/test/ui/output-width/flag-human.rs renamed to src/test/ui/diagnostic-width/flag-human.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: --output-width=20
1+
// compile-flags: --diagnostic-width=20
22

33
// This test checks that `-Z output-width` effects the human error output by restricting it to an
44
// arbitrarily low value so that the effect is visible.

src/test/ui/output-width/flag-json.rs renamed to src/test/ui/diagnostic-width/flag-json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: --output-width=20 --error-format=json
1+
// compile-flags: --diagnostic-width=20 --error-format=json
22

33
// This test checks that `-Z output-width` effects the JSON error output by restricting it to an
44
// arbitrarily low value so that the effect is visible.

src/test/ui/output-width/flag-json.stderr renamed to src/test/ui/diagnostic-width/flag-json.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This error occurs when an expression was used in a place where the compiler
2424
expected an expression of a different type. It can occur in several cases, the
2525
most common being when calling a function and passing an argument which has a
2626
different type than the matching type in the function declaration.
27-
"},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":239,"byte_end":241,"line_start":7,"line_end":7,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let _: () = 42;","highlight_start":17,"highlight_end":19}],"label":"expected `()`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/flag-json.rs","byte_start":234,"byte_end":236,"line_start":7,"line_end":7,"column_start":12,"column_end":14,"is_primary":false,"text":[{"text":" let _: () = 42;","highlight_start":12,"highlight_end":14}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0308]: mismatched types
27+
"},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":243,"byte_end":245,"line_start":7,"line_end":7,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let _: () = 42;","highlight_start":17,"highlight_end":19}],"label":"expected `()`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/flag-json.rs","byte_start":238,"byte_end":240,"line_start":7,"line_end":7,"column_start":12,"column_end":14,"is_primary":false,"text":[{"text":" let _: () = 42;","highlight_start":12,"highlight_end":14}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0308]: mismatched types
2828
--> $DIR/flag-json.rs:7:17
2929
|
3030
LL | ..._: () = 42;

0 commit comments

Comments
 (0)