about summary refs log tree commit diff
path: root/compiler/rustc_session/src
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-06-16 16:39:11 +0100
committerDavid Wood <david.wood@huawei.com>2022-07-06 17:38:18 +0100
commitcd23af6793857f1b73ecd76764876c482f183d31 (patch)
treee44b9e998cc76df3193d7d1b43798dbae21e9ff4 /compiler/rustc_session/src
parente5288842fa158081b89ddfb34f9fb87083e00634 (diff)
downloadrust-cd23af6793857f1b73ecd76764876c482f183d31.tar.gz
rust-cd23af6793857f1b73ecd76764876c482f183d31.zip
session: `terminal-width` -> `output-width`
Rename the `--terminal-width` flag to `--output-width` as the behaviour
doesn't just apply to terminals (and so is slightly less accurate).

Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_session/src')
-rw-r--r--compiler/rustc_session/src/config.rs12
-rw-r--r--compiler/rustc_session/src/options.rs6
-rw-r--r--compiler/rustc_session/src/session.rs6
3 files changed, 12 insertions, 12 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 2650ad52879..bad9fb576bf 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -726,7 +726,7 @@ impl Default for Options {
             prints: Vec::new(),
             cg: Default::default(),
             error_format: ErrorOutputType::default(),
-            terminal_width: None,
+            output_width: None,
             externs: Externs(BTreeMap::new()),
             crate_name: None,
             libs: Vec::new(),
@@ -1430,8 +1430,8 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
         ),
         opt::opt_s(
             "",
-            "terminal-width",
-            "Inform rustc of the width of the terminal so that errors can be truncated",
+            "output-width",
+            "Inform rustc of the width of the output so that errors can be truncated to fit",
             "WIDTH",
         ),
         opt::multi_s(
@@ -2209,8 +2209,8 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
 
     let error_format = parse_error_format(matches, color, json_rendered);
 
-    let terminal_width = matches.opt_get("terminal-width").unwrap_or_else(|_| {
-        early_error(error_format, "`--terminal-width` must be an positive integer");
+    let output_width = matches.opt_get("output-width").unwrap_or_else(|_| {
+        early_error(error_format, "`--output-width` must be an positive integer");
     });
 
     let unparsed_crate_types = matches.opt_strs("crate-type");
@@ -2485,7 +2485,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
         prints,
         cg,
         error_format,
-        terminal_width,
+        output_width,
         externs,
         unstable_features: UnstableFeatures::from_environment(crate_name.as_deref()),
         crate_name,
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index 80e811bc1a7..b544965f6f2 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -170,7 +170,7 @@ top_level_options!(
 
         test: bool [TRACKED],
         error_format: ErrorOutputType [UNTRACKED],
-        terminal_width: Option<usize> [UNTRACKED],
+        output_width: Option<usize> [UNTRACKED],
 
         /// If `Some`, enable incremental compilation, using the given
         /// directory to store intermediate results.
@@ -1389,6 +1389,8 @@ options! {
         "panic strategy for out-of-memory handling"),
     osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
         "pass `-install_name @rpath/...` to the macOS linker (default: no)"),
+    output_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
+        "set the current output width for diagnostic truncation"),
     panic_abort_tests: bool = (false, parse_bool, [TRACKED],
         "support compiling tests with panic=abort (default: no)"),
     panic_in_drop: PanicStrategy = (PanicStrategy::Unwind, parse_panic_strategy, [TRACKED],
@@ -1515,8 +1517,6 @@ options! {
         "show extended diagnostic help (default: no)"),
     temps_dir: Option<String> = (None, parse_opt_string, [UNTRACKED],
         "the directory the intermediate files are written to"),
-    terminal_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
-        "set the current terminal width"),
     // Diagnostics are considered side-effects of a query (see `QuerySideEffects`) and are saved
     // alongside query results and changes to translation options can affect diagnostics - so
     // translation options should be tracked.
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index b5a72ed20c1..e22b7a5539f 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -1162,7 +1162,7 @@ fn default_emitter(
                         fallback_bundle,
                         short,
                         sopts.debugging_opts.teach,
-                        sopts.terminal_width,
+                        sopts.output_width,
                         macro_backtrace,
                     ),
                     Some(dst) => EmitterWriter::new(
@@ -1188,7 +1188,7 @@ fn default_emitter(
                 fallback_bundle,
                 pretty,
                 json_rendered,
-                sopts.terminal_width,
+                sopts.output_width,
                 macro_backtrace,
             )
             .ui_testing(sopts.debugging_opts.ui_testing),
@@ -1202,7 +1202,7 @@ fn default_emitter(
                 fallback_bundle,
                 pretty,
                 json_rendered,
-                sopts.terminal_width,
+                sopts.output_width,
                 macro_backtrace,
             )
             .ui_testing(sopts.debugging_opts.ui_testing),