about summary refs log tree commit diff
path: root/src/librustc_errors/emitter.rs
AgeCommit message (Collapse)AuthorLines
2019-10-02Compare primary with value instead of dropping itAnthonyMikh-1/+2
2019-10-01Fix borrowck errorsAnthonyMikh-2/+2
Reborrowing doesn't work for loops
2019-10-01Hint type for `.sum()`AnthonyMikh-1/+1
2019-10-01Ascript type explicitlyAnthonyMikh-1/+1
2019-10-01Fix errorsAnthonyMikh-10/+10
2019-10-01(fmt) remove trailing whitespacesAnthonyMikh-2/+2
2019-10-01Use pattern matching instead of indexing tuplesAnthonyMikh-4/+2
2019-10-01Simplify a conditional in `collect_annotations`AnthonyMikh-16/+11
Also avoid excessive cloning
2019-10-01Remove redundant `.iter_mut()`AnthonyMikh-1/+1
2019-10-01Simplify `EmitterWriter::emit_suggestion_default`AnthonyMikh-104/+107
Make function return early if source map is not present
2019-09-30Update doc comment for `style_or_override`AnthonyMikh-1/+1
2019-09-30Simplify `EmitterWriter::get_max_line_num`AnthonyMikh-8/+4
2019-09-30Simplify `EmitterWriter::get_multispan_max_line_num`AnthonyMikh-16/+16
2019-09-30Simplify code for special case of annotationAnthonyMikh-12/+10
2019-09-27Revert "Simplify Unicode-aware trimming"AnthonyMikh-15/+12
`taken` is actually used afterwards
2019-09-26Simplify `style_or_override`AnthonyMikh-6/+4
2019-09-26Use `sort_by_key` rather than `sort_by`AnthonyMikh-2/+2
2019-09-26Simplify `Emitter::fix_multispan_in_std_macros`AnthonyMikh-64/+65
1. Rewrite `if let` into `match` to return earl and avoid indenting giant block 2. Assign `spans_updated` only once
2019-09-25Unify order of variables in chained comparisonAnthonyMikh-1/+1
2019-09-25Use Option::map_or where applicableAnthonyMikh-8/+3
2019-09-25Use map + sum instead of fold for computing Unicode widthAnthonyMikh-9/+9
2019-09-25Simplify Unicode-aware trimmingAnthonyMikh-12/+15
2019-09-25Use `max` instead of `if`sAnthonyMikh-9/+3
2019-09-25Use `saturating_sub` where applicableAnthonyMikh-18/+6
2019-09-23changed a line from an if else to std::cmp::maxhman523-1/+1
2019-09-23Fixed issue from #64447hman523-3/+2
2019-09-23Auto merge of #64272 - Mark-Simulacrum:parallel-handler, r=estebankbors-6/+14
Refactor librustc_errors::Handler API This should be reviewed by-commit. The last commit moves all fields into an inner struct behind a single lock; this is done to prevent possible deadlocks in a multi-threaded compiler, as well as inconsistent state observation.
2019-09-17Rollup merge of #64429 - afnanenayet:afnan/fix-failure-note-json-level, ↵Tyler Mandry-6/+9
r=Mark-Simulacrum Fix failure note `to_str` implementation Serialize the level to something a little more useful for a failure note struct. This fixes #60425.
2019-09-17Replace DiagnosticBuilder with Diagnostic when emitting errorMark Rousskov-6/+14
2019-09-16Fix failure note `to_str` implementationAfnan Enayet-6/+9
* Serialize the level to something a little more useful for a failure note struct * Update tests accordingly
2019-09-12Box `DiagnosticBuilder`.Nicholas Nethercote-1/+1
It's a large type -- 176 bytes on 64-bit. And it's passed around and returned from a lot of functions, including within PResult. This commit boxes it, which reduces memory traffic. In particular, `PResult` shrinks to 16 bytes in the best case; this reduces instruction counts by up to 2% on various workloads.
2019-09-05annotate-snippet emitter: Deal with multispans from macros, tooPhilipp Hansch-122/+129
This moves the two methods from the `EmitterWriter` impl to trait default methods in the `Emitter` trait so that they can be re-used by the `AnnotateSnippetEmitterWriter`. Closes #61810
2019-09-03Rollup merge of #64058 - phansch:refactor_out_method, r=estebankMazdak Farrokhzad-9/+31
librustc_errors: Extract sugg/subst handling into method An initial refactoring before working on #61809. This moves the whole block into a method so that it can be reused in the annotate-snippet emitter. The method is already used in the new emitter, but there's no UI tests with suggestions included in this PR. A first look at some UI tests with suggestions showed that there's some more work to do in [annotate-snippet-rs][annotate-snippet-rs] before the new output is closer to the current one, so I opted to do that in a second step. r? @estebank [annotate-snippet-rs]: https://github.com/rust-lang/annotate-snippets-rs
2019-09-01librustc_errors: Extract sugg/subst handling into methodPhilipp Hansch-9/+31
An initial refactoring before working on #61809. This moves the whole block into a method so that it can be reused in the annotate-snippet output. It's already used in the new emitter, but there's no UI tests with suggestions included in this PR. A first look at some UI tests with suggestions showed that there's some more work to do in [annotate-snippet-rs][annotate-snippet-rs] before the new output is closer to the current one.
2019-08-31Use saturating_subEsteban Küber-4/+6
2019-08-30Tweak terminal width trimmingEsteban Küber-2/+2
Properly account for left margin when setting terminal width through CLI flag and don't trim code by default if we can't get the terminal's dimensions.
2019-08-30Account for rounding errors when deciding the diagnostic boundariesEsteban Küber-2/+2
2019-08-21Add terminal_width debugging flagEsteban Küber-7/+17
2019-08-21Further unicode checksEsteban Küber-10/+20
2019-08-21Center trim on the span labels and handle unicodeEsteban Küber-22/+35
2019-08-21Fix tidyEsteban Küber-11/+10
2019-08-21Introduce `term-size` dependency and consider term width when trimmingEsteban Küber-93/+159
2019-08-21clean upEsteban Küber-63/+157
2019-08-21Strip code to the left and right in diagnostics for long linesEsteban Küber-32/+118
2019-07-11syntax: Make def-site span mandatory in ↵Vadim Petrochenkov-33/+31
ExpnInfo/MacroBacktrace/DiagnosticSpanMacroExpansion We have to deal with dummy spans anyway Remove def-site span from expander interfaces. It's not used by the expansion infra, only by specific expanders, which can keep it themselves if they want it.
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-06-26Fix clippy::print_with_newlineIgor Matuszewski-2/+2
2019-06-10librustc_errors: Add some more documentationPhilipp Hansch-0/+9
2019-06-05librustc_errors: Rename AnnotateRs -> AnnotateSnippetPhilipp Hansch-2/+2
The proper name of the library is `annotate-snippet`, not `annotate-rs`, this commit should get rid of any confusing `AnnotateRs` names. 1. Renames `annotate_rs_emitter.rs` to `annotate_snippet_emitter_writer.rs` so that the difference between the `Emitter` trait and the implementers is more clear. 2. Renames `AnnotateRsEmitterWriter` to `AnnotateSnippetEmitterWriter` 3. Renames `HumanReadableErrorType::AnnotateRs` to `HumanReadableErrorType::AnnotateSnippet`
2019-06-04Add new diagnostic writer using annotate-snippet libraryPhilipp Hansch-2/+4
This adds a new diagnostic writer `AnnotateRsEmitterWriter` that uses the [`annotate-snippet`][as] library to print out the human readable diagnostics. The goal is to eventually switch over to using the library instead of maintaining our own diagnostics output. This commit does *not* add all the required features to the new diagnostics writer. It is only meant as a starting point so that other people can contribute as well. [as]: https://github.com/rust-lang/annotate-snippets-rs