about summary refs log tree commit diff
path: root/src/test/ui/lifetimes
AgeCommit message (Collapse)AuthorLines
2020-02-02Use more accurate failed predicate spansEsteban Küber-20/+22
2020-02-02Point at arguments or output when fn obligations come from them, or ident ↵Esteban Küber-46/+28
when they don't
2020-01-19review commentsEsteban Küber-3/+3
2020-01-19When encountering an expected named lifetime and none are present, suggest ↵Esteban Küber-3/+15
adding one
2020-01-16review commentsEsteban Küber-1/+1
2020-01-16When trait bounds are missing for return values, point at themEsteban Küber-0/+3
2019-12-28Do not ICE on lifetime error involving closuresEsteban Küber-0/+18
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-4/+4
Specific labels when referring to "expected" and "found" types
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+16
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-4/+4
2019-11-07Update ui testsGuillaume Gomez-0/+25
2019-10-29Point at the trait item and tweak wordingEsteban Küber-2/+5
2019-10-29review commentsEsteban Küber-2/+2
2019-10-29Custom lifetime error for `impl` item doesn't conform to `trait`Esteban Küber-0/+23
2019-10-27update testsMark Mansi-0/+16
2019-10-11Print lifetimes with backticksYuki Okushi-2/+2
2019-09-12update testsMark Mansi-3/+3
2019-08-19distinguish object-lifetime-default elision from other elisionNiko Matsakis-6/+6
Object-lifetime-default elision is distinct from other forms of elision; it always refers to some enclosing lifetime *present in the surrounding type* (e.g., `&dyn Bar` expands to `&'a (dyn Bar + 'a)`. If there is no enclosing lifetime, then it expands to `'static`. Therefore, in an `impl Trait<Item = dyn Bar>` setting, we don't expand to create a lifetime parameter for the `dyn Bar + 'X` bound. It will just be resolved to `'static`. Annoyingly, the responsibility for this resolution is spread across multiple bits of code right now (`middle::resolve_lifetimes`, `lowering`). The lowering code knows that the default is for an object lifetime, but it doesn't know what the correct result would be. Probably this should be fixed, but what we do now is a surgical fix: we have it generate a different result for elided lifetimes in a object context, and then we can ignore those results when figuring out the lifetimes that are captured in the opaque type.
2019-06-13Create fewer basic blocks in match MIR loweringMatthew Jasper-3/+3
2019-05-29Update ui test suite to use dynmemoryruins-24/+24
2019-05-12Change compare mode to use -Zborrowck=mirMatthew Jasper-0/+399
2019-05-03Update testsChristopher Vittal-52/+14
2019-04-25Rollup merge of #60160 - xldenis:fix-overlapping-zero-width-annotation, ↵Mazdak Farrokhzad-3/+1
r=estebank Fix #58270, fix off-by-one error in error diagnostics. This fixes #58270 by checking if two diagnostics overlap completely when we're calculating the line offset for each message.
2019-04-22Fix #58270, fix off-by-one error in error diagnostics.Xavier Denis-3/+1
2019-04-22Remove double trailing newlinesvarkor-3/+0
2019-04-22update tests for migrate mode by defaultMatthew Jasper-26/+9
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-26/+1
2019-03-11Update NLL testsVadim Petrochenkov-1/+1
2019-03-11Update testsVadim Petrochenkov-64/+64
2018-12-25Remove licensesMark Rousskov-496/+75
2018-12-04Update testsOliver Scherer-0/+1
2018-11-07remove `#[rustc_error]` from ui/ tests that remain compile-fail tests.Felix S. Klock II-2/+2
2018-10-22[review comments] modify test and clean up codeOliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer-7/+4
Co-Authored-By: estebank <esteban@kuber.com.ar>
2018-10-22review commentsEsteban Küber-20/+5
2018-10-22Suggest appropriate syntax on missing lifetime specifier in return typeEsteban Küber-8/+45
Suggest using `'static` when a lifetime is missing in the return type with a structured suggestion instead of a note.
2018-10-17Update output for borrowck=migrate compare mode.David Wood-399/+0
This commit updates the test output for the updated NLL compare mode that uses `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The previous commit changes `compiletest` and this commit only updates `.nll.stderr` files.
2018-10-15Deduplicate testsShotaro Yamada-45/+0
* `ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4` and `ex3-both-anon-regions-both-are-structs-3` * `ui/lint/lint-group-style` and `lint-group-nonstandard-style`
2018-09-25Update E0714 to E0716 in tests outputMikhail Modin-2/+2
2018-09-25add "temporary value dropped while borrowed" errorMikhail Modin-4/+4
Issue #54131
2018-09-19Update ui testsMatthew Jasper-8/+8
2018-09-16Auto merge of #54157 - euclio:structured-suggestion, r=estebankbors-5/+5
use structured suggestion for "missing mut" label Fixes #54133 for both NLL and non-NLL. r? @estebank I'm not super happy with the existing wording here, since it's now a suggestion. I wonder if the message would work better as something like "help: make binding mutable: `mut foo`"? Also, are the `HELP` and `SUGGESTION` comments necessary?
2018-09-14Auto merge of #54088 - matthewjasper:use-reason-in-dlle-errors, r=pnkfelixbors-0/+1
[NLL] Suggest let binding Closes #49821 Also adds an alternative to `explain_why_borrow_contains_point` that allows changing error messages based on the reason that will be given. This will also be useful for #51026, #51169 and maybe further changes to does not live long enough messages.
2018-09-12use structured suggestion for "missing mut" labelAndy Russell-5/+5
Fixes #54133.
2018-09-11stabalize infer outlives requirements (RFC 2093).toidiu-16/+2
Co-authored-by: nikomatsakis
2018-09-09Suggest a let binding to extend temporary lifetimes with NLLMatthew Jasper-0/+1
2018-09-01Update testsBasile Desloges-314/+0
2018-08-27remove `let x = baz` which was obscuring the real errorNiko Matsakis-8/+8
2018-08-19Fix typos found by codespell.Matthias Krüger-2/+2
2018-08-14Update testsMatthew Jasper-33/+30
2018-08-14Merged migrated compile-fail tests and ui tests. Fixes #46841.David Wood-0/+2277