From cd23af6793857f1b73ecd76764876c482f183d31 Mon Sep 17 00:00:00 2001 From: David Wood Date: Thu, 16 Jun 2022 16:39:11 +0100 Subject: 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 --- compiler/rustc_errors/src/emitter.rs | 16 ++++++++-------- compiler/rustc_errors/src/json.rs | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 6d74e9a9f2b..802cd1a1655 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -63,7 +63,7 @@ impl HumanReadableErrorType { bundle: Option>, fallback_bundle: LazyFallbackBundle, teach: bool, - terminal_width: Option, + output_width: Option, macro_backtrace: bool, ) -> EmitterWriter { let (short, color_config) = self.unzip(); @@ -76,7 +76,7 @@ impl HumanReadableErrorType { short, teach, color, - terminal_width, + output_width, macro_backtrace, ) } @@ -710,7 +710,7 @@ pub struct EmitterWriter { short_message: bool, teach: bool, ui_testing: bool, - terminal_width: Option, + output_width: Option, macro_backtrace: bool, } @@ -730,7 +730,7 @@ impl EmitterWriter { fallback_bundle: LazyFallbackBundle, short_message: bool, teach: bool, - terminal_width: Option, + output_width: Option, 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, + output_width, macro_backtrace, } } @@ -755,7 +755,7 @@ impl EmitterWriter { short_message: bool, teach: bool, colored: bool, - terminal_width: Option, + output_width: Option, macro_backtrace: bool, ) -> EmitterWriter { EmitterWriter { @@ -766,7 +766,7 @@ impl EmitterWriter { short_message, teach, ui_testing: false, - terminal_width, + output_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.output_width { width.saturating_sub(code_offset) } else if self.ui_testing { DEFAULT_COLUMN_WIDTH diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index d4d1491c169..1e87e70922b 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -42,7 +42,7 @@ pub struct JsonEmitter { pretty: bool, ui_testing: bool, json_rendered: HumanReadableErrorType, - terminal_width: Option, + output_width: Option, macro_backtrace: bool, } @@ -54,7 +54,7 @@ impl JsonEmitter { fallback_bundle: LazyFallbackBundle, pretty: bool, json_rendered: HumanReadableErrorType, - terminal_width: Option, + output_width: Option, macro_backtrace: bool, ) -> JsonEmitter { JsonEmitter { @@ -66,7 +66,7 @@ impl JsonEmitter { pretty, ui_testing: false, json_rendered, - terminal_width, + output_width, macro_backtrace, } } @@ -76,7 +76,7 @@ impl JsonEmitter { json_rendered: HumanReadableErrorType, fluent_bundle: Option>, fallback_bundle: LazyFallbackBundle, - terminal_width: Option, + output_width: Option, macro_backtrace: bool, ) -> JsonEmitter { let file_path_mapping = FilePathMapping::empty(); @@ -87,7 +87,7 @@ impl JsonEmitter { fallback_bundle, pretty, json_rendered, - terminal_width, + output_width, macro_backtrace, ) } @@ -100,7 +100,7 @@ impl JsonEmitter { fallback_bundle: LazyFallbackBundle, pretty: bool, json_rendered: HumanReadableErrorType, - terminal_width: Option, + output_width: Option, macro_backtrace: bool, ) -> JsonEmitter { JsonEmitter { @@ -112,7 +112,7 @@ impl JsonEmitter { pretty, ui_testing: false, json_rendered, - terminal_width, + output_width, macro_backtrace, } } @@ -345,7 +345,7 @@ impl Diagnostic { je.fluent_bundle.clone(), je.fallback_bundle.clone(), false, - je.terminal_width, + je.output_width, je.macro_backtrace, ) .ui_testing(je.ui_testing) -- cgit 1.4.1-3-g733a5 From 44c1fcc04dad7c59d1af5c7759afd121951e195c Mon Sep 17 00:00:00 2001 From: David Wood Date: Wed, 6 Jul 2022 11:57:41 +0100 Subject: 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 --- compiler/rustc_errors/src/emitter.rs | 16 ++++----- compiler/rustc_errors/src/json.rs | 16 ++++----- compiler/rustc_session/src/config.rs | 12 +++---- compiler/rustc_session/src/options.rs | 4 +-- compiler/rustc_session/src/session.rs | 8 ++--- src/librustdoc/config.rs | 10 +++--- src/librustdoc/core.rs | 10 +++--- src/librustdoc/lib.rs | 6 ++-- .../output-default.stdout | 2 +- src/test/rustdoc-ui/diagnostic-width.rs | 5 +++ src/test/rustdoc-ui/diagnostic-width.stderr | 15 ++++++++ src/test/rustdoc-ui/output-width.rs | 5 --- src/test/rustdoc-ui/output-width.stderr | 15 -------- src/test/ui/diagnostic-width/flag-human.rs | 9 +++++ src/test/ui/diagnostic-width/flag-human.stderr | 11 ++++++ src/test/ui/diagnostic-width/flag-json.rs | 9 +++++ src/test/ui/diagnostic-width/flag-json.stderr | 40 ++++++++++++++++++++++ .../non-1-width-unicode-multiline-label.rs | 7 ++++ .../non-1-width-unicode-multiline-label.stderr | 18 ++++++++++ .../diagnostic-width/non-whitespace-trimming-2.rs | 6 ++++ .../non-whitespace-trimming-2.stderr | 11 ++++++ .../non-whitespace-trimming-unicode.rs | 6 ++++ .../non-whitespace-trimming-unicode.stderr | 11 ++++++ .../ui/diagnostic-width/non-whitespace-trimming.rs | 6 ++++ .../non-whitespace-trimming.stderr | 11 ++++++ src/test/ui/diagnostic-width/tabs-trimming.rs | 13 +++++++ src/test/ui/diagnostic-width/tabs-trimming.stderr | 12 +++++++ .../ui/diagnostic-width/whitespace-trimming-2.rs | 8 +++++ .../diagnostic-width/whitespace-trimming-2.stderr | 11 ++++++ .../ui/diagnostic-width/whitespace-trimming.rs | 6 ++++ .../ui/diagnostic-width/whitespace-trimming.stderr | 11 ++++++ src/test/ui/output-width/flag-human.rs | 9 ----- src/test/ui/output-width/flag-human.stderr | 11 ------ src/test/ui/output-width/flag-json.rs | 9 ----- src/test/ui/output-width/flag-json.stderr | 40 ---------------------- .../non-1-width-unicode-multiline-label.rs | 7 ---- .../non-1-width-unicode-multiline-label.stderr | 18 ---------- .../ui/output-width/non-whitespace-trimming-2.rs | 6 ---- .../output-width/non-whitespace-trimming-2.stderr | 11 ------ .../non-whitespace-trimming-unicode.rs | 6 ---- .../non-whitespace-trimming-unicode.stderr | 11 ------ .../ui/output-width/non-whitespace-trimming.rs | 6 ---- .../ui/output-width/non-whitespace-trimming.stderr | 11 ------ src/test/ui/output-width/tabs-trimming.rs | 13 ------- src/test/ui/output-width/tabs-trimming.stderr | 12 ------- src/test/ui/output-width/whitespace-trimming-2.rs | 8 ----- .../ui/output-width/whitespace-trimming-2.stderr | 11 ------ src/test/ui/output-width/whitespace-trimming.rs | 6 ---- .../ui/output-width/whitespace-trimming.stderr | 11 ------ 49 files changed, 268 insertions(+), 268 deletions(-) create mode 100644 src/test/rustdoc-ui/diagnostic-width.rs create mode 100644 src/test/rustdoc-ui/diagnostic-width.stderr delete mode 100644 src/test/rustdoc-ui/output-width.rs delete mode 100644 src/test/rustdoc-ui/output-width.stderr create mode 100644 src/test/ui/diagnostic-width/flag-human.rs create mode 100644 src/test/ui/diagnostic-width/flag-human.stderr create mode 100644 src/test/ui/diagnostic-width/flag-json.rs create mode 100644 src/test/ui/diagnostic-width/flag-json.stderr create mode 100644 src/test/ui/diagnostic-width/non-1-width-unicode-multiline-label.rs create mode 100644 src/test/ui/diagnostic-width/non-1-width-unicode-multiline-label.stderr create mode 100644 src/test/ui/diagnostic-width/non-whitespace-trimming-2.rs create mode 100644 src/test/ui/diagnostic-width/non-whitespace-trimming-2.stderr create mode 100644 src/test/ui/diagnostic-width/non-whitespace-trimming-unicode.rs create mode 100644 src/test/ui/diagnostic-width/non-whitespace-trimming-unicode.stderr create mode 100644 src/test/ui/diagnostic-width/non-whitespace-trimming.rs create mode 100644 src/test/ui/diagnostic-width/non-whitespace-trimming.stderr create mode 100644 src/test/ui/diagnostic-width/tabs-trimming.rs create mode 100644 src/test/ui/diagnostic-width/tabs-trimming.stderr create mode 100644 src/test/ui/diagnostic-width/whitespace-trimming-2.rs create mode 100644 src/test/ui/diagnostic-width/whitespace-trimming-2.stderr create mode 100644 src/test/ui/diagnostic-width/whitespace-trimming.rs create mode 100644 src/test/ui/diagnostic-width/whitespace-trimming.stderr delete mode 100644 src/test/ui/output-width/flag-human.rs delete mode 100644 src/test/ui/output-width/flag-human.stderr delete mode 100644 src/test/ui/output-width/flag-json.rs delete mode 100644 src/test/ui/output-width/flag-json.stderr delete mode 100644 src/test/ui/output-width/non-1-width-unicode-multiline-label.rs delete mode 100644 src/test/ui/output-width/non-1-width-unicode-multiline-label.stderr delete mode 100644 src/test/ui/output-width/non-whitespace-trimming-2.rs delete mode 100644 src/test/ui/output-width/non-whitespace-trimming-2.stderr delete mode 100644 src/test/ui/output-width/non-whitespace-trimming-unicode.rs delete mode 100644 src/test/ui/output-width/non-whitespace-trimming-unicode.stderr delete mode 100644 src/test/ui/output-width/non-whitespace-trimming.rs delete mode 100644 src/test/ui/output-width/non-whitespace-trimming.stderr delete mode 100644 src/test/ui/output-width/tabs-trimming.rs delete mode 100644 src/test/ui/output-width/tabs-trimming.stderr delete mode 100644 src/test/ui/output-width/whitespace-trimming-2.rs delete mode 100644 src/test/ui/output-width/whitespace-trimming-2.stderr delete mode 100644 src/test/ui/output-width/whitespace-trimming.rs delete mode 100644 src/test/ui/output-width/whitespace-trimming.stderr (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 802cd1a1655..85ea8eb3937 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -63,7 +63,7 @@ impl HumanReadableErrorType { bundle: Option>, fallback_bundle: LazyFallbackBundle, teach: bool, - output_width: Option, + diagnostic_width: Option, macro_backtrace: bool, ) -> EmitterWriter { let (short, color_config) = self.unzip(); @@ -76,7 +76,7 @@ impl HumanReadableErrorType { short, teach, color, - output_width, + diagnostic_width, macro_backtrace, ) } @@ -710,7 +710,7 @@ pub struct EmitterWriter { short_message: bool, teach: bool, ui_testing: bool, - output_width: Option, + diagnostic_width: Option, macro_backtrace: bool, } @@ -730,7 +730,7 @@ impl EmitterWriter { fallback_bundle: LazyFallbackBundle, short_message: bool, teach: bool, - output_width: Option, + diagnostic_width: Option, macro_backtrace: bool, ) -> EmitterWriter { let dst = Destination::from_stderr(color_config); @@ -742,7 +742,7 @@ impl EmitterWriter { short_message, teach, ui_testing: false, - output_width, + diagnostic_width, macro_backtrace, } } @@ -755,7 +755,7 @@ impl EmitterWriter { short_message: bool, teach: bool, colored: bool, - output_width: Option, + diagnostic_width: Option, macro_backtrace: bool, ) -> EmitterWriter { EmitterWriter { @@ -766,7 +766,7 @@ impl EmitterWriter { short_message, teach, ui_testing: false, - output_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.output_width { + let column_width = if let Some(width) = self.diagnostic_width { width.saturating_sub(code_offset) } else if self.ui_testing { DEFAULT_COLUMN_WIDTH diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 1e87e70922b..b8cd334b4c6 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -42,7 +42,7 @@ pub struct JsonEmitter { pretty: bool, ui_testing: bool, json_rendered: HumanReadableErrorType, - output_width: Option, + diagnostic_width: Option, macro_backtrace: bool, } @@ -54,7 +54,7 @@ impl JsonEmitter { fallback_bundle: LazyFallbackBundle, pretty: bool, json_rendered: HumanReadableErrorType, - output_width: Option, + diagnostic_width: Option, macro_backtrace: bool, ) -> JsonEmitter { JsonEmitter { @@ -66,7 +66,7 @@ impl JsonEmitter { pretty, ui_testing: false, json_rendered, - output_width, + diagnostic_width, macro_backtrace, } } @@ -76,7 +76,7 @@ impl JsonEmitter { json_rendered: HumanReadableErrorType, fluent_bundle: Option>, fallback_bundle: LazyFallbackBundle, - output_width: Option, + diagnostic_width: Option, macro_backtrace: bool, ) -> JsonEmitter { let file_path_mapping = FilePathMapping::empty(); @@ -87,7 +87,7 @@ impl JsonEmitter { fallback_bundle, pretty, json_rendered, - output_width, + diagnostic_width, macro_backtrace, ) } @@ -100,7 +100,7 @@ impl JsonEmitter { fallback_bundle: LazyFallbackBundle, pretty: bool, json_rendered: HumanReadableErrorType, - output_width: Option, + diagnostic_width: Option, macro_backtrace: bool, ) -> JsonEmitter { JsonEmitter { @@ -112,7 +112,7 @@ impl JsonEmitter { pretty, ui_testing: false, json_rendered, - output_width, + diagnostic_width, macro_backtrace, } } @@ -345,7 +345,7 @@ impl Diagnostic { je.fluent_bundle.clone(), je.fallback_bundle.clone(), false, - je.output_width, + je.diagnostic_width, je.macro_backtrace, ) .ui_testing(je.ui_testing) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index bad9fb576bf..b7da0f22942 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(), - output_width: None, + diagnostic_width: None, externs: Externs(BTreeMap::new()), crate_name: None, libs: Vec::new(), @@ -1430,8 +1430,8 @@ pub fn rustc_optgroups() -> Vec { ), opt::opt_s( "", - "output-width", - "Inform rustc of the width of the output so that errors can be truncated to fit", + "diagnostic-width", + "Inform rustc of the width of the output so that diagnostics 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 output_width = matches.opt_get("output-width").unwrap_or_else(|_| { - early_error(error_format, "`--output-width` must be an positive integer"); + let diagnostic_width = matches.opt_get("diagnostic-width").unwrap_or_else(|_| { + early_error(error_format, "`--diagnostic-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, - output_width, + diagnostic_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 b544965f6f2..b0c74ffb6dc 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], - output_width: Option [UNTRACKED], + diagnostic_width: Option [UNTRACKED], /// If `Some`, enable incremental compilation, using the given /// directory to store intermediate results. @@ -1389,7 +1389,7 @@ 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 = (None, parse_opt_number, [UNTRACKED], + diagnostic_width: Option = (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)"), diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index e22b7a5539f..52b9ee94718 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.output_width, + sopts.diagnostic_width, macro_backtrace, ), Some(dst) => EmitterWriter::new( @@ -1173,7 +1173,7 @@ fn default_emitter( short, false, // no teach messages when writing to a buffer false, // no colors when writing to a buffer - None, // no terminal width + None, // no diagnostic width macro_backtrace, ), }; @@ -1188,7 +1188,7 @@ fn default_emitter( fallback_bundle, pretty, json_rendered, - sopts.output_width, + sopts.diagnostic_width, macro_backtrace, ) .ui_testing(sopts.debugging_opts.ui_testing), @@ -1202,7 +1202,7 @@ fn default_emitter( fallback_bundle, pretty, json_rendered, - sopts.output_width, + sopts.diagnostic_width, macro_backtrace, ) .ui_testing(sopts.debugging_opts.ui_testing), diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 0285f15dd76..f0b54cb444d 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -73,8 +73,8 @@ pub(crate) struct Options { pub(crate) proc_macro_crate: bool, /// How to format errors and warnings. pub(crate) error_format: ErrorOutputType, - /// Width of terminal to truncate errors appropriately. - pub(crate) output_width: Option, + /// Width of output buffer to truncate errors appropriately. + pub(crate) diagnostic_width: Option, /// Library search paths to hand to the compiler. pub(crate) libs: Vec, /// Library search paths strings to hand to the compiler. @@ -336,12 +336,12 @@ impl Options { let config::JsonConfig { json_rendered, json_unused_externs, .. } = config::parse_json(matches); let error_format = config::parse_error_format(matches, color, json_rendered); - let output_width = matches.opt_get("output-width").unwrap_or_default(); + let diagnostic_width = matches.opt_get("diagnostic-width").unwrap_or_default(); let codegen_options = CodegenOptions::build(matches, error_format); let debugging_opts = DebuggingOptions::build(matches, error_format); - let diag = new_handler(error_format, None, output_width, &debugging_opts); + let diag = new_handler(error_format, None, diagnostic_width, &debugging_opts); // check for deprecated options check_deprecated_options(matches, &diag); @@ -705,7 +705,7 @@ impl Options { input, proc_macro_crate, error_format, - output_width, + diagnostic_width, libs, lib_strs, externs, diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index d85e9d974db..8c494ee28cc 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -154,7 +154,7 @@ impl<'tcx> DocContext<'tcx> { pub(crate) fn new_handler( error_format: ErrorOutputType, source_map: Option>, - output_width: Option, + diagnostic_width: Option, debugging_opts: &DebuggingOptions, ) -> rustc_errors::Handler { let fallback_bundle = @@ -170,7 +170,7 @@ pub(crate) fn new_handler( fallback_bundle, short, debugging_opts.teach, - output_width, + diagnostic_width, false, ) .ui_testing(debugging_opts.ui_testing), @@ -188,7 +188,7 @@ pub(crate) fn new_handler( fallback_bundle, pretty, json_rendered, - output_width, + diagnostic_width, false, ) .ui_testing(debugging_opts.ui_testing), @@ -209,7 +209,7 @@ pub(crate) fn create_config( crate_name, proc_macro_crate, error_format, - output_width, + diagnostic_width, libs, externs, mut cfgs, @@ -268,7 +268,7 @@ pub(crate) fn create_config( actually_rustdoc: true, debugging_opts, error_format, - output_width, + diagnostic_width, edition, describe_lints, crate_name, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index b0be3502bae..0d3ec7ecb64 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -462,10 +462,10 @@ fn opts() -> Vec { "human|json|short", ) }), - unstable("output-width", |o| { + unstable("diagnostic-width", |o| { o.optopt( "", - "output-width", + "diagnostic-width", "Provide width of the output for truncated error messages", "WIDTH", ) @@ -744,7 +744,7 @@ fn main_options(options: config::Options) -> MainResult { let diag = core::new_handler( options.error_format, None, - options.output_width, + options.diagnostic_width, &options.debugging_opts, ); diff --git a/src/test/run-make/issue-88756-default-output/output-default.stdout b/src/test/run-make/issue-88756-default-output/output-default.stdout index 64b31adc63e..08877af9286 100644 --- a/src/test/run-make/issue-88756-default-output/output-default.stdout +++ b/src/test/run-make/issue-88756-default-output/output-default.stdout @@ -110,7 +110,7 @@ Options: never = never colorize output --error-format human|json|short How errors and other messages are produced - --output-width WIDTH + --diagnostic-width WIDTH Provide width of the output for truncated error messages --json CONFIG Configure the structure of JSON diagnostics diff --git a/src/test/rustdoc-ui/diagnostic-width.rs b/src/test/rustdoc-ui/diagnostic-width.rs new file mode 100644 index 00000000000..61961d5ec71 --- /dev/null +++ b/src/test/rustdoc-ui/diagnostic-width.rs @@ -0,0 +1,5 @@ +// compile-flags: -Zunstable-options --diagnostic-width=10 +#![deny(rustdoc::bare_urls)] + +/// This is a long line that contains a http://link.com +pub struct Foo; //~^ ERROR diff --git a/src/test/rustdoc-ui/diagnostic-width.stderr b/src/test/rustdoc-ui/diagnostic-width.stderr new file mode 100644 index 00000000000..fed049d2b37 --- /dev/null +++ b/src/test/rustdoc-ui/diagnostic-width.stderr @@ -0,0 +1,15 @@ +error: this URL is not a hyperlink + --> $DIR/diagnostic-width.rs:4:41 + | +LL | ... a http://link.com + | ^^^^^^^^^^^^^^^ help: use an automatic link instead: `` + | +note: the lint level is defined here + --> $DIR/diagnostic-width.rs:2:9 + | +LL | ...ny(rustdoc::bare_url... + | ^^^^^^^^^^^^^^^^^^ + = note: bare URLs are not automatically turned into clickable links + +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/output-width.rs b/src/test/rustdoc-ui/output-width.rs deleted file mode 100644 index 9fb68047447..00000000000 --- a/src/test/rustdoc-ui/output-width.rs +++ /dev/null @@ -1,5 +0,0 @@ -// compile-flags: -Zunstable-options --output-width=10 -#![deny(rustdoc::bare_urls)] - -/// This is a long line that contains a http://link.com -pub struct Foo; //~^ ERROR diff --git a/src/test/rustdoc-ui/output-width.stderr b/src/test/rustdoc-ui/output-width.stderr deleted file mode 100644 index dc790530300..00000000000 --- a/src/test/rustdoc-ui/output-width.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: this URL is not a hyperlink - --> $DIR/output-width.rs:4:41 - | -LL | ... a http://link.com - | ^^^^^^^^^^^^^^^ help: use an automatic link instead: `` - | -note: the lint level is defined here - --> $DIR/output-width.rs:2:9 - | -LL | ...ny(rustdoc::bare_url... - | ^^^^^^^^^^^^^^^^^^ - = note: bare URLs are not automatically turned into clickable links - -error: aborting due to previous error - diff --git a/src/test/ui/diagnostic-width/flag-human.rs b/src/test/ui/diagnostic-width/flag-human.rs new file mode 100644 index 00000000000..289bfbabd94 --- /dev/null +++ b/src/test/ui/diagnostic-width/flag-human.rs @@ -0,0 +1,9 @@ +// compile-flags: --diagnostic-width=20 + +// This test checks that `-Z output-width` effects the human error output by restricting it to an +// arbitrarily low value so that the effect is visible. + +fn main() { + let _: () = 42; + //~^ ERROR mismatched types +} diff --git a/src/test/ui/diagnostic-width/flag-human.stderr b/src/test/ui/diagnostic-width/flag-human.stderr new file mode 100644 index 00000000000..393dcf2b828 --- /dev/null +++ b/src/test/ui/diagnostic-width/flag-human.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/flag-human.rs:7:17 + | +LL | ..._: () = 42; + | -- ^^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/diagnostic-width/flag-json.rs b/src/test/ui/diagnostic-width/flag-json.rs new file mode 100644 index 00000000000..51a1fb447c7 --- /dev/null +++ b/src/test/ui/diagnostic-width/flag-json.rs @@ -0,0 +1,9 @@ +// compile-flags: --diagnostic-width=20 --error-format=json + +// This test checks that `-Z output-width` effects the JSON error output by restricting it to an +// arbitrarily low value so that the effect is visible. + +fn main() { + let _: () = 42; + //~^ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/diagnostic-width/flag-json.stderr b/src/test/ui/diagnostic-width/flag-json.stderr new file mode 100644 index 00000000000..b21391d1640 --- /dev/null +++ b/src/test/ui/diagnostic-width/flag-json.stderr @@ -0,0 +1,40 @@ +{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. + +Erroneous code examples: + +```compile_fail,E0308 +fn plus_one(x: i32) -> i32 { + x + 1 +} + +plus_one(\"Not a number\"); +// ^^^^^^^^^^^^^^ expected `i32`, found `&str` + +if \"Not a bool\" { +// ^^^^^^^^^^^^ expected `bool`, found `&str` +} + +let x: f32 = \"Not a float\"; +// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` +// | +// expected due to this +``` + +This error occurs when an expression was used in a place where the compiler +expected an expression of a different type. It can occur in several cases, the +most common being when calling a function and passing an argument which has a +different type than the matching type in the function declaration. +"},"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 + --> $DIR/flag-json.rs:7:17 + | +LL | ..._: () = 42; + | -- ^^ expected `()`, found integer + | | + | expected due to this + +"} +{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error + +"} +{"message":"For more information about this error, try `rustc --explain E0308`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0308`. +"} diff --git a/src/test/ui/diagnostic-width/non-1-width-unicode-multiline-label.rs b/src/test/ui/diagnostic-width/non-1-width-unicode-multiline-label.rs new file mode 100644 index 00000000000..1989ea88635 --- /dev/null +++ b/src/test/ui/diagnostic-width/non-1-width-unicode-multiline-label.rs @@ -0,0 +1,7 @@ +// ignore-tidy-linelength + +fn main() { + let unicode_is_fun = "؁‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥"; + let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; + //~^ ERROR cannot add `&str` to `&str` +} diff --git a/src/test/ui/diagnostic-width/non-1-width-unicode-multiline-label.stderr b/src/test/ui/diagnostic-width/non-1-width-unicode-multiline-label.stderr new file mode 100644 index 00000000000..bf277362dba --- /dev/null +++ b/src/test/ui/diagnostic-width/non-1-width-unicode-multiline-label.stderr @@ -0,0 +1,18 @@ +error[E0369]: cannot add `&str` to `&str` + --> $DIR/non-1-width-unicode-multiline-label.rs:5:260 + | +LL | ...ཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇...࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; + | -------------- ^ -------------- &str + | | | + | | `+` cannot be used to concatenate two `&str` strings + | &str + | + = note: string concatenation requires an owned `String` on the left +help: create an owned `String` from a string reference + | +LL | let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun.to_owned() + " really fun!"; + | +++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/diagnostic-width/non-whitespace-trimming-2.rs b/src/test/ui/diagnostic-width/non-whitespace-trimming-2.rs new file mode 100644 index 00000000000..abd9e189a75 --- /dev/null +++ b/src/test/ui/diagnostic-width/non-whitespace-trimming-2.rs @@ -0,0 +1,6 @@ +// ignore-tidy-linelength + +fn main() { + let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _: usize = 4; let _: usize = 5; let _: usize = 6; let _: usize = 7; let _: usize = 8; let _: usize = 9; let _: usize = 10; let _: usize = 11; let _: usize = 12; let _: usize = 13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _: usize = 4; let _: usize = 5; let _: usize = 6; let _: usize = 7; let _: usize = 8; let _: usize = 9; let _: usize = 10; let _: usize = 11; let _: usize = 12; let _: usize = 13; let _: usize = 14; let _: usize = 15; +//~^ ERROR mismatched types +} diff --git a/src/test/ui/diagnostic-width/non-whitespace-trimming-2.stderr b/src/test/ui/diagnostic-width/non-whitespace-trimming-2.stderr new file mode 100644 index 00000000000..5dbb9ce45ee --- /dev/null +++ b/src/test/ui/diagnostic-width/non-whitespace-trimming-2.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/non-whitespace-trimming-2.rs:4:311 + | +LL | ...13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let ... + | -- ^^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/diagnostic-width/non-whitespace-trimming-unicode.rs b/src/test/ui/diagnostic-width/non-whitespace-trimming-unicode.rs new file mode 100644 index 00000000000..8d4d1b16279 --- /dev/null +++ b/src/test/ui/diagnostic-width/non-whitespace-trimming-unicode.rs @@ -0,0 +1,6 @@ +// ignore-tidy-linelength + +fn main() { + let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀🦀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀🦀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; +//~^ ERROR mismatched types +} diff --git a/src/test/ui/diagnostic-width/non-whitespace-trimming-unicode.stderr b/src/test/ui/diagnostic-width/non-whitespace-trimming-unicode.stderr new file mode 100644 index 00000000000..1e5ff939832 --- /dev/null +++ b/src/test/ui/diagnostic-width/non-whitespace-trimming-unicode.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/non-whitespace-trimming-unicode.rs:4:415 + | +LL | ...♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄... + | -- ^^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/diagnostic-width/non-whitespace-trimming.rs b/src/test/ui/diagnostic-width/non-whitespace-trimming.rs new file mode 100644 index 00000000000..f6c8d345c65 --- /dev/null +++ b/src/test/ui/diagnostic-width/non-whitespace-trimming.rs @@ -0,0 +1,6 @@ +// ignore-tidy-linelength + +fn main() { + let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); +//~^ ERROR mismatched types +} diff --git a/src/test/ui/diagnostic-width/non-whitespace-trimming.stderr b/src/test/ui/diagnostic-width/non-whitespace-trimming.stderr new file mode 100644 index 00000000000..c4ff0e16890 --- /dev/null +++ b/src/test/ui/diagnostic-width/non-whitespace-trimming.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/non-whitespace-trimming.rs:4:241 + | +LL | ... () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = ... + | -- ^^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/diagnostic-width/tabs-trimming.rs b/src/test/ui/diagnostic-width/tabs-trimming.rs new file mode 100644 index 00000000000..ade21753b45 --- /dev/null +++ b/src/test/ui/diagnostic-width/tabs-trimming.rs @@ -0,0 +1,13 @@ +// Test for #78438: ensure underline alignment with many tabs on the left, long line on the right + +// ignore-tidy-linelength +// ignore-tidy-tab + + fn main() { + let money = 42i32; + match money { + v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT + //~^ ERROR variable `v` is not bound in all patterns + v => println!("Enough money {}", v), + } + } diff --git a/src/test/ui/diagnostic-width/tabs-trimming.stderr b/src/test/ui/diagnostic-width/tabs-trimming.stderr new file mode 100644 index 00000000000..6c8d9afc73b --- /dev/null +++ b/src/test/ui/diagnostic-width/tabs-trimming.stderr @@ -0,0 +1,12 @@ +error[E0408]: variable `v` is not bound in all patterns + --> $DIR/tabs-trimming.rs:9:16 + | +LL | ... v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... + | - ^ ^ pattern doesn't bind `v` + | | | + | | pattern doesn't bind `v` + | variable not in all patterns + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0408`. diff --git a/src/test/ui/diagnostic-width/whitespace-trimming-2.rs b/src/test/ui/diagnostic-width/whitespace-trimming-2.rs new file mode 100644 index 00000000000..c68f678aab3 --- /dev/null +++ b/src/test/ui/diagnostic-width/whitespace-trimming-2.rs @@ -0,0 +1,8 @@ +// ignore-tidy-linelength + +fn foo() -> usize { + () +//~^ ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/diagnostic-width/whitespace-trimming-2.stderr b/src/test/ui/diagnostic-width/whitespace-trimming-2.stderr new file mode 100644 index 00000000000..97a64e603b7 --- /dev/null +++ b/src/test/ui/diagnostic-width/whitespace-trimming-2.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/whitespace-trimming-2.rs:4:187 + | +LL | ...-> usize { + | ----- expected `usize` because of return type +LL | ... () + | ^^ expected `usize`, found `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/diagnostic-width/whitespace-trimming.rs b/src/test/ui/diagnostic-width/whitespace-trimming.rs new file mode 100644 index 00000000000..f747bcf17e0 --- /dev/null +++ b/src/test/ui/diagnostic-width/whitespace-trimming.rs @@ -0,0 +1,6 @@ +// ignore-tidy-linelength + +fn main() { + let _: () = 42; +//~^ ERROR mismatched types +} diff --git a/src/test/ui/diagnostic-width/whitespace-trimming.stderr b/src/test/ui/diagnostic-width/whitespace-trimming.stderr new file mode 100644 index 00000000000..e296d48893c --- /dev/null +++ b/src/test/ui/diagnostic-width/whitespace-trimming.stderr @@ -0,0 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/whitespace-trimming.rs:4:193 + | +LL | ... let _: () = 42; + | -- ^^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/output-width/flag-human.rs b/src/test/ui/output-width/flag-human.rs deleted file mode 100644 index 44e9ba04423..00000000000 --- a/src/test/ui/output-width/flag-human.rs +++ /dev/null @@ -1,9 +0,0 @@ -// compile-flags: --output-width=20 - -// This test checks that `-Z output-width` effects the human error output by restricting it to an -// arbitrarily low value so that the effect is visible. - -fn main() { - let _: () = 42; - //~^ ERROR mismatched types -} diff --git a/src/test/ui/output-width/flag-human.stderr b/src/test/ui/output-width/flag-human.stderr deleted file mode 100644 index 393dcf2b828..00000000000 --- a/src/test/ui/output-width/flag-human.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/flag-human.rs:7:17 - | -LL | ..._: () = 42; - | -- ^^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/output-width/flag-json.rs b/src/test/ui/output-width/flag-json.rs deleted file mode 100644 index ec01dcb8818..00000000000 --- a/src/test/ui/output-width/flag-json.rs +++ /dev/null @@ -1,9 +0,0 @@ -// compile-flags: --output-width=20 --error-format=json - -// This test checks that `-Z output-width` effects the JSON error output by restricting it to an -// arbitrarily low value so that the effect is visible. - -fn main() { - let _: () = 42; - //~^ ERROR arguments to this function are incorrect -} diff --git a/src/test/ui/output-width/flag-json.stderr b/src/test/ui/output-width/flag-json.stderr deleted file mode 100644 index 097ca1d6e17..00000000000 --- a/src/test/ui/output-width/flag-json.stderr +++ /dev/null @@ -1,40 +0,0 @@ -{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. - -Erroneous code examples: - -```compile_fail,E0308 -fn plus_one(x: i32) -> i32 { - x + 1 -} - -plus_one(\"Not a number\"); -// ^^^^^^^^^^^^^^ expected `i32`, found `&str` - -if \"Not a bool\" { -// ^^^^^^^^^^^^ expected `bool`, found `&str` -} - -let x: f32 = \"Not a float\"; -// --- ^^^^^^^^^^^^^ expected `f32`, found `&str` -// | -// expected due to this -``` - -This error occurs when an expression was used in a place where the compiler -expected an expression of a different type. It can occur in several cases, the -most common being when calling a function and passing an argument which has a -different type than the matching type in the function declaration. -"},"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 - --> $DIR/flag-json.rs:7:17 - | -LL | ..._: () = 42; - | -- ^^ expected `()`, found integer - | | - | expected due to this - -"} -{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error - -"} -{"message":"For more information about this error, try `rustc --explain E0308`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0308`. -"} diff --git a/src/test/ui/output-width/non-1-width-unicode-multiline-label.rs b/src/test/ui/output-width/non-1-width-unicode-multiline-label.rs deleted file mode 100644 index 1989ea88635..00000000000 --- a/src/test/ui/output-width/non-1-width-unicode-multiline-label.rs +++ /dev/null @@ -1,7 +0,0 @@ -// ignore-tidy-linelength - -fn main() { - let unicode_is_fun = "؁‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥"; - let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; - //~^ ERROR cannot add `&str` to `&str` -} diff --git a/src/test/ui/output-width/non-1-width-unicode-multiline-label.stderr b/src/test/ui/output-width/non-1-width-unicode-multiline-label.stderr deleted file mode 100644 index bf277362dba..00000000000 --- a/src/test/ui/output-width/non-1-width-unicode-multiline-label.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0369]: cannot add `&str` to `&str` - --> $DIR/non-1-width-unicode-multiline-label.rs:5:260 - | -LL | ...ཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇...࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!"; - | -------------- ^ -------------- &str - | | | - | | `+` cannot be used to concatenate two `&str` strings - | &str - | - = note: string concatenation requires an owned `String` on the left -help: create an owned `String` from a string reference - | -LL | let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇ཈ཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬ཭཮཯཰ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗ྘ྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྽྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿍࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun.to_owned() + " really fun!"; - | +++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/output-width/non-whitespace-trimming-2.rs b/src/test/ui/output-width/non-whitespace-trimming-2.rs deleted file mode 100644 index abd9e189a75..00000000000 --- a/src/test/ui/output-width/non-whitespace-trimming-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -// ignore-tidy-linelength - -fn main() { - let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _: usize = 4; let _: usize = 5; let _: usize = 6; let _: usize = 7; let _: usize = 8; let _: usize = 9; let _: usize = 10; let _: usize = 11; let _: usize = 12; let _: usize = 13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let _: usize = 4; let _: usize = 5; let _: usize = 6; let _: usize = 7; let _: usize = 8; let _: usize = 9; let _: usize = 10; let _: usize = 11; let _: usize = 12; let _: usize = 13; let _: usize = 14; let _: usize = 15; -//~^ ERROR mismatched types -} diff --git a/src/test/ui/output-width/non-whitespace-trimming-2.stderr b/src/test/ui/output-width/non-whitespace-trimming-2.stderr deleted file mode 100644 index 5dbb9ce45ee..00000000000 --- a/src/test/ui/output-width/non-whitespace-trimming-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/non-whitespace-trimming-2.rs:4:311 - | -LL | ...13; let _: usize = 14; let _: usize = 15; let _: () = 42; let _: usize = 0; let _: usize = 1; let _: usize = 2; let _: usize = 3; let ... - | -- ^^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/output-width/non-whitespace-trimming-unicode.rs b/src/test/ui/output-width/non-whitespace-trimming-unicode.rs deleted file mode 100644 index 8d4d1b16279..00000000000 --- a/src/test/ui/output-width/non-whitespace-trimming-unicode.rs +++ /dev/null @@ -1,6 +0,0 @@ -// ignore-tidy-linelength - -fn main() { - let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀🦀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀🦀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; -//~^ ERROR mismatched types -} diff --git a/src/test/ui/output-width/non-whitespace-trimming-unicode.stderr b/src/test/ui/output-width/non-whitespace-trimming-unicode.stderr deleted file mode 100644 index 1e5ff939832..00000000000 --- a/src/test/ui/output-width/non-whitespace-trimming-unicode.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/non-whitespace-trimming-unicode.rs:4:415 - | -LL | ...♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄... - | -- ^^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/output-width/non-whitespace-trimming.rs b/src/test/ui/output-width/non-whitespace-trimming.rs deleted file mode 100644 index f6c8d345c65..00000000000 --- a/src/test/ui/output-width/non-whitespace-trimming.rs +++ /dev/null @@ -1,6 +0,0 @@ -// ignore-tidy-linelength - -fn main() { - let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = (); -//~^ ERROR mismatched types -} diff --git a/src/test/ui/output-width/non-whitespace-trimming.stderr b/src/test/ui/output-width/non-whitespace-trimming.stderr deleted file mode 100644 index c4ff0e16890..00000000000 --- a/src/test/ui/output-width/non-whitespace-trimming.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/non-whitespace-trimming.rs:4:241 - | -LL | ... () = (); let _: () = (); let _: () = (); let _: () = 42; let _: () = (); let _: () = (); let _: () = (); let _: () = (); let _: () = ... - | -- ^^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/output-width/tabs-trimming.rs b/src/test/ui/output-width/tabs-trimming.rs deleted file mode 100644 index ade21753b45..00000000000 --- a/src/test/ui/output-width/tabs-trimming.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Test for #78438: ensure underline alignment with many tabs on the left, long line on the right - -// ignore-tidy-linelength -// ignore-tidy-tab - - fn main() { - let money = 42i32; - match money { - v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT - //~^ ERROR variable `v` is not bound in all patterns - v => println!("Enough money {}", v), - } - } diff --git a/src/test/ui/output-width/tabs-trimming.stderr b/src/test/ui/output-width/tabs-trimming.stderr deleted file mode 100644 index 6c8d9afc73b..00000000000 --- a/src/test/ui/output-width/tabs-trimming.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0408]: variable `v` is not bound in all patterns - --> $DIR/tabs-trimming.rs:9:16 - | -LL | ... v @ 1 | 2 | 3 => panic!("You gave me too little money {}", v), // Long text here: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT... - | - ^ ^ pattern doesn't bind `v` - | | | - | | pattern doesn't bind `v` - | variable not in all patterns - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0408`. diff --git a/src/test/ui/output-width/whitespace-trimming-2.rs b/src/test/ui/output-width/whitespace-trimming-2.rs deleted file mode 100644 index c68f678aab3..00000000000 --- a/src/test/ui/output-width/whitespace-trimming-2.rs +++ /dev/null @@ -1,8 +0,0 @@ -// ignore-tidy-linelength - -fn foo() -> usize { - () -//~^ ERROR mismatched types -} - -fn main() {} diff --git a/src/test/ui/output-width/whitespace-trimming-2.stderr b/src/test/ui/output-width/whitespace-trimming-2.stderr deleted file mode 100644 index 97a64e603b7..00000000000 --- a/src/test/ui/output-width/whitespace-trimming-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/whitespace-trimming-2.rs:4:187 - | -LL | ...-> usize { - | ----- expected `usize` because of return type -LL | ... () - | ^^ expected `usize`, found `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/output-width/whitespace-trimming.rs b/src/test/ui/output-width/whitespace-trimming.rs deleted file mode 100644 index f747bcf17e0..00000000000 --- a/src/test/ui/output-width/whitespace-trimming.rs +++ /dev/null @@ -1,6 +0,0 @@ -// ignore-tidy-linelength - -fn main() { - let _: () = 42; -//~^ ERROR mismatched types -} diff --git a/src/test/ui/output-width/whitespace-trimming.stderr b/src/test/ui/output-width/whitespace-trimming.stderr deleted file mode 100644 index e296d48893c..00000000000 --- a/src/test/ui/output-width/whitespace-trimming.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/whitespace-trimming.rs:4:193 - | -LL | ... let _: () = 42; - | -- ^^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. -- cgit 1.4.1-3-g733a5