about summary refs log tree commit diff
path: root/src/test/ui/nll/user-annotations
AgeCommit message (Collapse)AuthorLines
2021-10-05Note specific regions involved in 'borrowed data escapes' errorAaron Hill-2/+7
Fixes #67007 Currently, a 'borrowed data escapes' error does not mention the specific lifetime involved (except indirectly through a suggestion about adding a lifetime bound). We now explain the specific lifetime relationship that failed to hold, which improves otherwise vague error messages.
2021-10-03Don't suggest replacing region with 'static in NLLAaron Hill-40/+0
Fixes #73159 This is similar to #69350 - if the user didn't initially write out a 'static lifetime, adding 'static in response to a lifetime error is usually the wrong thing to do.
2021-09-16Add `ConstraintCategory::Usage` for handling aggregate constructionAaron Hill-12/+12
In some cases, we emit borrowcheck diagnostics pointing at a particular field expression in a struct expression (e.g. `MyStruct { field: my_expr }`). However, this behavior currently relies on us choosing the `ConstraintCategory::Boring` with the 'correct' span. When adding additional variants to `ConstraintCategory`, (or changing existing usages away from `ConstraintCategory::Boring`), the current behavior can easily get broken, since a non-boring constraint will get chosen over a boring one. To make the diagnostic output less fragile, this commit adds a `ConstraintCategory::Usage` variant. We use this variant for the temporary assignments created for each field of an aggregate we are constructing. Using this new variant, we can emit a message mentioning "this usage", emphasizing the fact that the error message is related to the specific use site (in the struct expression). This is preparation for additional work on improving NLL error messages (see #57374)
2021-08-03bless trivial polonius diagnostics changesRémy Rakic-1/+2
2021-02-01Update ui testsJesus Rubio-0/+1
2020-07-22Further tweak wording of E0759 and introduce E0767Esteban Küber-1/+1
2020-07-22Detect when `'static` obligation might come from an `impl`Esteban Küber-21/+4
Address #71341.
2020-05-27Fix spacing of expected/found notes without a labelEsteban Küber-4/+4
2020-03-30bless output of ui test nll/user-annotations/closure-substs.rsRemy Rakic-1/+1
Trivial diagnostics grammar change
2020-02-29Use TypeRelating for instantiating query responsesMatthew Jasper-0/+33
2020-01-23Use check-pass mode for nll testsTomasz Miąsko-1/+1
2019-12-06bless polonius output due to lacking the 'static special-casingRemy Rakic-0/+60
2019-12-03Include a span in more `expected...found` notesAaron Hill-6/+14
In most places, we use a span when emitting `expected...found` errors. However, there were a couple of places where we didn't use any span, resulting in hard-to-interpret error messages. This commit attaches the relevant span to these notes, and additionally switches over to using `note_expected_found` instead of manually formatting the message
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+42
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-04Use check-pass in ui tests where appropriateTomasz Miąsko-1/+1
2019-10-27update testsMark Mansi-48/+26
2019-10-27implement outlive suggestionsMark Mansi-0/+64
2019-10-11Print lifetimes with backticksYuki Okushi-5/+5
2019-10-07update ui testsGuillaume Gomez-0/+2
2019-09-12update ui testsGuillaume Gomez-0/+3
2019-09-08Update test stderr with results of enabling unused lintsMark Rousskov-3/+3
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-2/+2
2019-06-06Make sure constructors functions are type checked correctlyMatthew Jasper-0/+127
2019-05-12Remove feature(nll) when compare mode is sufficientMatthew Jasper-128/+164
2019-04-22Remove double trailing newlinesvarkor-1/+0
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-2/+1
2019-03-13test that wildcard type `_` is not duplicated by `type Foo<X> = (X, X);` and ↵Felix S. Klock II-0/+99
potentially instantiated at different types. (Updated to reflect changes in diagnostic output and compiletest infrastructure.)
2019-03-11Update testsVadim Petrochenkov-83/+83
2019-03-01Handle type annotations in promoted MIR correctlyMatthew Jasper-0/+29
Type annotations are shared between the MIR of a function and the promoted constants for that function, so keep them in the type checker when we check the promoted MIR.
2019-02-23Rollup merge of #58353 - matthewjasper:typeck-pattern-constants, r=arielb1Mazdak Farrokhzad-20/+58
Check the Self-type of inherent associated constants r? @arielb1
2019-02-13Check the self-type of inherent associated constantsMatthew Jasper-20/+58
2019-02-10tests: doc commentsAlexander Regueiro-1/+1
2019-01-19Don't ignore `_` in type casts and ascriptionsMatthew Jasper-0/+78
2019-01-19Type check unnanotated constant items with NLLMatthew Jasper-0/+79
2019-01-19Handle lifetime annotations in unreachable codeMatthew Jasper-0/+11
We equate the type in the annotation with the inferred type first so that we have a fully inferred type to perform the well-formedness check on.
2019-01-17Update testsMark Mansi-28/+28
2019-01-13Implement basic input validation for built-in attributesVadim Petrochenkov-2/+1
2018-12-30Guarantee `rustc_dump_user_substs` error order.David Wood-8/+8
This commit buffers the errors output by the `rustc_dump_user_substs` attribute so that they can be output in order of span and would therefore be consistent.
2018-12-30Refactor `UserTypeAnnotation`.David Wood-11/+11
This commit refactors the `UserTypeAnnotation` type to be referred to by an index within `UserTypeProjection`. `UserTypeAnnotation` is instead kept in an `IndexVec` within the `Mir` struct. Further, instead of `UserTypeAnnotation` containing canonicalized types, it now contains normal types and the entire `UserTypeAnnotation` is canonicalized. To support this, the type was moved from the `rustc::mir` module to `rustc::ty` module.
2018-12-25Remove licensesMark Rousskov-203/+42
2018-12-04Update testsOliver Scherer-5/+6
2018-11-26Put all existential ty vars in the `ROOT` universescalexm-1/+1
2018-11-24Fix NLL ui testscalexm-2/+2
2018-11-13Fix ui testsscalexm-6/+6
2018-10-27allow canonicalized regions to carry universe and track max-universeNiko Matsakis-5/+5
But.. we don't really use it for anything right now.
2018-10-26Add test for normalization during field-lookup on patterns with ascribed types.Felix S. Klock II-14/+50
As a drive-by, also added test analogous to existing static_to_a_to_static_through_tuple, but now apply to a struct instead of a tuple.
2018-10-26regression test for ICE I encountered in my patch.Felix S. Klock II-0/+31
2018-10-26Add the actual chain of projections to `UserTypeProjection`.Felix S. Klock II-17/+46
Update the existing NLL `patterns.rs` test accordingly. includes changes addressing review feedback: * Added example to docs for `UserTypeProjections` illustrating how we build up multiple projections when descending into a pattern with type ascriptions. * Adapted niko's suggested docs for `UserTypeProjection`. * Factored out `projection_ty` from more general `projection_ty_core` (as a drive-by, made its callback an `FnMut`, as I discovered later that I need that). * Add note to docs that `PlaceTy.field_ty(..)` does not normalize its result. * Normalize as we project out `field_ty`.
2018-10-24port the relate-types code from NLL type-check into a type-opNiko Matsakis-0/+48
Add regression tests for #55219 and #55241 Also another test where a duplicate-like error appears to have been suppressed; I'm not 100% sure why this output changes, though I could imagine that some duplicate suppression is enabled by this PR.
2018-10-23check the self type is well-formedNiko Matsakis-0/+37
This fixes `issue-28848.rs` -- it also handles another case that the AST region checker gets wrong (`wf-self-type.rs`). I don't actually think that this is the *right way* to be enforcing this constraint -- I think we should probably do it more generally, perhaps by editing `predicates_of` for the impl itself. The chalk-style implied bounds setup ought to fix this.