about summary refs log tree commit diff
path: root/src/librustc_errors
AgeCommit message (Collapse)AuthorLines
2019-11-21Auto merge of #66610 - alexreg:trait-upcasting-cosmetic, r=Centrilbors-1/+1
Aggregation of drive-by cosmetic changes for trait-upcasting PR Cherry-picked from #60900. As requested by @Centril (and @nikomatsakis, I believe). r? @Centril
2019-11-21Aggregation of drive-by cosmetic changes.Alexander Regueiro-1/+1
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-58/+77
Specific labels when referring to "expected" and "found" types
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-1/+20
Add outlives suggestions for some lifetime errors This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound: - If a and b are normal named regions, suggest to add the bound `'a: 'b` - If b is static, suggest to replace a with static - If b also needs to outlive a, they must be the same, so suggest unifying them We start with a simpler implementation that avoids diagnostic regression or implementation complexity: - We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions) - For now, we only emit a help note, not an actually suggestion because it is significantly easier. Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name. For more info, see this internals thread: https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3 TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above. r? @estebank TODO - [x] Clean up code - [x] Only make idiomatic suggestions - [x] don't suggest naming `&'a self` - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static` - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa - [x] Performance (maybe need a perf run when this is closer to the finish line?) - perf run was clean... - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress? - [x] Needs ui tests - [x] Integrate the `help` message into the main lifetime `error`
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-58/+77
2019-11-16review comments and fix rebaseEsteban Küber-0/+1
2019-11-15Move JSON emitter to rustc_errorsMark Rousskov-0/+640
2019-11-15Remove SourceMapper traitMark Rousskov-45/+24
SourceMap is now in the root of all rustc-specific crates, syntax_pos, so there's no need for the trait object to decouple the dependencies between librustc_errors and libsyntax as was needed previously.
2019-11-15Move FatalError to syntax_posMark Rousskov-30/+1
This is a bit unfortunate, but code needs to be able to fatally error early on (in particular, syntax_pos after we move SourceMap there). It's also a tiny bit of code, which means it's ultimately not that bad.
2019-11-11Tiny cleanup to size assertionsVadim Petrochenkov-3/+1
2019-11-07move PResult to librustc_errorsMazdak Farrokhzad-1/+9
2019-11-06Rollup merge of #66139 - euclio:pluralize, r=nagisaMazdak Farrokhzad-3/+3
use American spelling for `pluralize!`
2019-11-05use American spelling for `pluralize!`Andy Russell-3/+3
2019-11-03use silent emitter for rustdoc highlighting passAndy Russell-0/+8
2019-11-03Auto merge of #65827 - AnthonyMikh:out_of_the_loop, r=estebankbors-4/+3
Remove a loop which runs exactly once Though the code seems to work properly, it is worth removing the loop entirely in order to not confuse the reader. r? @estebank
2019-11-03Auto merge of #65779 - kevgrasso:E0308highlight, r=estebankbors-2/+2
Highlight only relevant parts of type path in type errors Resolves #57413. Unfortunately the current Rust UI testing setup can't test that the correct colors are being used in a given output, so here's a screenshot of a small test program I wrote: ![image](https://user-images.githubusercontent.com/480789/67530063-f272af00-f68b-11e9-9f96-a211fc7666d4.png)
2019-11-01Rollup merge of #65470 - traxys:fix_65401, r=michaelwoeristerTyler Mandry-0/+6
Don't hide ICEs from previous incremental compiles I think this fixes #65401, the compiler does not fail to ICE after the first compilation, tested on the last snippet of [this comment](https://github.com/rust-lang/rust/issues/63154#issuecomment-541592381). I am not very sure of the fix as I don't understand much of the structure of the compiler.
2019-10-27add and use struct_helpMark Mansi-0/+5
2019-10-27implement outlive suggestionsMark Mansi-1/+15
2019-10-27Remove a loop which runs exactly onceAnthonyMikh-4/+3
2019-10-24review comment: deduplicate logicEsteban Küber-27/+13
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+13
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-23debug messages addedKevyn Grasso-2/+2
2019-10-23Auto merge of #57545 - bovinebuddha:object_safe_for_dispatch, r=nikomatsakisbors-0/+31
Object safe for dispatch cc #43561
2019-10-22RFC 2027: "first draft" of implementationMathias Blikstad-0/+31
These are a squashed series of commits.
2019-10-19Fix plural mistake in emitter.rsvarkor-2/+3
2019-10-16Check if there are any delayed_span_bugs and abort incremental compilation ↵Quentin Boyer-0/+6
in this case
2019-10-15Refactor: Rename `db` locals to `diag`Philipp Hansch-20/+20
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-14Tweak heuristics for less noiseEsteban Küber-3/+3
2019-10-14Use heuristics for capitalization warning in suggestionsEsteban Küber-10/+23
2019-10-13Bring attention to suggestions when the only difference is capitalizationEsteban Küber-15/+53
2019-10-08Rollup merge of #65120 - AnthonyMikh:fix_65119, r=estebankMazdak Farrokhzad-1/+1
Correctly estimate the required space for string in `StyledBuffer::prepend` Fix #65119 r? @estebank
2019-10-05Rollup merge of #64909 - estebank:turbofish-reloaded, r=CentrilTyler Mandry-41/+78
When encountering chained operators use heuristics to recover from bad turbofish
2019-10-05Correctly estimate required space for stringAnthonyMikh-1/+1
`.len()` returns length in bytes so it overestimates the required space
2019-10-03review commentsEsteban Küber-47/+51
2019-10-03review commentsEsteban Küber-7/+40
2019-10-02Compare primary with value instead of dropping itAnthonyMikh-1/+2
2019-10-02Fully clear `HandlerInner` in `Handler::reset_err_count`AnthonyMikh-5/+8
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