about summary refs log tree commit diff
path: root/src/test/ui/nll/closure-requirements
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-1387/+0
2022-11-11Do not rename bound variables when verbose-printing binders.Camille GILLOT-13/+13
2022-11-05use spans in TypeTest rather than mir::LocationAli MJ Al-Nasrawy-12/+4
Spans are independent of the body being borrow-checked, so they don't need remapping when promoting type-tests and they yield more specific error spans inside bodies of closures/inline consts.
2022-10-27Revert "Make ClosureOutlivesRequirement not rely on an unresolved type"Michael Goulet-7/+8
This reverts commit a6b5f95fb028f9feb4a2957c06b35035be2c6155.
2022-10-19Make ClosureOutlivesRequirement not rely on an unresolved typeMichael Goulet-8/+7
2022-09-26address reviewb-naber-13/+13
2022-09-26bless testsb-naber-6/+6
2022-09-13Use def_span for external requirements.Camille GILLOT-209/+60
2022-09-13Use tcx.hir() utils for spans in MIR building.Camille GILLOT-29/+87
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-07-07Shorten span for closures.Camille GILLOT-87/+29
2022-06-16 fix one more case of trailing spaceklensy-3/+3
2022-06-03Fully stabilize NLLJack Huey-19/+19
2022-05-25update testsb-naber-7/+8
2022-04-30Bless tests.Camille GILLOT-3/+5
2022-04-24Recover missing suggestion part under NLLmarmeladema-1/+1
2022-04-24Improve span for `consider adding an explicit lifetime bound` suggestions ↵marmeladema-2/+3
under NLL Because NLL borrowck is run after typeck, `in_progress_typeck_results` was always `None` which was preventing the retrieval of the span to which the suggestion is suppose to add the lifetime bound. We now manually pass the `LocalDefId` owner to `construct_generic_bound_failure` so that under NLL, we give the owner id of the current body.
2022-04-04Format invariance notes with backticksMichael Goulet-4/+4
2021-12-29Refactor variance diagnostics to work with more typesAaron Hill-0/+8
Instead of special-casing mutable pointers/references, we now support general generic types (currently, we handle `ty::Ref`, `ty::RawPtr`, and `ty::Adt`) When a `ty::Adt` is involved, we show an additional note explaining which of the type's generic parameters is invariant (e.g. the `T` in `Cell<T>`). Currently, we don't explain *why* a particular generic parameter ends up becoming invariant. In the general case, this could require printing a long 'backtrace' of types, so doing this would be more suitable for a follow-up PR. We still only handle the case where our variance switches to `ty::Invariant`.
2021-11-14Improve diagnostics when a static lifetime is expectedLucas Kent-4/+5
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-6/+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-05-12Don't suggest adding `'static` lifetime to argumentsAaron Hill-2/+0
Fixes #69350 This is almost always the wrong this to do
2021-03-31Add var to BoundRegion. Add query to get bound vars for applicable items.Jack Huey-13/+13
2021-02-02Rollup merge of #81634 - jesusprubio:jesusprubio/add-long-explanation-e0521, ↵Jack Huey-1/+4
r=GuillaumeGomez Add long explanation e0521 Helps with #61137
2021-02-01Process mentioned upvars for analysis first pass after ExprUseVisitorAman Arora-6/+6
- This allows us add fake information after handling migrations if needed. - Capture analysis also priortizes what we see earlier, which means fake information should go in last.
2021-02-01Update ui testsJesus Rubio-1/+4
2020-12-18Make BoundRegion have a kind of BoungRegionKindJack Huey-13/+13
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-17/+17
2020-09-02pretty: trim paths of unique symbolsDan Aloni-6/+6
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-03-21rustc: keep upvars tupled in {Closure,Generator}Substs.Eduard-Mihai Burtescu-6/+17
2020-01-31Auto merge of #68080 - varkor:declared-here, r=petrochenkovbors-1/+1
Address inconsistency in using "is" with "declared here" "is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout. r? @Centril
2020-01-25Use better bound names in `-Zverbose` modeEsteban Küber-1/+1
2020-01-24Normalise diagnostics with respect to "the X is declared/defined here"varkor-1/+1
2020-01-23Use check-pass mode for nll testsTomasz Miąsko-1/+1
2020-01-12Diagnostics should start lowercasevarkor-33/+33
2019-12-06Auto merge of #66911 - eddyb:nicer-rustc_regions, r=matthewjasperbors-38/+33
rustc_mir: use nicer path printing for #[rustc_regions] NLL tests. Similar to #66850, spotted while working on #66907. r? @matthewjasper
2019-11-30rustc_mir: use nicer path printing for #[rustc_regions] NLL tests.Eduard-Mihai Burtescu-38/+33
2019-11-30rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.Eduard-Mihai Burtescu-13/+13
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+12
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-07Rollup merge of #66087 - tmiasko:ui-mode, r=CentrilMazdak Farrokhzad-1/+1
Update some build-pass ui tests to use check-pass where applicable Helps with issue https://github.com/rust-lang/rust/issues/62277.
2019-11-05rustc: remove "GlobalMetaData" dead code from hir::map::definitions.Eduard-Mihai Burtescu-33/+33
2019-11-04Use check-pass in ui tests where appropriateTomasz Miąsko-1/+1
2019-10-27update testsMark Mansi-18/+6
2019-10-27implement outlive suggestionsMark Mansi-0/+24
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-2/+2
2019-06-16compiletest: Remove `skip-codegen`Vadim Petrochenkov-3/+2
2019-06-01rustc: collect upvars from HIR, instead of during name resolution.Eduard-Mihai Burtescu-9/+9
2019-05-12Remove feature(nll) when compare mode is sufficientMatthew Jasper-7/+1
2019-05-09Rollup merge of #60648 - petrochenkov:shorten2, r=Dylan-DPCMazdak Farrokhzad-2/+1
Skip codegen for one UI test with long file path The path to this test is so long that object files produced by it hit some path length limit on Windows and linker cannot find them. The workaround here is to skip codegen and avoid producing object files, this test doesn't need them anyway.