bundle: Option<Lrc<FluentBundle>>,
fallback_bundle: LazyFallbackBundle,
teach: bool,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
macro_backtrace: bool,
) -> EmitterWriter {
let (short, color_config) = self.unzip();
short,
teach,
color,
- terminal_width,
+ output_width,
macro_backtrace,
)
}
short_message: bool,
teach: bool,
ui_testing: bool,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
macro_backtrace: bool,
}
fallback_bundle: LazyFallbackBundle,
short_message: bool,
teach: bool,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
macro_backtrace: bool,
) -> EmitterWriter {
let dst = Destination::from_stderr(color_config);
short_message,
teach,
ui_testing: false,
- terminal_width,
+ output_width,
macro_backtrace,
}
}
short_message: bool,
teach: bool,
colored: bool,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
macro_backtrace: bool,
) -> EmitterWriter {
EmitterWriter {
short_message,
teach,
ui_testing: false,
- terminal_width,
+ output_width,
macro_backtrace,
}
}
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
pretty: bool,
ui_testing: bool,
json_rendered: HumanReadableErrorType,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
macro_backtrace: bool,
}
fallback_bundle: LazyFallbackBundle,
pretty: bool,
json_rendered: HumanReadableErrorType,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
- terminal_width,
+ output_width,
macro_backtrace,
}
}
json_rendered: HumanReadableErrorType,
fluent_bundle: Option<Lrc<FluentBundle>>,
fallback_bundle: LazyFallbackBundle,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
let file_path_mapping = FilePathMapping::empty();
fallback_bundle,
pretty,
json_rendered,
- terminal_width,
+ output_width,
macro_backtrace,
)
}
fallback_bundle: LazyFallbackBundle,
pretty: bool,
json_rendered: HumanReadableErrorType,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
- terminal_width,
+ output_width,
macro_backtrace,
}
}
je.fluent_bundle.clone(),
je.fallback_bundle.clone(),
false,
- je.terminal_width,
+ je.output_width,
je.macro_backtrace,
)
.ui_testing(je.ui_testing)
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(),
),
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(
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");
prints,
cg,
error_format,
- terminal_width,
+ output_width,
externs,
unstable_features: UnstableFeatures::from_environment(crate_name.as_deref()),
crate_name,
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.
"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],
"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.
fallback_bundle,
short,
sopts.debugging_opts.teach,
- sopts.terminal_width,
+ sopts.output_width,
macro_backtrace,
),
Some(dst) => EmitterWriter::new(
fallback_bundle,
pretty,
json_rendered,
- sopts.terminal_width,
+ sopts.output_width,
macro_backtrace,
)
.ui_testing(sopts.debugging_opts.ui_testing),
fallback_bundle,
pretty,
json_rendered,
- sopts.terminal_width,
+ sopts.output_width,
macro_backtrace,
)
.ui_testing(sopts.debugging_opts.ui_testing),
/// How to format errors and warnings.
pub(crate) error_format: ErrorOutputType,
/// Width of terminal to truncate errors appropriately.
- pub(crate) terminal_width: Option<usize>,
+ pub(crate) output_width: Option<usize>,
/// Library search paths to hand to the compiler.
pub(crate) libs: Vec<SearchPath>,
/// Library search paths strings to hand to the compiler.
let config::JsonConfig { json_rendered, json_unused_externs, .. } =
config::parse_json(matches);
let error_format = config::parse_error_format(matches, color, json_rendered);
- let terminal_width = matches.opt_get("terminal-width").unwrap_or_default();
+ let output_width = matches.opt_get("output-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, terminal_width, &debugging_opts);
+ let diag = new_handler(error_format, None, output_width, &debugging_opts);
// check for deprecated options
check_deprecated_options(matches, &diag);
input,
proc_macro_crate,
error_format,
- terminal_width,
+ output_width,
libs,
lib_strs,
externs,
pub(crate) fn new_handler(
error_format: ErrorOutputType,
source_map: Option<Lrc<source_map::SourceMap>>,
- terminal_width: Option<usize>,
+ output_width: Option<usize>,
debugging_opts: &DebuggingOptions,
) -> rustc_errors::Handler {
let fallback_bundle =
fallback_bundle,
short,
debugging_opts.teach,
- terminal_width,
+ output_width,
false,
)
.ui_testing(debugging_opts.ui_testing),
fallback_bundle,
pretty,
json_rendered,
- terminal_width,
+ output_width,
false,
)
.ui_testing(debugging_opts.ui_testing),
crate_name,
proc_macro_crate,
error_format,
- terminal_width,
+ output_width,
libs,
externs,
mut cfgs,
actually_rustdoc: true,
debugging_opts,
error_format,
- terminal_width,
+ output_width,
edition,
describe_lints,
crate_name,
"human|json|short",
)
}),
- unstable("terminal-width", |o| {
+ unstable("output-width", |o| {
o.optopt(
"",
- "terminal-width",
- "Provide width of the terminal for truncated error messages",
+ "output-width",
+ "Provide width of the output for truncated error messages",
"WIDTH",
)
}),
let diag = core::new_handler(
options.error_format,
None,
- options.terminal_width,
+ options.output_width,
&options.debugging_opts,
);
never = never colorize output
--error-format human|json|short
How errors and other messages are produced
- --terminal-width WIDTH
- Provide width of the terminal for truncated error
+ --output-width WIDTH
+ Provide width of the output for truncated error
messages
--json CONFIG Configure the structure of JSON diagnostics
--disable-minification
--- /dev/null
+// 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
--- /dev/null
+error: this URL is not a hyperlink
+ --> $DIR/output-width.rs:4:41
+ |
+LL | ... a http://link.com
+ | ^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://link.com>`
+ |
+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
+
+++ /dev/null
-// compile-flags: -Zunstable-options --terminal-width=10
-#![deny(rustdoc::bare_urls)]
-
-/// This is a long line that contains a http://link.com
-pub struct Foo; //~^ ERROR
+++ /dev/null
-error: this URL is not a hyperlink
- --> $DIR/terminal-width.rs:4:41
- |
-LL | ... a http://link.com
- | ^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://link.com>`
- |
-note: the lint level is defined here
- --> $DIR/terminal-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
-
--- /dev/null
+// 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
+}
--- /dev/null
+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`.
--- /dev/null
+// 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
+}
--- /dev/null
+{"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`.
+"}
--- /dev/null
+// ignore-tidy-linelength
+
+fn main() {
+ let unicode_is_fun = "‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥";
+ let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
+ //~^ ERROR cannot add `&str` to `&str`
+}
--- /dev/null
+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`.
--- /dev/null
+// 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
+}
--- /dev/null
+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`.
--- /dev/null
+// ignore-tidy-linelength
+
+fn main() {
+ let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀🦀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀🦀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4";
+//~^ ERROR mismatched types
+}
--- /dev/null
+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`.
--- /dev/null
+// 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
+}
--- /dev/null
+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`.
--- /dev/null
+// 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),
+ }
+ }
--- /dev/null
+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`.
--- /dev/null
+// ignore-tidy-linelength
+
+fn foo() -> usize {
+ ()
+//~^ ERROR mismatched types
+}
+
+fn main() {}
--- /dev/null
+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`.
--- /dev/null
+// ignore-tidy-linelength
+
+fn main() {
+ let _: () = 42;
+//~^ ERROR mismatched types
+}
--- /dev/null
+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`.
+++ /dev/null
-// compile-flags: --terminal-width=20
-
-// This test checks that `-Z terminal-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
-}
+++ /dev/null
-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`.
+++ /dev/null
-// compile-flags: --terminal-width=20 --error-format=json
-
-// This test checks that `-Z terminal-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
-}
+++ /dev/null
-{"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`.
-"}
+++ /dev/null
-// ignore-tidy-linelength
-
-fn main() {
- let unicode_is_fun = "‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥";
- let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
- //~^ ERROR cannot add `&str` to `&str`
-}
+++ /dev/null
-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`.
+++ /dev/null
-// 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
-}
+++ /dev/null
-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`.
+++ /dev/null
-// ignore-tidy-linelength
-
-fn main() {
- let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀🦀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4"; let _: () = 42; let _: &str = "🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓ ☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4🦀🦀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏☐☑☒☓☖☗☘☙☚☛☜☝☞☟☠☡☢☣☤☥☦☧☨☩☪☫☬☭☮☯☰☱☲☳☴☵☶☷☸☹☺☻☼☽☾☿♀♁♂♃♄♅♆♇♏♔♕♖♗♘♙♚♛♜♝♞♟♠♡♢♣♤♥♦♧♨♩♪♫♬♭♮♯♰♱♲♳♴♵♶♷♸♹♺♻♼♽♾♿⚀⚁⚂⚃⚄⚅⚆⚈⚉4";
-//~^ ERROR mismatched types
-}
+++ /dev/null
-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`.
+++ /dev/null
-// 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
-}
+++ /dev/null
-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`.
+++ /dev/null
-// 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),
- }
- }
+++ /dev/null
-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`.
+++ /dev/null
-// ignore-tidy-linelength
-
-fn foo() -> usize {
- ()
-//~^ ERROR mismatched types
-}
-
-fn main() {}
+++ /dev/null
-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`.
+++ /dev/null
-// ignore-tidy-linelength
-
-fn main() {
- let _: () = 42;
-//~^ ERROR mismatched types
-}
+++ /dev/null
-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`.