about summary refs log tree commit diff
path: root/src/test/ui/nll
AgeCommit message (Collapse)AuthorLines
2022-09-26fix #102087, Suggest Default::default() when binding isn't initializedyukang-0/+10
2022-09-17Use Predicate ConstraintCategory when normalizingJack Huey-0/+6
2022-09-16Final bitsJack Huey-0/+12
2022-09-16Revert "Better errors for implied static bound"Jack Huey-12/+0
This reverts commit c75817b0a75d4b6b01ee10900ba5d01d4915e6a8.
2022-09-16Revert "Use Predicate ConstraintCategory when normalizing"Jack Huey-6/+0
This reverts commit aae37f87632dd74856d55c0cd45d2c192379c990.
2022-09-13Use Predicate ConstraintCategory when normalizingJack Huey-0/+6
2022-09-13Better errors for implied static boundJack Huey-0/+12
2022-09-13Use def_span for external requirements.Camille GILLOT-419/+134
2022-09-13Use tcx.hir() utils for spans in MIR building.Camille GILLOT-82/+162
This corrects the `span_with_body` in the case of closures, which was incorrectly shortened to the `def_span`.
2022-09-08Remove ReEmptyJack Huey-2/+2
2022-09-06Shrink span for bindings with subpatterns.Camille GILLOT-1/+1
2022-08-31Fix a bunch of typoDezhi Wu-2/+2
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-17implied_bounds: clarify our assumptionslcnr-4/+4
2022-08-09don't normalize wf predicateslcnr-1/+11
this allows us to soundly use unnormalized projections for wf
2022-08-02NLL: relate closure to parent fnAli MJ Al-Nasrawy-0/+97
2022-07-31Improve `cannot move out of` error messageObei Sideg-2/+2
2022-07-26Rollup merge of #99748 - compiler-errors:better-impl-trait-printing, r=fee1-deadDylan DPC-2/+2
Use full type name instead of just saying `impl Trait` in "captures lifetime" error I think this is very useful, especially when there's >1 `impl Trait`, and it just means passing around a bit more info that we already have access to.
2022-07-26Use real opaque type instead of just saying impl TraitMichael Goulet-2/+2
2022-07-24Combine redundant obligation cause codesMichael Goulet-2/+2
2022-07-14Rollup merge of #97720 - cjgillot:all-fresh, r=petrochenkovDylan DPC-4/+4
Always create elided lifetime parameters for functions Anonymous and elided lifetimes in functions are sometimes (async fns) --and sometimes not (regular fns)-- desugared to implicit generic parameters. This difference of treatment makes it some downstream analyses more complicated to handle. This step is a pre-requisite to perform lifetime elision resolution on AST. There is currently an inconsistency in the treatment of argument-position impl-trait for functions and async fns: ```rust trait Foo<'a> {} fn foo(t: impl Foo<'_>) {} //~ ERROR missing lifetime specifier async fn async_foo(t: impl Foo<'_>) {} //~ OK fn bar(t: impl Iterator<Item = &'_ u8>) {} //~ ERROR missing lifetime specifier async fn async_bar(t: impl Iterator<Item = &'_ u8>) {} //~ OK ``` The current implementation reports "missing lifetime specifier" on `foo`, but **accepts it** in `async_foo`. This PR **proposes to accept** the anonymous lifetime in both cases as an extra generic lifetime parameter. This change would be insta-stable, so let's ping t-lang. Anonymous lifetimes in GAT bindings keep being forbidden: ```rust fn foo(t: impl Foo<Assoc<'_> = Bar<'_>>) {} ^^ ^^ forbidden ok ``` I started a discussion here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Anonymous.20lifetimes.20in.20universal.20impl-trait/near/284968606 r? ``@petrochenkov``
2022-07-13remove untagged_union feature gateRalf Jung-7/+7
2022-07-13Always use CreateParameter mode for function definitions.Camille GILLOT-4/+4
2022-07-11Rollup merge of #98713 - nikomatsakis:issue-98693, r=jackh726Matthias Krüger-0/+38
promote placeholder bounds to 'static obligations In NLL, when we are promoting a bound out from a closure, if we have a requirement that `T: 'a` where `'a` is in a higher universe, we were previously ignoring that, which is totally wrong. We should be promoting those constraints to `'static`, since universes are not expressible across closure boundaries. Fixes #98693 ~~(Marking as WIP because I'm still running tests, haven't add the new test, etc)~~ r? ``@jackh726``
2022-07-08Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebankbors-238/+145
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
2022-07-07Wording tweakEsteban Küber-8/+12
2022-07-07Fix label on uninit binding field assignmentEsteban Küber-4/+4
2022-07-07Avoid misleading message/label in `match-cfg-fake-edges.rs` testEsteban Küber-2/+5
2022-07-07Review comments: wordingEsteban Küber-2/+2
2022-07-07Tweak wording and spansEsteban Küber-52/+50
2022-07-07On partial uninit error point at where we need initEsteban Küber-96/+147
When a binding is declared without a value, borrowck verifies that all codepaths have *one* assignment to them to initialize them fully. If there are any cases where a condition can be met that leaves the binding uninitialized or we attempt to initialize a field of an unitialized binding, we emit E0381. We now look at all the statements that initialize the binding, and use them to explore branching code paths that *don't* and point at them. If we find *no* potential places where an assignment to the binding might be missing, we display the spans of all the existing initializers to provide some context.
2022-07-07Fix borrowck closure span.Camille GILLOT-6/+18
2022-07-07Shorten span for closures.Camille GILLOT-238/+133
2022-06-30promote placeholder bounds to 'static obligationsNiko Matsakis-0/+38
In NLL, when we are promoting a bound out from a closure, if we have a requirement that `T: 'a` where `'a` is in a higher universe, we were previously ignoring that, which is totally wrong. We should be promoting those constraints to `'static`, since universes are not expressible across closure boundaries.
2022-06-24Auto merge of #98109 - nikomatsakis:issue-98095, r=jackh726bors-0/+104
fix universes in the NLL type tests In the NLL code, we were not accommodating universes in the `type_test` logic. Fixes #98095. r? `@compiler-errors` This breaks some tests, however, so the purpose of this branch is more explanatory and perhaps to do a crater run.
2022-06-23Rollup merge of #98184 - compiler-errors:elided-lifetime-in-impl-nll, r=cjgillotMichael Goulet-0/+69
Give name if anonymous region appears in impl signature Fixes #98170 We probably should remove the two unwraps in [`report_general_error`](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_borrowck/diagnostics/region_errors.rs.html#683-685), but I have no idea what to provide if those regions are missing, so I've kept those in. Let me know if I should try harder to remove those.
2022-06-23add regression tests found in craterNiko Matsakis-0/+30
2022-06-23normalize if-eq bounds before testingNiko Matsakis-0/+37
Hat-tip: aliemjay
2022-06-22Rollup merge of #98199 - c410-f3r:z-errors, r=petrochenkovYuki Okushi-0/+284
Move some tests to more reasonable directories r? `@petrochenkov`
2022-06-21Move some tests to more reasonable directoriesCaio-0/+284
2022-06-21Rollup merge of #98022 - compiler-errors:erroneous-borrowck-span, r=oli-obkYuki Okushi-0/+36
Fix erroneous span for borrowck error I am not confident that this is the correct fix, but it does the job. Open to suggestions for a real fix instead. Fixes #97997 The issue is that we pass a [dummy location](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_middle/mir/visit.rs.html#302) when type-checking the ["required consts"](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/struct.Body.html#structfield.required_consts) that are needed by the MIR body during borrowck. This means that when we fail to evaluate the constant, we use the span of `bb0[0]`, instead of the actual span of the constant. There are quite a few other places that use `START_BLOCK.start_location()`, `Location::START`, etc. when calling for a random/unspecified `Location` value. This is because, unlike (for example) `Span`, we don't have a dummy/miscellaneous value to use instead. I would appreciate guidance (either in this PR, or a follow-up) on what needs to be done to clean this up in general.
2022-06-20Give name if anonymous region appears in impl signatureMichael Goulet-0/+69
2022-06-16 fix one more case of trailing spaceklensy-7/+7
2022-06-15fix universes in the NLL type testsNiko Matsakis-0/+37
In the NLL code, we were not accommodating universes in the `type_test` logic. This led to issue 98095.
2022-06-13Move testsCaio-0/+20
2022-06-12Fix erroneous span for borrowck errorMichael Goulet-0/+36
2022-06-03Fully stabilize NLLJack Huey-792/+198
2022-05-29Rebase fallout.Camille GILLOT-1/+1
2022-05-29Make lifetime errors more precise in the presence of `Fresh` lifetimes.Camille GILLOT-2/+2
2022-05-25bless existing test with compare-mode=nll and remove testb-naber-221/+0
2022-05-25update testsb-naber-15/+237