Commit Graph

450 Commits

Author SHA1 Message Date
Esteban Küber 508d032647 review comment: deduplicate logic 2019-10-24 15:44:43 -07:00
Esteban Küber 0baf61bfdb Increase spacing for suggestions in diagnostics
Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.
2019-10-24 12:26:01 -07:00
bors 4a8c5b20c7 Auto merge of #57545 - bovinebuddha:object_safe_for_dispatch, r=nikomatsakis
Object safe for dispatch

cc #43561
2019-10-23 13:34:27 +00:00
Mathias Blikstad ef5acdeceb RFC 2027: "first draft" of implementation
These are a squashed series of commits.
2019-10-22 15:24:33 -04:00
varkor f042687959 Fix plural mistake in emitter.rs 2019-10-19 18:08:54 +01:00
Philipp Hansch 6c75e81561 Refactor: Rename db locals to diag
https://github.com/rust-lang/rust/pull/64272 replaced
`DiagnosticBuilder` with `Diagnostic` in some places. This commit just
renames the DB variable from `db` to `diag` where it wasn't renamed.
2019-10-15 08:19:43 +02:00
Esteban Küber 8bf6d35377 Tweak heuristics for less noise 2019-10-14 14:48:45 -07:00
Esteban Küber 6dd718ca79 Use heuristics for capitalization warning in suggestions 2019-10-14 14:32:10 -07:00
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