about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/emitter.rs
AgeCommit message (Collapse)AuthorLines
2023-04-01a couple clippy::complexity fixesMatthias Krüger-1/+1
map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference
2023-03-28Create AnnotationColumn struct to fix hard tab column numbers in errorspommicket-21/+30
2023-03-04Properly colorize multi-part suggestions in the same lineEsteban Küber-5/+5
Fix #108547.
2023-02-14More accurate spans for arg removal suggestionEsteban Küber-1/+2
2023-02-13Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisaMatthias Krüger-2/+15
Introduce `-Zterminal-urls` to use OSC8 for error codes Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-09Introduce `-Zterminal-urls` to use OSC8 for error codesEsteban Küber-2/+15
Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-09test: snapshot for derive suggestion in diff filesbohan-11/+11
2023-02-05Clean up and comment EmitterWriter.draw_code_lineCastilloDel-59/+32
2023-02-04Fix suggestions rendering when the span is multilineCastilloDel-17/+63
2023-01-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-23/+31
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-3/+3
2023-01-08Make translate_message return result and add testsmejrs-4/+7
2022-12-29Account for multiple multiline spans with empty paddingEsteban Küber-3/+19
Instead of ``` LL | fn oom( | __^ | | _| | || LL | || ) { | ||_- LL | | } | |__^ ``` emit ``` LL | // fn oom( LL | || ) { | ||_- LL | | } | |__^ ```
2022-12-15more clippy::complexity fixesMatthias Krüger-1/+1
2022-12-13Avoid rendering empty annotationsOli Scherer-37/+44
2022-12-13Don't emit empty notesOli Scherer-17/+19
2022-12-12minor code cleanupsMatthias Krüger-2/+2
2022-12-06Properly indent messagesOli Scherer-6/+18
2022-12-06Start emitting labels even if their pointed to file is not available locallyOli Scherer-0/+42
2022-12-06remove an unnecessary `?`Oli Scherer-2/+1
2022-12-06Simplify span fallbackOli Scherer-47/+23
2022-12-06Simplify some nested conditionsOli Scherer-10/+3
2022-12-01Remove useless borrows and derefsMaybe Waffle-13/+13
2022-11-28Tweak outputEsteban Küber-1/+1
2022-11-28Change multiline span ASCII art visual orderEsteban Küber-1/+7
2022-11-24Auto merge of #104507 - WaffleLapkin:asderefsyou, r=wesleywiserbors-1/+1
Use `as_deref` in compiler (but only where it makes sense) This simplifies some code :3 (there are some changes that are not exacly `as_deref`, but more like "clever `Option`/`Result` method use")
2022-11-19Rollup merge of #103117 - joshtriplett:use-is-terminal, r=eholkMatthias Krüger-3/+3
Use `IsTerminal` in place of `atty` In any crate that can use nightly features, use `IsTerminal` rather than `atty`: - Use `IsTerminal` in `rustc_errors` - Use `IsTerminal` in `rustc_driver` - Use `IsTerminal` in `rustc_log` - Use `IsTerminal` in `librustdoc`
2022-11-16Use `as_deref` in compiler (but only where it makes sense)Maybe Waffle-1/+1
2022-11-11Print all labels, even if they have no span. Fall back to main item's span.Oli Scherer-12/+35
2022-11-11Remove some redundant argumentsOli Scherer-8/+5
2022-10-24Address some commentsmejrs-2/+2
2022-10-19Implement -Ztrack-diagnosticsmejrs-5/+31
2022-10-16Use IsTerminal in rustc_errorsJosh Triplett-3/+3
2022-10-10errors: use `HashMap` to store diagnostic argsDavid Wood-2/+2
Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-09-13Don't render inline suggestions of only spacesMichael Goulet-4/+1
2022-09-12Don't trim substitution if it's only whitespaceMichael Goulet-9/+19
2022-09-12A SubstitutionPart is not a deletion if it replaces nothing with nothingMichael Goulet-1/+1
2022-09-10rustc_error, rustc_private, rustc_ast: Switch to stable hash containersNiklas Jonsson-2/+2
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module
2022-08-15errors: move translation logic into moduleDavid Wood-110/+18
Just moving code around so that triagebot can ping relevant parties when translation logic is modified. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-10errors: don't fail on broken primary translationsDavid Wood-31/+49
If a primary bundle doesn't contain a message then the fallback bundle is used. However, if the primary bundle's message is broken (e.g. it refers to a interpolated variable that the compiler isn't providing) then this would just result in a compiler panic. While there aren't any primary bundles right now, this is the type of issue that could come up once translation is further along. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-19Mention first and last macro in backtraceMichael Goulet-6/+18
2022-07-06session: `output-width` -> `diagnostic-width`David Wood-8/+8
Rename the `--output-width` flag to `--diagnostic-width` as this appears to be the preferred name within the compiler team. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06session: `terminal-width` -> `output-width`David Wood-8/+8
Rename the `--terminal-width` flag to `--output-width` as the behaviour doesn't just apply to terminals (and so is slightly less accurate). Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-28Migrate some rustc_borrowck diagnostics to SessionDiagnosticMichael Goulet-2/+12
2022-06-20remove MAX_SUGGESTION_HIGHLIGHT_LINESMaybe Waffle-5/+0
2022-06-17Auto merge of #97892 - klensy:fix-spaces, r=oli-obkbors-4/+8
diagnostics: remove trailing spaces Remove few occurrences of trailing spaces and drive by fix of needless alloc of const string.
2022-06-16Add back MAX_SUGGESTION_HIGHLIGHT_LINES so clippy is happy & buildableMaybe Waffle-0/+5
2022-06-16Try to clean up code...Maybe Waffle-93/+150
I'm not sure if I succeeded
2022-06-16Improve suggestions when its parts are far from each otherMaybe Waffle-68/+99
Previously we only show at most 6 lines of suggestions and, if the suggestions are more than 6 lines apart, we've just showed ... at the end. This is probably fine, but quite confusing in my opinion. This commit is an attempt to show ... in places where there is nothing to suggest instead, for example: Before: ```text help: consider enclosing expression in a block | 3 ~ 'l: { match () { () => break 'l, 4 | 5 | 6 | 7 | 8 | ... ``` After: ```text help: consider enclosing expression in a block | 3 ~ 'l: { match () { () => break 'l, 4 | ... 31| 32~ } }; | ```