summary refs log tree commit diff
path: root/src/librustc_errors/lib.rs
AgeCommit message (Collapse)AuthorLines
2020-01-23review commentsEsteban Küber-12/+9
2020-01-23Do not ICE on malformed suggestion spansEsteban Küber-0/+13
2020-01-23format librustc_errorsMark Rousskov-113/+109
2020-01-17Fix invalid bounding boxEsteban Küber-1/+1
(cherry picked from commit d558f6a570a782cd1c2e54de790f4f968b0de5f1)
2019-11-26Move ErrorReported to rustc_errorsMark Rousskov-0/+7
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+5
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-16review comments and fix rebaseEsteban Küber-0/+1
2019-11-15Move JSON emitter to rustc_errorsMark Rousskov-0/+1
2019-11-15Remove SourceMapper traitMark Rousskov-28/+5
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-05use American spelling for `pluralize!`Andy Russell-1/+1
2019-10-27add and use struct_helpMark Mansi-0/+5
2019-10-16Check if there are any delayed_span_bugs and abort incremental compilation ↵Quentin Boyer-0/+6
in this case
2019-10-14Use heuristics for capitalization warning in suggestionsEsteban Küber-4/+2
2019-10-13Bring attention to suggestions when the only difference is capitalizationEsteban Küber-11/+21
2019-10-03review commentsEsteban Küber-0/+2
2019-10-02Fully clear `HandlerInner` in `Handler::reset_err_count`AnthonyMikh-5/+8
2019-09-23cleanup librustc_errors Handler code.Mazdak Farrokhzad-135/+166
2019-09-23stash_diagnostic: ICE in a different wayMazdak Farrokhzad-9/+18
2019-09-23Introduce a diagnostic stashing API.Mazdak Farrokhzad-12/+72
2019-09-23Auto merge of #64272 - Mark-Simulacrum:parallel-handler, r=estebankbors-164/+225
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-17Protect error handler fields with single lockMark Rousskov-132/+204
This avoids concurrency-related bugs when locks are acquired for too short a time and similar cases.
2019-09-17Remove unused methods from HandlerMark Rousskov-6/+0
2019-09-17Remove Handler::{emit, emit_with_code}Mark Rousskov-31/+28
2019-09-17Remove Handler::cancelMark Rousskov-4/+0
2019-09-17Privatize DiagnosticBuilder constructorsMark Rousskov-3/+2
2019-09-17Take Diagnostic in Handler::emit_diagnosticMark Rousskov-6/+8
2019-09-17Replace DiagnosticBuilder with Diagnostic when emitting errorMark Rousskov-1/+2
2019-09-16Fix failure note `to_str` implementationAfnan Enayet-1/+1
* Serialize the level to something a little more useful for a failure note struct * Update tests accordingly
2019-09-08Dedent macro definitionV1shvesh-3/+3
2019-09-08Remove extra trailing newlineV1shvesh-1/+0
2019-09-08Add pluralise macroV1shvesh-0/+8
Adress issue #64238. Create a macro to be used for pluralisation check throughout rustc codebase.
2019-08-21Add terminal_width debugging flagEsteban Küber-1/+1
2019-08-15syntax_pos: `NO_EXPANSION`/`SyntaxContext::empty()` -> `SyntaxContext::root()`Vadim Petrochenkov-3/+2
For consistency with `ExpnId::root`. Also introduce a helper `Span::with_root_ctxt` for creating spans with `SyntaxContext::root()` context
2019-08-14remove unused Level::PhaseFatalAleksey Kladov-5/+2
2019-07-28Auto merge of #63090 - Centril:rollup-xnjwm2h, r=Centrilbors-1/+2
Rollup of 8 pull requests Successful merges: - #61856 (Lint attributes on function arguments) - #62360 (Document that ManuallyDrop::drop should not called more than once) - #62392 (Update minifier-rs version) - #62871 (Explicit error message for async recursion.) - #62995 (Avoid ICE when suggestion span is at Eof) - #63053 (SystemTime docs: recommend Instant for elapsed time) - #63081 (tidy: Cleanup the directory whitelist) - #63088 (Remove anonymous_parameters from unrelated test) Failed merges: r? @ghost
2019-07-28Rollup merge of #62995 - estebank:issue-62973, r=varkorMazdak Farrokhzad-1/+2
Avoid ICE when suggestion span is at Eof Fix #62973.
2019-07-28Deny `unused_lifetimes` through rustbuildVadim Petrochenkov-1/+0
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-2/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-25Avoid ICE when suggestion span is at EofEsteban Küber-1/+2
2019-07-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-3/+0
2019-07-05Rollup merge of #61545 - flip1995:internal_lints, r=oli-obkMazdak Farrokhzad-1/+0
Implement another internal lints cc #49509 This adds ~~two~~ one internal lint~~s~~: 1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669 2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~ ~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~ TODO (not directly relevant for review): - [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) :thinking: cc @eddyb) - [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870 - [x] Check explicitly for the `{declare,impl}_lint_pass!` macros r? @oli-obk
2019-07-03Remove needless lifetimesJeremy Stucki-42/+42
2019-06-24Enable internal lints in bootstrapflip1995-1/+0
2019-06-22Count all errors for `track_errors`Matthew Jasper-3/+13
2019-06-22Prefer to use `has_errors` to `err_count`Matthew Jasper-4/+3
2019-06-11Auto merge of #61741 - Centril:rollup-fgro5kz, r=Centrilbors-0/+5
Rollup of 11 pull requests Successful merges: - #61518 (Add loops to doc list of things not stable in const fn) - #61526 (move some tests into subfolders) - #61550 (Windows 10 SDK is also required now.) - #61606 (Remove some legacy proc macro flavors) - #61652 (Mention slice patterns in array) - #61686 (librustc_errors: Add some more documentation) - #61698 (typeck: Fix const generic in repeat param ICE.) - #61707 (Azure: retry failed awscli installs) - #61715 (make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone) - #61724 (core: use memcmp optimization for 128 bit integer slices) - #61726 (Use `for_each` in `Iterator::partition`) Failed merges: r? @ghost
2019-06-11Add deny(unused_lifetimes) to all the crates that have deny(internal).Eduard-Mihai Burtescu-0/+1