about summary refs log tree commit diff
path: root/src/test/ui/nll/user-annotations
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-3533/+0
2023-01-07don't eagerly normalize SelfCtor typeAli MJ Al-Nasrawy-0/+120
Delay until user annotations are registered. See the added test.
2023-01-07more testsAli MJ Al-Nasrawy-37/+188
2023-01-07make ascribe_user_type a TypeOpAli MJ Al-Nasrawy-0/+156
Projection types in user annotations may contain inference variables. This makes the normalization depend on the unification with the actual type and thus requires a separate TypeOp to track the obligations. Otherwise simply calling `TypeChecker::normalize` would ICE with "unexpected ambiguity"
2023-01-07fix method substsAli MJ Al-Nasrawy-2/+10
2023-01-07fix struct pathAli MJ Al-Nasrawy-33/+106
2023-01-07don't normalize in astconvAli MJ Al-Nasrawy-5/+251
We delay projection normalization to further stages in order to register user type annotations before normalization in HIR typeck. There are two consumers of astconv: ItemCtxt and FnCtxt. The former already expects unnormalized types from astconv, see its AstConv trait impl. The latter needs `RawTy` for a cleaner interface. Unfortunately astconv still needs the normalization machinery in order to resolve enum variants that have projections in the self type, e.g. `<<T as Trait>::Assoc>::StructVariant {}`. This is why `AstConv::normalize_ty_2` is necessary.
2022-11-19Use `type_ascribe!` in many UI testsNilstrieb-11/+11
Use it in all UI tests that are about the semantics and not the syntax of type ascription.
2022-11-13Rollup merge of #104181 - jackh726:known-bug-tests, r=Mark-SimulacrumManish Goregaokar-0/+16
Add a few known-bug tests The labels of these tests should be changed from `S-bug-has-mcve` to `S-bug-has-test` once this is merged. cc: #101518 #99492 #90950 #89196 #104034 #101350 #103705 #103899 I couldn't reproduce the failures in #101962 and #100772 (so either these have started passing, or I didn't repro properly), so leaving those out for now. #102065 was a bit more complicated, since it uses `rustc_private` and I didn't want to mess with that.
2022-11-13Add a few known-bug testsJack Huey-0/+16
2022-11-09Rollup merge of #103307 - b4den:master, r=estebankManish Goregaokar-3/+3
Add context to compiler error message Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
2022-10-27Revert "Make ClosureOutlivesRequirement not rely on an unresolved type"Michael Goulet-8/+8
This reverts commit a6b5f95fb028f9feb4a2957c06b35035be2c6155.
2022-10-20Update tests to match error message changesb4den-3/+3
2022-10-19Make ClosureOutlivesRequirement not rely on an unresolved typeMichael Goulet-8/+8
2022-09-13Use tcx.hir() utils for spans in MIR building.Camille GILLOT-16/+15
This corrects the `span_with_body` in the case of closures, which was incorrectly shortened to the `def_span`.
2022-07-07Shorten span for closures.Camille GILLOT-15/+16
2022-06-03Fully stabilize NLLJack Huey-168/+43
2022-05-25update testsb-naber-8/+8
2022-04-05Move some tests with compare-mode=nll output to revisionsJack Huey-16/+36
2021-12-31Ensure that early-bound function lifetimes are always 'local'Aaron Hill-1/+1
During borrowchecking, we treat any free (early-bound) regions on the 'defining type' as `RegionClassification::External`. According to the doc comments, we should only have 'external' regions when checking a closure/generator. However, a plain function can also have some if its regions be considered 'early bound' - this occurs when the region is constrained by an argument, appears in a `where` clause, or in an opaque type. This was causing us to incorrectly mark these regions as 'external', which caused some diagnostic code to act as if we were referring to a 'parent' region from inside a closure. This PR marks all instantiated region variables as 'local' when we're borrow-checking something other than a closure/generator/inline-const.
2021-12-10Tweak wordingEsteban Kuber-1/+1
2021-10-13Remove textual span from diagnostic stringOli Scherer-4/+4
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