Commit graph

435 commits

Author SHA1 Message Date
AnthonyMikh
bd7cd80299
Fully clear HandlerInner in Handler::reset_err_count 2019-10-02 04:13:02 +03:00
AnthonyMikh
50c2a58d08
Fix borrowck errors
Reborrowing doesn't work for loops
2019-10-01 03:22:07 +03:00
AnthonyMikh
fdce4168fc
Hint type for .sum() 2019-10-01 03:04:01 +03:00
AnthonyMikh
515262cc13
Ascript type explicitly 2019-10-01 02:53:44 +03:00
AnthonyMikh
61bc38ecaa
Fix errors 2019-10-01 02:38:35 +03:00
AnthonyMikh
e5db5b34d7
(fmt) remove trailing whitespaces 2019-10-01 02:30:52 +03:00
AnthonyMikh
bb442881fc
Use pattern matching instead of indexing tuples 2019-10-01 01:12:36 +03:00
AnthonyMikh
55b54285c8
Simplify a conditional in collect_annotations
Also avoid excessive cloning
2019-10-01 01:08:51 +03:00
AnthonyMikh
9d73176978
Remove redundant .iter_mut() 2019-10-01 00:10:23 +03:00
AnthonyMikh
7a807c5b14
Simplify EmitterWriter::emit_suggestion_default
Make function return early if source map is not present
2019-10-01 00:01:22 +03:00
AnthonyMikh
21724eda05
Update doc comment for style_or_override 2019-09-30 23:50:58 +03:00
AnthonyMikh
7b4c5c62aa
Simplify EmitterWriter::get_max_line_num 2019-09-30 23:47:51 +03:00
AnthonyMikh
6b6a79b190
Simplify EmitterWriter::get_multispan_max_line_num 2019-09-30 23:43:24 +03:00
AnthonyMikh
7dc953b493
Simplify code for special case of annotation 2019-09-30 23:33:17 +03:00
AnthonyMikh
75a7c27a54
Revert "Simplify Unicode-aware trimming"
`taken` is actually used afterwards
2019-09-27 00:58:18 +03:00
AnthonyMikh
7a0725fdaf
Simplify style_or_override 2019-09-26 00:42:55 +03:00
AnthonyMikh
ea32862503
Use sort_by_key rather than sort_by 2019-09-26 00:38:36 +03:00
AnthonyMikh
f93827f9e4
Simplify Emitter::fix_multispan_in_std_macros
1. Rewrite `if let` into `match` to return earl and avoid indenting giant block 
2. Assign `spans_updated` only once
2019-09-26 00:31:16 +03:00
AnthonyMikh
9b447e2f9f
Unify order of variables in chained comparison 2019-09-25 23:46:33 +03:00
AnthonyMikh
aef169b4e6
Use Option::map_or where applicable 2019-09-25 23:41:27 +03:00
AnthonyMikh
d6327e8f12
Use map + sum instead of fold for computing Unicode width 2019-09-25 23:23:19 +03:00
AnthonyMikh
4fc5650d17
Simplify Unicode-aware trimming 2019-09-25 23:13:19 +03:00
AnthonyMikh
e9a93be53a
Use max instead of ifs 2019-09-25 23:08:09 +03:00
AnthonyMikh
2cb460e625
Use saturating_sub where applicable 2019-09-25 22:55:04 +03:00
Mazdak Farrokhzad
bea19338d2
Rollup merge of #64721 - hman523:issue64447, r=estebank
Fixed issue from #64447

Did two tiny fixes. One is a micro optimization since we know that max is going to be assigned a `usize`, we do not have to worry about a possible negative number.
The other issue that was fixed is that the max from the children isn't updated correctly. Now it will use `sub_result` instead of `primary` and will properly get the needed value.
2019-09-24 23:45:31 +02:00
hman523
a6da0e921b changed a line from an if else to std::cmp::max 2019-09-23 19:51:15 -05:00
hman523
fa2cfaf064 Fixed issue from #64447 2019-09-23 18:20:21 -05:00
Mazdak Farrokhzad
f70665a846 cleanup librustc_errors Handler code. 2019-09-23 22:28:14 +02:00
Mazdak Farrokhzad
62fc4d36df stash_diagnostic: ICE in a different way 2019-09-23 19:29:02 +02:00
Mazdak Farrokhzad
ae8b3e8fc6 Introduce a diagnostic stashing API. 2019-09-23 17:50:06 +02:00
bors
66bf391c3a Auto merge of #64272 - Mark-Simulacrum:parallel-handler, r=estebank
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-23 06:38:23 +00:00
Tyler Mandry
ffee7bbf9a
Rollup merge of #64429 - afnanenayet:afnan/fix-failure-note-json-level, 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-17 14:10:48 -07:00
Mark Rousskov
4cc5aaada2 Protect error handler fields with single lock
This avoids concurrency-related bugs when locks are acquired for too
short a time and similar cases.
2019-09-17 09:30:45 -04:00
Mark Rousskov
2a767eec0c Remove unused methods from Handler 2019-09-17 09:30:45 -04:00
Mark Rousskov
b304e60131 Remove Handler::{emit, emit_with_code} 2019-09-17 09:30:45 -04:00
Mark Rousskov
998df0d70b Remove Handler::cancel 2019-09-17 09:30:44 -04:00
Mark Rousskov
2a3930d43c Privatize DiagnosticBuilder constructors 2019-09-17 09:30:44 -04:00
Mark Rousskov
0b586b436d Take Diagnostic in Handler::emit_diagnostic 2019-09-17 09:30:44 -04:00
Mark Rousskov
cdd805506e Replace DiagnosticBuilder with Diagnostic when emitting error 2019-09-17 09:29:46 -04:00
Afnan Enayet
02c1b892c1
Fix failure note to_str implementation
* Serialize the level to something a little more useful for a failure note
  struct
* Update tests accordingly
2019-09-16 22:30:59 -07:00
Mazdak Farrokhzad
af33a1d902
Rollup merge of #64374 - nnethercote:box-DiagnosticBuilder, r=zackmdavis
Box `DiagnosticBuilder`.

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. The commit touches a lot of
lines but it's almost all trivial plumbing changes.
2019-09-14 16:42:26 +02:00
Nicholas Nethercote
2fcd870711 Box DiagnosticBuilder.
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-12 08:29:17 +10:00
V1shvesh
7457ef8580 Dedent macro definition 2019-09-08 23:01:43 +05:30
V1shvesh
fc4375a895 Remove extra trailing newline 2019-09-08 22:58:28 +05:30
V1shvesh
38ab20dbf7 Add pluralise macro
Adress issue #64238. Create a macro to be used for pluralisation check
throughout rustc codebase.
2019-09-08 15:09:50 +05:30
Mazdak Farrokhzad
8111cca73e
Rollup merge of #64206 - phansch:update_issue_number, r=varkor
annotate-snippet emitter: Update an issue number

The tracking issue has been replaced by one with mentoring instructions (#64205).
2019-09-06 19:00:50 +02:00
Philipp Hansch
0ca645ac5f
annotate-snippet emitter: Update issue number
The tracking issue has been replaced by one with mentoring instructions.
2019-09-06 07:34:55 +02:00
Philipp Hansch
159d249705
annotate-snippet emitter: Deal with multispans from macros, too
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-05 21:31:12 +02:00
Mazdak Farrokhzad
586aeb4c9d
Rollup merge of #64058 - phansch:refactor_out_method, r=estebank
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-03 14:27:01 +02:00
Philipp Hansch
84ccbe2076
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 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-09-01 13:05:47 +02:00