Add Unicode block-drawing compiler output support
Add nightly-only theming support to rustc output using Unicode box drawing characters instead of ASCII-art to draw the terminal UI: After: ``` error: foo ╭▸ test.rs:3:3 │ 3 │ X0 Y0 Z0 │ ┌───╿──│──┘ │ ┌│───│──┘ │ ┏││━━━┙ │ ┃││ 4 │ ┃││ X1 Y1 Z1 5 │ ┃││ X2 Y2 Z2 │ ┃│└────╿──│──┘ `Z` label │ ┃└─────│──┤ │ ┗━━━━━━┥ `Y` is a good letter too │ `X` is a good letter ╰╴ note: bar ╭▸ test.rs:4:3 │ 4 │ ┏ X1 Y1 Z1 5 │ ┃ X2 Y2 Z2 6 │ ┃ X3 Y3 Z3 │ ┗━━━━━━━━━━┛ ├ note: bar ╰ note: baz note: qux ╭▸ test.rs:4:3 │ 4 │ X1 Y1 Z1 ╰╴ ━━━━━━━━ ``` Before: ``` error: foo --> test.rs:3:3 | 3 | X0 Y0 Z0 | ___^__-__- | |___|__| | ||___| | ||| 4 | ||| X1 Y1 Z1 5 | ||| X2 Y2 Z2 | |||____^__-__- `Z` label | ||_____|__| | |______| `Y` is a good letter too | `X` is a good letter | note: bar --> test.rs:4:3 | 4 | / X1 Y1 Z1 5 | | X2 Y2 Z2 6 | | X3 Y3 Z3 | |__________^ = note: bar = note: baz note: qux --> test.rs:4:3 | 4 | X1 Y1 Z1 | ^^^^^^^^ ```
This commit is contained in:
parent
f61306d47b
commit
1d78004575
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@
|
||||
|
||||
use crate::diagnostic::IsLint;
|
||||
use crate::emitter::{
|
||||
ColorConfig, Destination, Emitter, HumanEmitter, HumanReadableErrorType,
|
||||
ColorConfig, Destination, Emitter, HumanEmitter, HumanReadableErrorType, OutputTheme,
|
||||
should_show_source_code,
|
||||
};
|
||||
use crate::registry::Registry;
|
||||
@ -377,6 +377,11 @@ fn reset(&mut self) -> io::Result<()> {
|
||||
.terminal_url(je.terminal_url)
|
||||
.ui_testing(je.ui_testing)
|
||||
.ignored_directories_in_source_blocks(je.ignored_directories_in_source_blocks.clone())
|
||||
.theme(if let HumanReadableErrorType::Unicode = je.json_rendered {
|
||||
OutputTheme::Unicode
|
||||
} else {
|
||||
OutputTheme::Ascii
|
||||
})
|
||||
.emit_diagnostic(diag);
|
||||
let buf = Arc::try_unwrap(buf.0).unwrap().into_inner().unwrap();
|
||||
let buf = String::from_utf8(buf).unwrap();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1714,6 +1714,9 @@ pub fn parse_json(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches) -> Json
|
||||
for sub_option in option.split(',') {
|
||||
match sub_option {
|
||||
"diagnostic-short" => json_rendered = HumanReadableErrorType::Short,
|
||||
"diagnostic-unicode" => {
|
||||
json_rendered = HumanReadableErrorType::Unicode;
|
||||
}
|
||||
"diagnostic-rendered-ansi" => json_color = ColorConfig::Always,
|
||||
"artifacts" => json_artifact_notifications = true,
|
||||
"unused-externs" => json_unused_externs = JsonUnusedExterns::Loud,
|
||||
@ -1760,6 +1763,9 @@ pub fn parse_error_format(
|
||||
ErrorOutputType::Json { pretty: true, json_rendered, color_config: json_color }
|
||||
}
|
||||
Some("short") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Short, color),
|
||||
Some("human-unicode") => {
|
||||
ErrorOutputType::HumanReadable(HumanReadableErrorType::Unicode, color)
|
||||
}
|
||||
Some(arg) => {
|
||||
early_dcx.abort_if_error_and_set_error_format(ErrorOutputType::HumanReadable(
|
||||
HumanReadableErrorType::Default,
|
||||
@ -1831,6 +1837,9 @@ fn check_error_format_stability(
|
||||
{
|
||||
early_dcx.early_fatal("`--error-format=human-annotate-rs` is unstable");
|
||||
}
|
||||
if let ErrorOutputType::HumanReadable(HumanReadableErrorType::Unicode, _) = error_format {
|
||||
early_dcx.early_fatal("`--error-format=human-unicode` is unstable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,9 @@
|
||||
};
|
||||
use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::emitter::{DynEmitter, HumanEmitter, HumanReadableErrorType, stderr_destination};
|
||||
use rustc_errors::emitter::{
|
||||
DynEmitter, HumanEmitter, HumanReadableErrorType, OutputTheme, stderr_destination,
|
||||
};
|
||||
use rustc_errors::json::JsonEmitter;
|
||||
use rustc_errors::registry::Registry;
|
||||
use rustc_errors::{
|
||||
@ -965,6 +967,11 @@ fn default_emitter(
|
||||
.macro_backtrace(macro_backtrace)
|
||||
.track_diagnostics(track_diagnostics)
|
||||
.terminal_url(terminal_url)
|
||||
.theme(if let HumanReadableErrorType::Unicode = kind {
|
||||
OutputTheme::Unicode
|
||||
} else {
|
||||
OutputTheme::Ascii
|
||||
})
|
||||
.ignored_directories_in_source_blocks(
|
||||
sopts.unstable_opts.ignore_directory_in_diagnostics_source_blocks.clone(),
|
||||
);
|
||||
@ -1468,6 +1475,11 @@ fn mk_emitter(output: ErrorOutputType) -> Box<DynEmitter> {
|
||||
let short = kind.short();
|
||||
Box::new(
|
||||
HumanEmitter::new(stderr_destination(color_config), fallback_bundle)
|
||||
.theme(if let HumanReadableErrorType::Unicode = kind {
|
||||
OutputTheme::Unicode
|
||||
} else {
|
||||
OutputTheme::Ascii
|
||||
})
|
||||
.short_message(short),
|
||||
)
|
||||
}
|
||||
|
@ -6,7 +6,9 @@
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::emitter::{DynEmitter, HumanEmitter, stderr_destination};
|
||||
use rustc_errors::emitter::{
|
||||
DynEmitter, HumanEmitter, HumanReadableErrorType, OutputTheme, stderr_destination,
|
||||
};
|
||||
use rustc_errors::json::JsonEmitter;
|
||||
use rustc_errors::{ErrorGuaranteed, TerminalUrl};
|
||||
use rustc_feature::UnstableFeatures;
|
||||
@ -147,6 +149,11 @@ pub(crate) fn new_dcx(
|
||||
.teach(unstable_opts.teach)
|
||||
.diagnostic_width(diagnostic_width)
|
||||
.track_diagnostics(unstable_opts.track_diagnostics)
|
||||
.theme(if let HumanReadableErrorType::Unicode = kind {
|
||||
OutputTheme::Unicode
|
||||
} else {
|
||||
OutputTheme::Ascii
|
||||
})
|
||||
.ui_testing(unstable_opts.ui_testing),
|
||||
)
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
pub(crate) use markdown::test as test_markdown;
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
|
||||
use rustc_errors::emitter::HumanReadableErrorType;
|
||||
use rustc_errors::{ColorConfig, DiagCtxtHandle, ErrorGuaranteed, FatalError};
|
||||
use rustc_hir::CRATE_HIR_ID;
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
@ -520,10 +521,14 @@ fn run_test(
|
||||
});
|
||||
if let ErrorOutputType::HumanReadable(kind, color_config) = rustdoc_options.error_format {
|
||||
let short = kind.short();
|
||||
let unicode = kind == HumanReadableErrorType::Unicode;
|
||||
|
||||
if short {
|
||||
compiler.arg("--error-format").arg("short");
|
||||
}
|
||||
if unicode {
|
||||
compiler.arg("--error-format").arg("human-unicode");
|
||||
}
|
||||
|
||||
match color_config {
|
||||
ColorConfig::Never => {
|
||||
|
@ -3,7 +3,7 @@ error: empty line after doc comment
|
||||
|
|
||||
LL | / /// for the crate
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn first_in_crate() {}
|
||||
| ------------------- the comment documents this function
|
||||
|
|
||||
@ -22,7 +22,7 @@ error: empty line after doc comment
|
||||
|
|
||||
LL | / /// for the module
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn first_in_module() {}
|
||||
| -------------------- the comment documents this function
|
||||
|
|
||||
@ -39,7 +39,7 @@ error: empty line after doc comment
|
||||
|
|
||||
LL | / /// # Indented
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | /// Blank line
|
||||
LL | fn indented() {}
|
||||
| ------------- the comment documents this function
|
||||
@ -55,7 +55,7 @@ error: empty line after doc comment
|
||||
|
|
||||
LL | / /// This should produce a warning
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn with_doc_and_newline() {}
|
||||
| ------------------------- the comment documents this function
|
||||
|
|
||||
@ -69,7 +69,7 @@ LL | |
|
||||
LL | | /** This is also a doc comment and is part of the warning
|
||||
LL | | */
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
...
|
||||
LL | fn three_attributes() {}
|
||||
| --------------------- the comment documents this function
|
||||
@ -82,7 +82,7 @@ error: empty line after doc comment
|
||||
LL | / /// docs for `old_code`
|
||||
LL | | // fn old_code() {}
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn new_code() {}
|
||||
| ------------- the comment documents this function
|
||||
|
|
||||
@ -102,7 +102,7 @@ LL | | /// Docs
|
||||
LL | | /// for OldB
|
||||
LL | | // struct OldB;
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
...
|
||||
LL | struct Multiple;
|
||||
| --------------- the comment documents this struct
|
||||
@ -125,7 +125,7 @@ LL | / /**
|
||||
LL | | * Meant to be inner doc comment
|
||||
LL | | */
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn first_in_module() {}
|
||||
| -------------------- the comment documents this function
|
||||
|
|
||||
@ -143,7 +143,7 @@ LL | | * Docs for `old_code`
|
||||
LL | | */
|
||||
LL | | /* fn old_code() {} */
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
...
|
||||
LL | fn new_code() {}
|
||||
| ------------- the comment documents this function
|
||||
@ -161,7 +161,7 @@ error: empty line after doc comment
|
||||
LL | / /// Docs for `old_code2`
|
||||
LL | | /* fn old_code2() {} */
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | /// Docs for `new_code2`
|
||||
LL | fn new_code2() {}
|
||||
| -------------- the comment documents this function
|
||||
|
@ -3,7 +3,7 @@ error: empty line after outer attribute
|
||||
|
|
||||
LL | / #[crate_type = "lib"]
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn first_in_crate() {}
|
||||
| ------------------- the attribute applies to this function
|
||||
|
|
||||
@ -20,7 +20,7 @@ error: empty line after outer attribute
|
||||
|
|
||||
LL | / #[inline]
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | /// some comment
|
||||
LL | fn with_one_newline_and_comment() {}
|
||||
| --------------------------------- the attribute applies to this function
|
||||
@ -32,7 +32,7 @@ error: empty line after outer attribute
|
||||
|
|
||||
LL | / #[inline]
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn with_one_newline() {}
|
||||
| --------------------- the attribute applies to this function
|
||||
|
|
||||
@ -44,7 +44,7 @@ error: empty lines after outer attribute
|
||||
LL | / #[crate_type = "lib"]
|
||||
LL | |
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn with_two_newlines() {}
|
||||
| ---------------------- the attribute applies to this function
|
||||
|
|
||||
@ -59,7 +59,7 @@ error: empty line after outer attribute
|
||||
|
|
||||
LL | / #[doc = "doc attributes should be considered attributes"]
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | enum Baz {
|
||||
| -------- the attribute applies to this enum
|
||||
|
|
||||
@ -70,7 +70,7 @@ error: empty line after outer attribute
|
||||
|
|
||||
LL | / #[repr(C)]
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | struct Foo {
|
||||
| ---------- the attribute applies to this struct
|
||||
|
|
||||
@ -81,7 +81,7 @@ error: empty line after outer attribute
|
||||
|
|
||||
LL | / #[allow(dead_code)]
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | mod foo {}
|
||||
| ------- the attribute applies to this module
|
||||
|
|
||||
@ -93,7 +93,7 @@ error: empty line after outer attribute
|
||||
LL | / #[inline]
|
||||
LL | | // Still lint cases where the empty line does not immediately follow the attribute
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | fn comment_before_empty_line() {}
|
||||
| ------------------------------ the attribute applies to this function
|
||||
|
|
||||
@ -106,7 +106,7 @@ LL | / #[allow(unused)]
|
||||
LL | |
|
||||
LL | | // This comment is isolated
|
||||
LL | |
|
||||
| |_
|
||||
| |_^
|
||||
LL | pub fn isolated_comment() {}
|
||||
| ------------------------- the attribute applies to this function
|
||||
|
|
||||
|
@ -3,7 +3,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
|
||||
|
|
||||
LL | / //// whoops
|
||||
LL | | fn a() {}
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::four-forward-slashes` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]`
|
||||
@ -18,7 +18,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
|
||||
LL | / //// whoops
|
||||
LL | | #[allow(dead_code)]
|
||||
LL | | fn b() {}
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
help: make this a doc comment by removing one `/`
|
||||
|
|
||||
@ -32,7 +32,7 @@ LL | / //// whoops
|
||||
LL | | //// two borked comments!
|
||||
LL | | #[track_caller]
|
||||
LL | | fn c() {}
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
help: turn these into doc comments by removing one `/`
|
||||
|
|
||||
@ -46,7 +46,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
|
||||
LL | / //// between attributes
|
||||
LL | | #[allow(dead_code)]
|
||||
LL | | fn g() {}
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
help: make this a doc comment by removing one `/`
|
||||
|
|
||||
@ -58,7 +58,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
|
||||
|
|
||||
LL | / //// not very start of contents
|
||||
LL | | fn h() {}
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
help: make this a doc comment by removing one `/`
|
||||
|
|
||||
|
@ -3,7 +3,7 @@ error: this item has comments with 4 forward slashes (`////`). These look like d
|
||||
|
|
||||
LL | / //// borked doc comment on the first line. doesn't combust!
|
||||
LL | | fn a() {}
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::four-forward-slashes` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]`
|
||||
|
@ -6,7 +6,7 @@ LL | | /// A much longer explanation that goes into a lot more detail about
|
||||
LL | | /// how the thing works, possibly with doclinks and so one,
|
||||
LL | | /// and probably spanning a many rows. Blablabla, it needs to be over
|
||||
LL | | /// 200 characters so I needed to write something longeeeeeeer.
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::too-long-first-doc-paragraph` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::too_long_first_doc_paragraph)]`
|
||||
|
@ -23,7 +23,7 @@ error: first doc comment paragraph is too long
|
||||
LL | / /// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia
|
||||
LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero,
|
||||
LL | | /// gravida non lacinia at, rhoncus eu lacus.
|
||||
| |_
|
||||
| |_^
|
||||
|
||||
error: first doc comment paragraph is too long
|
||||
--> tests/ui/too_long_first_doc_paragraph.rs:36:1
|
||||
@ -32,7 +32,7 @@ LL | / /// Lorem
|
||||
LL | | /// ipsum dolor sit amet, consectetur adipiscing elit. Nunc turpis nunc, lacinia
|
||||
LL | | /// a dolor in, pellentesque aliquet enim. Cras nec maximus sem. Mauris arcu libero,
|
||||
LL | | /// gravida non lacinia at, rhoncus eu lacus.
|
||||
| |_
|
||||
| |_^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -130,7 +130,7 @@ warning: could not parse code block as Rust code
|
||||
LL | /// \____/
|
||||
| _________^
|
||||
LL | | ///
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
= note: error from rustc: unknown start of token: \
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<svg width="818px" height="848px" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="743px" height="848px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
@ -21,7 +21,7 @@
|
||||
<text xml:space="preserve" class="container fg">
|
||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/huge_multispan_highlight.rs:96:18</tspan>
|
||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/huge_multispan_highlight.rs:99:18</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
||||
@ -59,7 +59,7 @@
|
||||
</tspan>
|
||||
<tspan x="10px" y="370px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/huge_multispan_highlight.rs:213:18</tspan>
|
||||
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/huge_multispan_highlight.rs:216:18</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
|
||||
</tspan>
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
@ -1,4 +1,7 @@
|
||||
//@ compile-flags: --error-format=human --color=always
|
||||
//@ revisions: ascii unicode
|
||||
//@ compile-flags: --color=always
|
||||
//@[ascii] compile-flags: --error-format=human
|
||||
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode
|
||||
//@ ignore-windows
|
||||
fn main() {
|
||||
let _ = match true {
|
||||
|
116
tests/ui/codemap_tests/huge_multispan_highlight.unicode.svg
Normal file
116
tests/ui/codemap_tests/huge_multispan_highlight.unicode.svg
Normal file
@ -0,0 +1,116 @@
|
||||
<svg width="743px" height="848px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
.fg-ansi256-009 { fill: #FF5555 }
|
||||
.fg-ansi256-012 { fill: #5555FF }
|
||||
.container {
|
||||
padding: 0 10px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.bold { font-weight: bold; }
|
||||
tspan {
|
||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
white-space: pre;
|
||||
line-height: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
||||
|
||||
<text xml:space="preserve" class="container fg">
|
||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold"> ╭▸ </tspan><tspan>$DIR/huge_multispan_highlight.rs:99:18</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> let _ = match true {</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">──────────</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`match` arms have incompatible types</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="118px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> true => (</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">┌─────────────────┘</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="154px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> // last line shown in multispan header</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="172px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">‡</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="190px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="208px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> ),</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">└─────────┘</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">this is found to be of type `()`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="244px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> false => "</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┏━━━━━━━━━━━━━━━━━━┛</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">‡</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="298px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="316px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan><tspan> ",</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="334px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">╰╴</tspan><tspan class="fg-ansi256-009 bold">┗━━━━━━━━━┛</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">expected `()`, found `&str`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="352px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="370px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold"> ╭▸ </tspan><tspan>$DIR/huge_multispan_highlight.rs:216:18</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="424px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> let _ = match true {</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="442px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">──────────</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`match` arms have incompatible types</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="460px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> true => (</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="478px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">┌─────────────────┘</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="496px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="514px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> 1 // last line shown in multispan header</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="532px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">‡</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="550px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="568px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> ),</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">└─────────┘</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">this is found to be of type `{integer}`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="604px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> false => "</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="622px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┏━━━━━━━━━━━━━━━━━━┛</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="640px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="658px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="676px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan><tspan> 1 last line shown in multispan</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="694px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">‡</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="712px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="730px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">┃</tspan><tspan> ",</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="748px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">╰╴</tspan><tspan class="fg-ansi256-009 bold">┗━━━━━━━━━┛</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">expected integer, found `&str`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="766px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="784px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 2 previous errors</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="802px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="820px"><tspan class="bold">For more information about this error, try `rustc --explain E0308`.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="838px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 9.3 KiB |
@ -1,5 +1,5 @@
|
||||
error[E0271]: type mismatch resolving `<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ...>>, ...>>, ...> as Future>::Error == Foo`
|
||||
--> $DIR/E0271.rs:18:5
|
||||
--> $DIR/E0271.rs:20:5
|
||||
|
|
||||
LL | / Box::new(
|
||||
LL | | Ok::<_, ()>(
|
||||
@ -11,7 +11,7 @@ LL | | )
|
||||
| |_____^ type mismatch resolving `<Result<Result<(), Result<Result<(), ...>, ...>>, ...> as Future>::Error == Foo`
|
||||
|
|
||||
note: expected this to be `Foo`
|
||||
--> $DIR/E0271.rs:8:18
|
||||
--> $DIR/E0271.rs:10:18
|
||||
|
|
||||
LL | type Error = E;
|
||||
| ^
|
@ -1,4 +1,6 @@
|
||||
//@ compile-flags: --diagnostic-width=40
|
||||
//@ revisions: ascii unicode
|
||||
//@[ascii] compile-flags: --diagnostic-width=40
|
||||
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode --diagnostic-width=40
|
||||
//@ normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
|
||||
trait Future {
|
||||
type Error;
|
||||
@ -15,7 +17,7 @@ impl<T> Future for Option<T> {
|
||||
struct Foo;
|
||||
|
||||
fn foo() -> Box<dyn Future<Error=Foo>> {
|
||||
Box::new( //~ ERROR E0271
|
||||
Box::new( //[ascii]~ ERROR E0271
|
||||
Ok::<_, ()>(
|
||||
Err::<(), _>(
|
||||
Ok::<_, ()>(
|
||||
|
22
tests/ui/diagnostic-width/E0271.unicode.stderr
Normal file
22
tests/ui/diagnostic-width/E0271.unicode.stderr
Normal file
@ -0,0 +1,22 @@
|
||||
error[E0271]: type mismatch resolving `<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ...>>, ...>>, ...> as Future>::Error == Foo`
|
||||
╭▸ $DIR/E0271.rs:20:5
|
||||
│
|
||||
LL │ ┏ Box::new(
|
||||
LL │ ┃ Ok::<_, ()>(
|
||||
LL │ ┃ Err::<(), _>(
|
||||
LL │ ┃ Ok::<_, ()>(
|
||||
‡ ┃
|
||||
LL │ ┃ )
|
||||
LL │ ┃ )
|
||||
│ ┗━━━━━┛ type mismatch resolving `<Result<Result<(), Result<Result<(), ...>, ...>>, ...> as Future>::Error == Foo`
|
||||
╰╴
|
||||
note: expected this to be `Foo`
|
||||
╭▸ $DIR/E0271.rs:10:18
|
||||
│
|
||||
LL │ type Error = E;
|
||||
│ ━
|
||||
╰ note: required for the cast from `Box<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ()>>, ()>>, ()>>` to `Box<(dyn Future<Error = Foo> + 'static)>`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0271`.
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/flag-human.rs:7:17
|
||||
--> $DIR/flag-human.rs:9:17
|
||||
|
|
||||
LL | ..._: () = 42;
|
||||
| -- ^^ expected `()`, found integer
|
@ -1,9 +1,11 @@
|
||||
//@ compile-flags: --diagnostic-width=20
|
||||
//@ revisions: ascii unicode
|
||||
//@[ascii] compile-flags: --diagnostic-width=20
|
||||
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode --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
|
||||
//[ascii]~^ ERROR mismatched types
|
||||
}
|
||||
|
11
tests/ui/diagnostic-width/flag-human.unicode.stderr
Normal file
11
tests/ui/diagnostic-width/flag-human.unicode.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0308]: mismatched types
|
||||
╭▸ $DIR/flag-human.rs:9:17
|
||||
│
|
||||
LL │ …t _: () = 42;
|
||||
│ ┬─ ━━ expected `()`, found integer
|
||||
│ │
|
||||
╰╴ expected due to this
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/long-E0308.rs:44:9
|
||||
--> $DIR/long-E0308.rs:46:9
|
||||
|
|
||||
LL | let x: Atype<
|
||||
| _____________-
|
||||
@ -20,11 +20,11 @@ LL | | ))))))))))))))))))))))))))))));
|
||||
|
|
||||
= note: expected struct `Atype<Btype<..., ...>, ...>`
|
||||
found enum `Result<Result<..., ...>, ...>`
|
||||
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt'
|
||||
= note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/long-E0308.rs:57:26
|
||||
--> $DIR/long-E0308.rs:59:26
|
||||
|
|
||||
LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
|
||||
| __________________________^
|
||||
@ -36,11 +36,11 @@ LL | | ))))))))))))))))))))))));
|
||||
|
|
||||
= note: expected enum `Option<Result<..., ...>>`
|
||||
found enum `Result<Result<..., ...>, ...>`
|
||||
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt'
|
||||
= note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/long-E0308.rs:88:9
|
||||
--> $DIR/long-E0308.rs:90:9
|
||||
|
|
||||
LL | let x: Atype<
|
||||
| ____________-
|
||||
@ -56,11 +56,11 @@ LL | | > = ();
|
||||
|
|
||||
= note: expected struct `Atype<Btype<..., ...>, ...>`
|
||||
found unit type `()`
|
||||
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt'
|
||||
= note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/long-E0308.rs:91:17
|
||||
--> $DIR/long-E0308.rs:93:17
|
||||
|
|
||||
LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O...
|
||||
| ____________--___^
|
||||
@ -74,7 +74,7 @@ LL | | ))))))))))))))))))))))));
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found enum `Result<Result<..., ...>, ...>`
|
||||
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt'
|
||||
= note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt'
|
||||
= note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
error: aborting due to 4 previous errors
|
@ -1,4 +1,6 @@
|
||||
//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
|
||||
//@ revisions: ascii unicode
|
||||
//@[ascii] compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
|
||||
//@[unicode] compile-flags: -Zunstable-options=yes --json=diagnostic-unicode --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
|
||||
//@ normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
|
||||
|
||||
mod a {
|
||||
|
82
tests/ui/diagnostic-width/long-E0308.unicode.stderr
Normal file
82
tests/ui/diagnostic-width/long-E0308.unicode.stderr
Normal file
@ -0,0 +1,82 @@
|
||||
error[E0308]: mismatched types
|
||||
╭▸ $DIR/long-E0308.rs:46:9
|
||||
│
|
||||
LL │ let x: Atype<
|
||||
│ ┌─────────────┘
|
||||
LL │ │ Btype<
|
||||
LL │ │ Ctype<
|
||||
LL │ │ Atype<
|
||||
‡ │
|
||||
LL │ │ i32
|
||||
LL │ │ > = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O…
|
||||
│ │┏━━━━━│━━━┛
|
||||
│ └┃─────┤
|
||||
│ ┃ expected due to this
|
||||
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O…
|
||||
LL │ ┃ Ok("")
|
||||
LL │ ┃ ))))))))))))))))))))))))))))))
|
||||
LL │ ┃ ))))))))))))))))))))))))))))));
|
||||
│ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Atype<Btype<..., ...>, ...>`, found `Result<Result<..., ...>, ...>`
|
||||
│
|
||||
├ note: expected struct `Atype<Btype<..., ...>, ...>`
|
||||
│ found enum `Result<Result<..., ...>, ...>`
|
||||
├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt'
|
||||
╰ note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
error[E0308]: mismatched types
|
||||
╭▸ $DIR/long-E0308.rs:59:26
|
||||
│
|
||||
LL │ ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(…
|
||||
│ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
||||
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok…
|
||||
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
|
||||
LL │ ┃ ))))))))))))))))))))))))))))))
|
||||
LL │ ┃ ))))))))))))))))))))))));
|
||||
│ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Option<Result<..., ...>>`, found `Result<Result<..., ...>, ...>`
|
||||
│
|
||||
├ note: expected enum `Option<Result<..., ...>>`
|
||||
│ found enum `Result<Result<..., ...>, ...>`
|
||||
├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt'
|
||||
╰ note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
error[E0308]: mismatched types
|
||||
╭▸ $DIR/long-E0308.rs:90:9
|
||||
│
|
||||
LL │ let x: Atype<
|
||||
│ ┌────────────┘
|
||||
LL │ │ Btype<
|
||||
LL │ │ Ctype<
|
||||
LL │ │ Atype<
|
||||
‡ │
|
||||
LL │ │ i32
|
||||
LL │ │ > = ();
|
||||
│ │ │ ━━ expected `Atype<Btype<..., ...>, ...>`, found `()`
|
||||
│ └─────┤
|
||||
│ expected due to this
|
||||
│
|
||||
├ note: expected struct `Atype<Btype<..., ...>, ...>`
|
||||
│ found unit type `()`
|
||||
├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt'
|
||||
╰ note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
error[E0308]: mismatched types
|
||||
╭▸ $DIR/long-E0308.rs:93:17
|
||||
│
|
||||
LL │ let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(…
|
||||
│ ┏━━━━━━━━━━━━┬─━━━┛
|
||||
│ ┃ │
|
||||
│ ┃ expected due to this
|
||||
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok…
|
||||
LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
|
||||
LL │ ┃ ))))))))))))))))))))))))))))))
|
||||
LL │ ┃ ))))))))))))))))))))))));
|
||||
│ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `()`, found `Result<Result<..., ...>, ...>`
|
||||
│
|
||||
├ note: expected unit type `()`
|
||||
│ found enum `Result<Result<..., ...>, ...>`
|
||||
├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt'
|
||||
╰ note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -1,5 +1,5 @@
|
||||
error[E0369]: cannot add `&str` to `&str`
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:5:260
|
||||
--> $DIR/non-1-width-unicode-multiline-label.rs:7:260
|
||||
|
|
||||
LL | ...ཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇...࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
|
||||
| -------------- ^ -------------- &str
|
@ -1,7 +1,9 @@
|
||||
//@ revisions: ascii unicode
|
||||
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode
|
||||
// ignore-tidy-linelength
|
||||
|
||||
fn main() {
|
||||
let unicode_is_fun = "‱ஹ௸௵꧄.ဪ꧅⸻𒈙𒐫﷽𒌄𒈟𒍼𒁎𒀱𒌧𒅃 𒈓𒍙𒊎𒄡𒅌𒁏𒀰𒐪𒐩𒈙𒐫𪚥";
|
||||
let _ = "ༀ༁༂༃༄༅༆༇༈༉༊་༌།༎༏༐༑༒༓༔༕༖༗༘༙༚༛༜༝༞༟༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿ཀཁགགྷངཅཆཇཉཊཋཌཌྷཎཏཐདདྷནཔཕབབྷམཙཚཛཛྷཝཞཟའཡརལཤཥསཧཨཀྵཪཫཬཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿ྄ཱྀྀྂྃ྅྆྇ྈྉྊྋྌྍྎྏྐྑྒྒྷྔྕྖྗྙྚྛྜྜྷྞྟྠྡྡྷྣྤྥྦྦྷྨྩྪྫྫྷྭྮྯྰྱྲླྴྵྶྷྸྐྵྺྻྼ྾྿࿀࿁࿂࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌࿎࿏࿐࿑࿒࿓࿔࿕࿖࿗࿘࿙࿚"; let _a = unicode_is_fun + " really fun!";
|
||||
//~^ ERROR cannot add `&str` to `&str`
|
||||
//[ascii]~^ ERROR cannot add `&str` to `&str`
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
error[E0369]: cannot add `&str` to `&str`
|
||||
╭▸ $DIR/non-1-width-unicode-multiline-label.rs:7: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 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0369`.
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/non-whitespace-trimming-2.rs:4:311
|
||||
--> $DIR/non-whitespace-trimming-2.rs:6: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
|
@ -1,6 +1,8 @@
|
||||
//@ revisions: ascii unicode
|
||||
//@[unicode] compile-flags: -Zunstable-options=yes --error-format=human-unicode
|
||||
// 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
|
||||
//[ascii]~^ ERROR mismatched types
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
error[E0308]: mismatched types
|
||||
╭▸ $DIR/non-whitespace-trimming-2.rs:6: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 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
21
tests/ui/error-emitter/unicode-output.rs
Normal file
21
tests/ui/error-emitter/unicode-output.rs
Normal file
@ -0,0 +1,21 @@
|
||||
//@ compile-flags: -Zunstable-options=yes --error-format=human-unicode --color=always
|
||||
//@ edition:2018
|
||||
//@ only-linux
|
||||
|
||||
use core::pin::Pin;
|
||||
use core::future::Future;
|
||||
use core::any::Any;
|
||||
|
||||
fn query(_: fn(Box<(dyn Any + Send + '_)>) -> Pin<Box<(
|
||||
dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static
|
||||
)>>) {}
|
||||
|
||||
fn wrapped_fn<'a>(_: Box<(dyn Any + Send)>) -> Pin<Box<(
|
||||
dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static
|
||||
)>> {
|
||||
Box::pin(async { Err("nope".into()) })
|
||||
}
|
||||
|
||||
fn main() {
|
||||
query(wrapped_fn);
|
||||
}
|
72
tests/ui/error-emitter/unicode-output.svg
Normal file
72
tests/ui/error-emitter/unicode-output.svg
Normal file
@ -0,0 +1,72 @@
|
||||
<svg width="785px" height="434px" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.fg { fill: #AAAAAA }
|
||||
.bg { background: #000000 }
|
||||
.fg-ansi256-009 { fill: #FF5555 }
|
||||
.fg-ansi256-010 { fill: #55FF55 }
|
||||
.fg-ansi256-012 { fill: #5555FF }
|
||||
.fg-magenta { fill: #AA00AA }
|
||||
.container {
|
||||
padding: 0 10px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.bold { font-weight: bold; }
|
||||
tspan {
|
||||
font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
|
||||
white-space: pre;
|
||||
line-height: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
|
||||
|
||||
<text xml:space="preserve" class="container fg">
|
||||
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: mismatched types</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold"> ╭▸ </tspan><tspan>$DIR/unicode-output.rs:20:11</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> query(wrapped_fn);</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">┬────</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">━━━━━━━━━━</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">one type is more general than the other</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">arguments to this function are incorrect</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="172px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">╰ </tspan><tspan class="bold">note</tspan><tspan>: expected fn pointer `</tspan><tspan class="fg-magenta bold">for<'a> </tspan><tspan>fn(Box<</tspan><tspan class="fg-magenta bold">(dyn Any + Send + 'a)</tspan><tspan>>) -> Pin<_>`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="190px"><tspan> found fn item `fn(Box<</tspan><tspan class="fg-magenta bold">(dyn Any + Send + 'static)</tspan><tspan>>) -> Pin<_> {wrapped_fn}`</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold"> ╭▸ </tspan><tspan>$DIR/unicode-output.rs:9:4</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="262px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> fn query(_: fn(Box<(dyn Any + Send + '_)>) -> Pin<Box<(</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">┌────</tspan><tspan class="fg-ansi256-010 bold">━━━━━</tspan><tspan class="fg-ansi256-012 bold">─┘</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="298px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="316px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> )>>) {}</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="334px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">╰╴</tspan><tspan class="fg-ansi256-012 bold">└───┘</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="352px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="370px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="388px">
|
||||
</tspan>
|
||||
<tspan x="10px" y="406px"><tspan class="bold">For more information about this error, try `rustc --explain E0308`.</tspan>
|
||||
</tspan>
|
||||
<tspan x="10px" y="424px">
|
||||
</tspan>
|
||||
</text>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 4.6 KiB |
@ -15,7 +15,7 @@ error: character constant must be escaped: `\n`
|
||||
LL | '
|
||||
| ______^
|
||||
LL | | ';
|
||||
| |_
|
||||
| |_^
|
||||
|
|
||||
help: escape the character
|
||||
|
|
||||
|
Loading…
Reference in New Issue
Block a user