summary refs log tree commit diff
path: root/src/librustc_errors/emitter.rs
AgeCommit message (Collapse)AuthorLines
2017-04-20Reduce visual clutter of multiline start when possibleEsteban Küber-13/+54
When a span starts on a line with nothing but whitespace to the left, and there are no other annotations in that line, simplify the visual representation of the span. Go from: ```rust error[E0072]: recursive type `A` has infinite size --> file2.rs:1:1 | 1 | struct A { | _^ starting here... 2 | | a: A, 3 | | } | |_^ ...ending here: recursive type has infinite size | ``` To: ```rust error[E0072]: recursive type `A` has infinite size --> file2.rs:1:1 | 1 | / struct A { 2 | | a: A, 3 | | } | |_^ recursive type has infinite size ``` Remove `starting here...`/`...ending here` labels from all multiline diagnostics.
2017-04-09Always show end line of multiline annotationsEsteban Küber-77/+119
```rust error[E0046]: not all trait items implemented, missing: `Item` --> $DIR/issue-23729.rs:20:9 | 20 | impl Iterator for Recurrence { | _________^ starting here... 21 | | //~^ ERROR E0046 22 | | //~| NOTE missing `Item` in implementation 23 | | //~| NOTE `Item` from trait: `type Item;` ... | 36 | | } 37 | | } | |_________^ ...ending here: missing `Item` in implementation | = note: `Item` from trait: `type Item;` ``` instead of ```rust error[E0046]: not all trait items implemented, missing: `Item` --> $DIR/issue-23729.rs:20:9 | 20 | impl Iterator for Recurrence { | ^ missing `Item` in implementation | = note: `Item` from trait: `type Item;` ```
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-11/+11
2017-03-10Fix incorrect span label formattingEsteban Küber-28/+34
2017-01-24Auto merge of #39214 - estebank:fix-labels-without-msg, r=nikomatsakisbors-30/+47
Fix multiple labels when some don't have message The diagnostic emitter now accounts for labels with no text message, presenting the underline on its own, without drawing the line for the non existing message below it. Go from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | | | `b` is a good letter | ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | `b` is a good letter ``` from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ | | | | | | `a` is a good letter ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ `a` is a good letter ``` and from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ | | | | | | ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ ``` r? @nikomatsakis cc @jonathandturner, @GuillaumeGomez, @nrc
2017-01-20Fix multiple labels when some don't have messageEsteban Küber-30/+47
The diagnostic emitter now accounts for labels with no text message, presenting the underline on its own, without drawing the line for the non existing message below it. Go from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | | | `b` is a good letter | ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | `b` is a good letter ``` and from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ | | | | | | `a` is a good letter ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ `a` is a good letter ```
2017-01-17Teach Diagnostics to highlight textEsteban Küber-26/+75
2017-01-09Deduplicate and document logicEsteban Küber-6/+23
2017-01-08Remove magic numberEsteban Küber-4/+4
2017-01-08Teach diagnostics to correct margin on multiline messagesEsteban Küber-47/+24
Make any diagnostic line to have the correct margin to align with the first line: ``` error: message --> file.rs:3:20 | 3 | <CODE> | ^^^^ | = note: this is a multiline note with a correct margin = note: this is a single line note = help: here are some functions which might fulfill your needs: - .len() - .foo() - .bar() = suggestion: this is a multiline suggestion with a correct margin ```
2017-01-08Use fold instead of collect/join and add commentsEsteban Küber-10/+39
2017-01-07Teach diagnostics to have correctly padded listsEsteban Küber-2/+17
Make the suggestion list have a correct padding: ``` error[E0308]: mismatched types --> file.rs:3:20 | 3 | let x: usize = ""; | ^^ expected usize, found reference | = note: expected type `usize` = note: found type `&'static str` = help: here are some functions which might fulfill your needs: - .len() - .foo() - .bar() ```
2016-11-23review commentsEsteban Küber-54/+28
2016-11-22Show multiline spans in full if short enoughEsteban Küber-105/+379
When dealing with multiline spans that span few lines, show the complete span instead of restricting to the first character of the first line. For example, instead of: ``` % ./rustc foo.rs error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied --> foo.rs:13:9 | 13 | foo(1 + bar(x, | ^ trait `{integer}: std::ops::Add<()>` not satisfied | ``` show ``` % ./rustc foo.rs error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied --> foo.rs:13:9 | 13 | foo(1 + bar(x, | ________^ starting here... 14 | | y), | |_____________^ ...ending here: trait `{integer}: std::ops::Add<()>` not satisfied | ```
2016-10-18run rustfmt on librustc_errors folderSrinivas Reddy Thatiparthy-90/+84
2016-09-28Allow supplying an error destination via the compiler driverNick Cameron-2/+4
Allows replacing stderr with a buffer from the client. Also, some refactoring around run_compiler.
2016-09-15Fix wording for out-of-crate macro errorJonathan Turner-1/+2
2016-09-11Use question_mark feature in librustc_errors.Ahmed Charles-17/+17
2016-08-31Special case a few colors for WindowsJonathan Turner-2/+13
2016-08-25prevent error message interleaving on win/unixJonathan Turner-2/+85
2016-08-19wording fixes in error messagesJonathan Turner-1/+3
2016-08-17Rebase. Fix mutable iteration nit.Jonathan Turner-1/+1
2016-08-17Replace local backtrace with def-use, repair std macro spansJonathan Turner-41/+103
2016-08-07Turn on new errors, json mode. Remove duplicate unicode testJonathan Turner-280/+8
2016-07-15Nudge travis by commenting a littleJonathan Turner-0/+1
2016-07-14Teach EmitterWriter about the dangers of quasi-quotingJonathan Turner-7/+20
2016-07-14Add in styled_buffer.rs and remove some unused codeJonathan Turner-52/+21
2016-07-14Fix up some tidy-unfriendly spacingJonathan Turner-3/+7
2016-07-14DCE and fixing some internal testsJonathan Turner-374/+32
2016-07-14Fix a couple UI test failuresJonathan Turner-11/+16
2016-07-14Add back in old school modeJonathan Turner-26/+265
2016-07-14Implement latest rfc style using simpler renderingJonathan Turner-40/+626
2016-07-14Remove CoreEmitter and focus on EmitterJonathan Turner-43/+36
2016-07-14Rename emit_struct->emitJonathan Turner-2/+2
2016-07-14Remove emit from emitter, leaving emit_structJonathan Turner-16/+0
2016-07-14Remove BasicEmitterJonathan Turner-73/+63
2016-06-23make old school mode a bit more configurableJonathan Turner-16/+30
2016-06-23Consolidate codemap tests and fix more errors for travisJonathan Turner-254/+1
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-0/+874