summary refs log tree commit diff
path: root/src/librustc_errors/emitter.rs
AgeCommit message (Collapse)AuthorLines
2017-12-14When attempting to write str with single quote suggest double quotesEsteban Küber-1/+5
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-5/+11
2017-12-14Auto merge of #46605 - estebank:macro-backtrace-spans, r=pnkfelixbors-53/+49
Use spans for -Z external-macro-backtrace ``` % rustc ui/type-check/cannot_infer_local_or_vec.rs -Z external-macro-backtrace error[E0282]: type annotations needed --> <vec macros>:3:1 | 1 | / ( $ elem : expr ; $ n : expr ) => ( 2 | | $ crate :: vec :: from_elem ( $ elem , $ n ) ) ; ( $ ( $ x : expr ) , * ) => ( 3 | | < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ) ) ; ( $ ( $ x : expr , ) * ) | | ^^^^^^^^^^^^^^^^^^^^^ | | | | | cannot infer type for `T` 4 | | => ( vec ! [ $ ( $ x ) , * ] ) | |______________________________- in this expansion of `vec!` | ::: ui/type-check/cannot_infer_local_or_vec.rs | 12 | let x = vec![]; | - ------ in this macro invocation | | | consider giving `x` a type error: aborting due to previous error ```
2017-12-09Resolve type on return type suggestionEsteban Küber-1/+1
2017-12-09Use spans for -Z external-macro-backtraceEsteban Küber-53/+49
``` % rustc ui/type-check/cannot_infer_local_or_vec.rs -Z external-macro-backtrace error[E0282]: type annotations needed --> <vec macros>:3:1 | 1 | / ( $ elem : expr ; $ n : expr ) => ( 2 | | $ crate :: vec :: from_elem ( $ elem , $ n ) ) ; ( $ ( $ x : expr ) , * ) => ( 3 | | < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ) ) ; ( $ ( $ x : expr , ) * ) | | ^^^^^^^^^^^^^^^^^^^^^ | | | | | cannot infer type for `T` 4 | | => ( vec ! [ $ ( $ x ) , * ] ) | |______________________________- in this expansion of `vec!` | ::: ui/type-check/cannot_infer_local_or_vec.rs | 12 | let x = vec![]; | - ------ in this macro invocation | | | consider giving `x` a type error: aborting due to previous error ```
2017-12-01Auto merge of #45997 - estebank:pub-ident, r=nikomatsakisbors-1/+1
Account for missing keyword in fn/struct definition Fix #38911.
2017-11-26mention nightly in -Z external-macro-backtrace noteAlex Burka-1/+2
2017-11-24Fix underline in suggestionsEsteban Küber-1/+1
2017-11-20address review commentsAlex Burka-8/+8
2017-11-19use -Z flag instead of env varAlex Burka-21/+30
2017-11-19add UI testAlex Burka-3/+6
2017-11-19show macro backtrace with env varAlex Burka-13/+46
2017-11-16Remove left over dead code from suggestion diagnostic refactoringOliver Schneider-42/+23
2017-11-09Auto merge of #45741 - oli-obk:refactor_suggestions, r=estebankbors-31/+36
Refactor internal suggestion API ~~The only functional change is that whitespace, which is suggested to be added, also gets `^^^^` under it. An example is shown in the tests (the only test that changed).~~ Continuation of #41876 r? @nagisa the changes are probably best viewed [without whitespace](https://github.com/rust-lang/rust/pull/45741/files?w=1)
2017-11-06Do not highlight surrounding whitespaceOliver Schneider-6/+7
2017-11-04Auto merge of #45711 - tirr-c:unicode-span, r=estebankbors-7/+7
Display spans correctly when there are zero-width or wide characters Hopefully... * fixes #45211 * fixes #8706 --- Before: ``` error: invalid width `7` for integer literal --> unicode_2.rs:12:25 | 12 | let _ = ("a̐éö̲", 0u7); | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `42` for integer literal --> unicode_2.rs:13:20 | 13 | let _ = ("아あ", 1i42); | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: aborting due to 2 previous errors ``` After: ``` error: invalid width `7` for integer literal --> unicode_2.rs:12:25 | 12 | let _ = ("a̐éö̲", 0u7); | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `42` for integer literal --> unicode_2.rs:13:20 | 13 | let _ = ("아あ", 1i42); | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: aborting due to 2 previous errors ``` Spans might display incorrectly on the browser. r? @estebank
2017-11-03Refactor internal suggestion APIOliver Schneider-35/+39
2017-11-03Display spans correctly when there are non-half-width charactersWonwoo Choi-7/+7
2017-11-02Make the difference between lint codes and error codes explicitOliver Schneider-11/+8
2017-11-02Report lint names in json diagnosticsOliver Schneider-1/+2
2017-10-20Add short message-formatGuillaume Gomez-130/+164
2017-09-29fix comment typo, `CodeSuggestion` path in doc commentZack M. Davis-1/+1
`CodeSuggestion` doesn't live in the `diagnostic` module.
2017-08-30Make fields of `Span` privateVadim Petrochenkov-6/+6
2017-08-25Fix a byte/char confusion issue in the error emitterest31-1/+3
Fixes #44078. Fixes #44023. The start_col member is given in chars, while the code previously assumed it was given in bytes. The more basic issue #44080 doesn't get fixed.
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-1/+1
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
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