Esteban Küber
4bb771615e
Bring attention to suggestions when the only difference is capitalization
2019-10-13 21:48:39 -07:00
Mazdak Farrokhzad
153d3c3ea7
Rollup merge of #65120 - AnthonyMikh:fix_65119, r=estebank
...
Correctly estimate the required space for string in `StyledBuffer::prepend`
Fix #65119
r? @estebank
2019-10-08 15:45:28 +02:00
Tyler Mandry
c7d7e3730a
Rollup merge of #64909 - estebank:turbofish-reloaded, r=Centril
...
When encountering chained operators use heuristics to recover from bad turbofish
2019-10-05 21:54:52 -07:00
AnthonyMikh
4414068cc4
Correctly estimate required space for string
...
`.len()` returns length in bytes so it overestimates the required space
2019-10-05 03:08:05 +03:00
Esteban Küber
76456e7406
review comments
2019-10-03 19:32:56 -07:00
Esteban Küber
02f57f83a9
review comments
2019-10-03 13:22:18 -07:00
AnthonyMikh
df203a297f
Compare primary with value instead of dropping it
2019-10-02 19:48:21 +03:00
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