about summary refs log tree commit diff
path: root/src/test/ui/lifetimes
AgeCommit message (Collapse)AuthorLines
2022-05-22Use revisions for NLL in lifetimesJack Huey-145/+398
2022-05-22Rollup merge of #97236 - cjgillot:recover-lifetime-res, r=jackh726Yuki Okushi-0/+83
Recover when resolution did not resolve lifetimes. This can happen for items inside a foreign fn's body, which are not visited at all. Fixes https://github.com/rust-lang/rust/issues/97193 Fixes https://github.com/rust-lang/rust/issues/97194
2022-05-21update nll testslcnr-0/+10
2022-05-21Recover when resolution did not resolve lifetimes.Camille GILLOT-0/+83
2022-05-21correctly deal with user type ascriptions in patlcnr-0/+25
2022-05-05Add a regression test for #64173 and #66152Yuki Okushi-0/+54
2022-04-30Bless nll tests.Camille GILLOT-2/+5
2022-04-30Bless tests.Camille GILLOT-12/+27
2022-04-29Auto merge of #96566 - Dylan-DPC:rollup-fo7rd98, r=Dylan-DPCbors-0/+19
Rollup of 6 pull requests Successful merges: - #96390 (Switch JS code to ES6 - part 2) - #96527 (RustWrapper: explicitly don't handle DXILPointerTyID) - #96536 (rustdoc: fix missing method list for primitive deref target) - #96559 (Use the correct lifetime binder for elided lifetimes in path.) - #96560 (Remove unnecessary environment variable in cf-protection documentation) - #96562 (Fix duplicate directory separator in --remap-path-prefix.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-29Rollup merge of #96559 - cjgillot:elided-path-fn, r=petrochenkovDylan DPC-0/+19
Use the correct lifetime binder for elided lifetimes in path. Fixes https://github.com/rust-lang/rust/issues/96540
2022-04-29Auto merge of #95819 - oli-obk:mir_can't_hold_all_these_lifetimes, r=estebankbors-0/+33
Enforce Copy bounds for repeat elements while considering lifetimes fixes https://github.com/rust-lang/rust/issues/95477 this is a breaking change in order to fix a soundness bug. Before this PR we only checked whether the repeat element type had an `impl Copy`, but not whether that impl also had the appropriate lifetimes. E.g. if the impl was for `YourType<'static>` and not a general `'a`, then copying any type other than a `'static` one should have been rejected, but wasn't. r? `@lcnr`
2022-04-29Use the correct lifetime binder for elided lifetimes in path.Camille GILLOT-0/+19
2022-04-29Rollup merge of #96516 - oli-obk:impl_trait_inference_accidental_permitted, ↵Dylan DPC-13/+1
r=jackh726 Revert diagnostic duplication and accidental stabilization fixes #96460 this is an accidental stabilization that we should put into the beta. I believe it is low-risk, because it was literally what we had before #94081 The effect on tests is massive, but mostly deduplication of diagnostics and some minor span changes.
2022-04-28Revert diagnostic duplication and accidental stabilizationOli Scherer-13/+1
2022-04-28Check that repeat expression elements are Copy (ignoring lifetimes) in ↵Oli Scherer-0/+33
typeck and that they are Copy (with proper lifetime checks) in borrowck
2022-04-27Recover suggestions to introduce named lifetime under NLLmarmeladema-0/+60
2022-04-24Bless testsmarmeladema-3/+3
2022-04-17Lint elided lifetimes in path on the AST.Camille GILLOT-1/+5
2022-04-17Bless tests.Camille GILLOT-4/+6
2022-03-28Revert to inference variable based hidden type computation for RPITOli Scherer-5/+17
2022-03-28Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk"Oli Scherer-4/+4
This reverts commit 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d, reversing changes made to 78450d2d602b06d9b94349aaf8cece1a4acaf3a8.
2022-03-21Return err instead of ICEouz-a-0/+49
2022-03-01update (bless) test resultsFausto-3/+3
2022-02-28Suggest adding a new lifetime parameter when two elided lifetimes should ↵Fausto-0/+18
match up for traits and impls. Issue #94462
2022-02-24Remove in-band lifetimesMichael Goulet-5/+111
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-4/+4
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-4/+4
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-01-01Update references to `-Z symbol-mangling-version` to use `-C`Josh Triplett-1/+1
Replace `-Z symbol-mangling-version=v0` with `-C symbol-mangling-version=v0`. Replace `-Z symbol-mangling-version=legacy` with `-Z unstable-options -C symbol-mangling-version=legacy`.
2021-12-11Rollup merge of #91764 - cjgillot:elide-anyway, r=jackh726Matthias Krüger-0/+72
Do not ICE when suggesting elided lifetimes on non-existent spans. Fixes https://github.com/rust-lang/rust/issues/91763 r? `@jackh726`
2021-12-11Add test.Camille GILLOT-0/+72
2021-12-10fix tests after rebaseEsteban Kuber-1/+1
2021-12-04Rollup merge of #90519 - estebank:issue-84003, r=petrochenkovMatthias Krüger-2/+1
Keep spans for generics in `#[derive(_)]` desugaring Keep the spans for generics coming from a `derive`d Item, so that errors and suggestions have better detail. Fix #84003.
2021-12-03Keep spans for generics in `#[derive(_)]` desugaringEsteban Kuber-2/+1
Keep the spans for generics coming from a `derive`d Item, so that errors and suggestions have better detail. Fix #84003.
2021-11-26Handle placeholder regions in NLL type outlive constraintsMatthew Jasper-0/+19
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-5/+0
Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418.
2021-11-14Improve diagnostics when a static lifetime is expectedLucas Kent-0/+52
2021-11-06Move some tests to more reasonable directoriesCaio-0/+49
2021-11-03Add beginner friendly lifetime elision hint to E0623Nilstrieb-0/+128
Suggest adding a new lifetime parameter when two elided lifetimes should match up but don't Issue #90170 This also changes the tests introduced by the previous commits because of another rustc issue (#90258)
2021-10-22nice_region_error: Include lifetime placeholders in error outputMichael Howell-4/+4
As you can see in src/test/ui/traits/self-without-lifetime-constraint.stderr you can get very confusing type names if you don't have this. Fixes #87763
2021-10-13Remove textual span from diagnostic stringOli Scherer-4/+4
2021-10-05Note specific regions involved in 'borrowed data escapes' errorAaron Hill-4/+14
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-4/+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-30Auto merge of #89110 - Aaron1011:adjustment-span, r=estebankbors-17/+17
Use larger span for adjustment THIR expressions Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions. These spans are recoded when we first create the adjustment during typecheck. For example, an autoref adjustment triggered by a method call will record the span of the entire method call. The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-27Improve cause information for NLL higher-ranked errorsAaron Hill-0/+25
This PR has several interconnected pieces: 1. In some of the NLL region error code, we now pass around an `ObligationCause`, instead of just a plain `Span`. This gets forwarded into `fulfill_cx.register_predicate_obligation` during error reporting. 2. The general InferCtxt error reporting code is extended to handle `ObligationCauseCode::BindingObligation` 3. A new enum variant `ConstraintCategory::Predicate` is added. We try to avoid using this as the 'best blame constraint' - instead, we use it to enhance the `ObligationCause` of the `BlameConstraint` that we do end up choosing. As a result, several NLL error messages now contain the same "the lifetime requirement is introduced here" message as non-NLL errors. Having an `ObligationCause` available will likely prove useful for future improvements to NLL error messages.
2021-09-25Use larger span for adjustments on method callsAaron Hill-17/+17
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-19Auto merge of #88703 - cjgillot:lazymod, r=petrochenkovbors-11/+11
Gather module items after lowering. This avoids having a non-local analysis inside lowering. By implementing `hir_module_items` using a visitor, we make sure that iterations and visitors are consistent.
2021-09-18Auto merge of #88650 - sapessi:issue-77175-fix, r=estebankbors-0/+19
Skip single use lifetime lint for generated opaque types Fix: #77175 The opaque type generated by the desugaring process of an async function uses the lifetimes defined by the originating function. The DefId for the lifetimes in the opaque type are different from the ones in the originating async function - as they should be, as far as I understand, and could therefore be considered a single use lifetimes, this causes the single_use_lifetimes lint to fail compilation if explicitly denied. This fix skips the lint for lifetimes used only once in generated opaque types for an async function that are declared in the parent async function definition. More info in the comments on the original issue: 1 and 2
2021-09-12Use boxed slice instead of BTreeSet.Camille GILLOT-11/+11
2021-09-06Add regression test for #74400Bram van den Heuvel-0/+54
2021-09-04test for issue #77175Stefano Buliani-0/+19