about summary refs log tree commit diff
path: root/src/librustc_errors/emitter.rs
AgeCommit message (Collapse)AuthorLines
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-4/+4
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-1/+1
2017-07-23Auto merge of #43096 - estebank:ascription-help, r=nikomatsakisbors-2/+3
Point at `:` when using it instead of `;` When triggering type ascription in such a way that we can infer a statement end was intended, add a suggestion for the change. Always point out the reason for the expectation of a type is due to type ascription. Fix #42057, #41928.
2017-07-18reorder span labelsgaurikholkar-2/+13
2017-07-17Add flag to hide code on inline suggestionsEsteban Küber-2/+3
Now there's a way to add suggestions that hide the suggested code when presented inline, to avoid weird wording when short code snippets are added at the end.
2017-07-17Change some helps to suggestionsOliver Schneider-1/+1
2017-07-06Remove unused code from librustc_errorsKevin Mehall-10/+2
2017-07-06Only underline suggestion if it is not the only code being shownEsteban Küber-12/+11
2017-07-06Add extra whitespace for suggestionsEsteban Küber-6/+31
2017-07-06Make suggestion include the line numberEsteban Küber-7/+11
When there're more than one suggestions in the same diagnostic, they are displayed in their own block, instead of inline. In order to reduce confusion, those blocks now display the line number.
2017-06-24Suggest removal of semicolon (instead of being help)Esteban Küber-1/+6
2017-06-18Auto merge of #42593 - ibabushkin:on-demand-external-source, r=eddybbors-5/+7
Implement lazy loading of external crates' sources. Fixes #38875 Fixes #38875. This is a follow-up to #42507. When a (now correctly translated) span from an external crate is referenced in a error, warning or info message, we still don't have the source code being referenced. Since stuffing the source in the serialized metadata of an rlib is extremely wasteful, the following scheme has been implemented: * File maps now contain a source hash that gets serialized as well. * When a span is rendered in a message, the source hash in the corresponding file map(s) is used to try and load the source from the corresponding file on disk. If the file is not found or the hashes don't match, the failed attempt is recorded (and not retried). * The machinery fetching source lines from file maps is augmented to use the lazily loaded external source as a secondary fallback for file maps belonging to external crates. This required a small change to the expected stderr of one UI test (it now renders a span, where previously was none). Further work can be done based on this - some of the machinery previously used to hide external spans is possibly obsolete and the hashing code can be reused in different places as well. r? @eddyb
2017-06-15Position span label correctly when it isn't lastEsteban Küber-2/+5
2017-06-12External spans: address review.Inokentiy Babushkin-6/+3
* The lazy loading mechanism has been moved to a more appropriate place. * Return values from the functions invoked there are properly used. * Documentation has gotten some minor improvements. * Possibly some larger restructuring will need to take place still.
2017-06-11Added consumption logic for external sources in FileMapInokentiy Babushkin-2/+4
We now fetch source lines from the `external_src` member as a secondary fallback if no regular source is present, that is, if the file map belongs to an external crate and the source has been fetched from disk.
2017-06-11Improved lazy external source loading and inserted calls.Inokentiy Babushkin-1/+4
2017-05-31Use callsite's span for macro calls on suggestionEsteban Küber-5/+3
When suggesting an appropriate mutability for a macro call, use the call span instead of the expanded macro's span.
2017-05-19fix some clippy warnings in librustc_errorsAndre Bogus-4/+2
2017-05-12Rollup merge of #41934 - est31:remove_unused_macros, r=nagisaMark Simulacrum-15/+0
Remove unused macros from the codebase Thanks to the lint I've implemented in #41907 I've found some unused macros inside the rustc codebase.
2017-05-12Remove some unused macros from the rust codebaseest31-15/+0
Removes unused macros from: * libcore * libcollections The last use of these two macros was removed in commit b64c9d56700e2c41207166fe8709711ff02488ff when the char_range_at_reverse function was been removed. * librustc_errors Their last use was removed by commits 2f2c3e178325dc1837badcd7573c2c0905fab979 and 11dc974a38fd533aa692cea213305056cd3a6902. * libsyntax_ext * librustc_trans Also, put the otry macro in back/msvc/mod.rs under the same cfg argument as the places that use it.
2017-05-11Address PR reviewsOliver Schneider-28/+22
2017-05-10Example usage of multiple suggestionsOliver Schneider-9/+19
2017-05-10Refactor suggestion diagnostic API to allow for multiple suggestionsOliver Schneider-30/+45
2017-05-03Fix issue #41652.kennytm-2/+9
Don't print the source code in emit_message_default() and render_source_line() if the source code is None.
2017-04-25Rebase and address commentsOliver Schneider-1/+1
2017-04-25Improve E0178 suggestion placementOliver Schneider-3/+6
2017-04-25Address PR commentsOliver Schneider-1/+3
2017-04-25Minimize single span suggestions into a noteOliver Schneider-4/+18
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