summary refs log tree commit diff
path: root/src/test/ui/generator
AgeCommit message (Collapse)AuthorLines
2019-08-06Rollup merge of #63230 - tmandry:disallow-possibly-uninitialized, r=CentrilMazdak Farrokhzad-0/+67
Make use of possibly uninitialized data [E0381] a hard error This is one of the behaviors we no longer allow in NLL. Since it can lead to undefined behavior, I think it's definitely worth making it a hard error without waiting to turn off migration mode (#58781). Closes #60450. My ulterior motive here is making it impossible to leave variables partially initialized across a yield (see #60889, discussion at #63035), so tests are included for that. cc #54987 --- I'm not sure if bypassing the buffer is a good way of doing this. We could also make a `force_errors_buffer` or similar that gets recombined with all the errors as they are emitted. But this is simpler and seems fine to me. r? @Centril cc @cramertj @nikomatsakis @pnkfelix @RalfJung
2019-08-05Make use of possibly uninitialized data a hard errorTyler Mandry-0/+67
This is one of the behaviors we no longer allow in NLL. Since it can lead to undefined behavior, I think it's definitely worth making it a hard error without waiting to turn off migration mode (#58781). Closes #60450. My ulterior motive here is making it impossible to leave variables partially initialized across a yield (see discussion at #63035), so tests are included for that.
2019-07-27tests: Move run-pass tests without naming conflicts to uiVadim Petrochenkov-0/+1109
2019-07-22Bless output of test generator/ref-escapes-but-not-over-yield.rs for Poloniuslqd-0/+20
2019-07-17Test case for #62506.Giles Cope-0/+18
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-2/+2
2019-06-25Use `as_temp` to evaluate statement expressionsMatthew Jasper-0/+32
2019-05-24Move async/await tests to test/ui/async-awaitvarkor-30/+0
2019-05-12Remove feature(nll) when compare mode is sufficientMatthew Jasper-9/+3
2019-05-12Change compare mode to use -Zborrowck=mirMatthew Jasper-0/+41
2019-05-07Auto merge of #60586 - cramertj:await, r=oli-obkbors-12/+12
Implement built-in await syntax Adds support for .await under the existing async_await feature gate. Moves macro-like await! syntax to the await_macro feature gate. Removes support for `await` as a non-keyword under the `async_await` feature. This new syntax is not final, but is the consensus solution proposed by the lang team, as explained in https://boats.gitlab.io/blog/post/await-decision/ Fix https://github.com/rust-lang/rust/issues/51719 Fix https://github.com/rust-lang/rust/issues/51751 Fix https://github.com/rust-lang/rust/issues/60016
2019-05-07Implement built-in await syntaxTaylor Cramer-12/+12
Adds support for .await under the existing async_await feature gate. Moves macro-like await! syntax to the await_macro feature gate. Removes support for `await` as a non-keyword under the `async_await` feature.
2019-05-07Trust signature over return expr for generators.David Wood-21/+10
This commit extends the logic used to determine what the expected signature of a closure is so that it can also determine the expected signature of a generator. This improves a diagnostic where the fn signature was blamed instead of the generator body. It doesn't fix fix the diagnostic for `async fn`.
2019-05-06Add test for current behaviour.David Wood-0/+40
This commit adds a test for the current behaviour of signature deduction of generators when there is a type mismatch between the return type of the function body and the signature.
2019-05-03Update testsChristopher Vittal-31/+9
2019-04-25Auto merge of #59111 - gilescope:generator-better-errors, r=nikomatsakisbors-0/+30
Improved error message when type must be bound due to generator. Fixes #58930. Keen to get some feedback - is this as minimal as we can get it or is there an existing visitor I could repurpose?
2019-04-25Improved error message when type must be bound due to generator.Giles Cope-0/+30
Error now mentions type var name and span is highlighted.
2019-04-22Remove double trailing newlinesvarkor-2/+0
2019-04-22update tests for migrate mode by defaultMatthew Jasper-172/+48
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-7/+2
2019-03-13Rollup merge of #59132 - nikomatsakis:issue-53548-generator-bound, r=pnkfelixMazdak Farrokhzad-0/+59
ignore higher-ranked object bound conditions created by WF In the `issue-53548` test added in this PR, the `Box<dyn Trait>` type is expanded to `Box<dyn Trait + 'static>`, but the generator "witness" that results is `for<'r> { Box<dyn Trait + 'r> }`. The WF code was encountering an ICE (when debug-assertions were enabled) and an unexpected compilation error (without debug-asserions) when trying to process this `'r` region bound. In particular, to be WF, the region bound must meet the requirements of the trait, and hence we got `for<'r> { 'r: 'static }`. This would ICE because the `Binder` constructor we were using was assering that no higher-ranked regions were involved (because the WF code is supposed to skip those). The error (if debug-asserions were disabled) came because we obviously cannot prove that `'r: 'static` for any region `'r`. Pursuant with our "lazy WF" strategy for higher-ranked regions, the fix is not to require that `for<'r> { 'r: 'static }` holds (this is also analogous to what we would do for higher-ranked regions appearing within the trait in other positions). Fixes #53548 r? @pnkfelix
2019-03-12ignore higher-ranked WF requirements for trait objectsNiko Matsakis-0/+59
In the `issue-53548` test added in this commit, the `Box<dyn Trait>` type is expanded to `Box<dyn Trait + 'static>`, but the generator "witness" that results is `for<'r> { Box<dyn Trait + 'r> }`. The WF code was encountering an ICE (when debug-assertions were enabled) and an unexpected compilation error (without debug-asserions) when trying to process this `'r` region bound. In particular, to be WF, the region bound must meet the requirements of the trait, and hence we got `for<'r> { 'r: 'static }`. This would ICE because the `Binder` constructor we were using was assering that no higher-ranked regions were involved (because the WF code is supposed to skip those). The error (if debug-asserions were disabled) came because we obviously cannot prove that `'r: 'static` for any region `'r`. Pursuant with our "lazy WF" strategy for higher-ranked regions, the fix is not to require that `for<'r> { 'r: 'static }` holds (this is also analogous to what we would do for higher-ranked regions appearing within the trait in other positions).
2019-03-11Update NLL testsVadim Petrochenkov-6/+6
2019-03-11Update testsVadim Petrochenkov-13/+13
2019-01-29Auto merge of #57901 - lqd:issue_57362, r=nikomatsakisbors-4/+4
Add information to higher-ranked lifetimes conflicts error messages Make these errors go through the new "placeholder error" code path, to have self tys displayed and make them hopefully less confusing. Should fix #57362. r? @nikomatsakis — so we can iterate on the specific wording you wanted.
2019-01-28Refer to synthetically named lifetimes as "some specific lifetime" rather ↵Rémy Rakic-2/+2
than "the specific lifetime"
2019-01-27Temporary workaround for travis diagnostic differenceWim Looman-4/+6
2019-01-27Mark static generators as !UnpinWim Looman-0/+28
2019-01-27Change generator trait to use pinningWim Looman-68/+72
2019-01-27Update test expectations for new placeholder error messagesRemy Rakic-4/+4
2019-01-05Rollup merge of #57249 - frewsxcv:frewsxcv-second-edition, r=KodrAuskennytm-2/+2
Fix broken links to second edition TRPL. Fixes https://github.com/rust-lang/rust/issues/57104. Remove `second-edition/` from TRPL hyperlinks.
2019-01-02say "the lifetime" instead of "some lifetime" when it feels rightNiko Matsakis-2/+2
In particular, when we want to indicate that there is a connection between the self type and the other types.
2019-01-02apply the same logic to ConcreteFailure errorsNiko Matsakis-22/+7
2019-01-02introduce placeholder-placeholder errors for trait matchingNiko Matsakis-23/+6
2019-01-02tests: worse diagnostics, but basically same errorsNiko Matsakis-28/+45
2019-01-01Fix broken links to second edition TRPL.Corey Farwell-2/+2
Fixes https://github.com/rust-lang/rust/issues/57104.
2018-12-25Remove licensesMark Rousskov-216/+46
2018-12-05Rollup merge of #56372 - wildarch:issue-55314-second-borrow-ref, r=davidtwcoPietro Albini-1/+1
Refer to the second borrow as the "second borrow" in E0501.rs Fixes #55314. r? @davidtwco
2018-12-04Update testsOliver Scherer-0/+2
2018-11-30Refer to the second borrow as the "second borrow".Daan de Graaf-1/+1
2018-10-21Use new region infer errors for explaining borrowsMatthew Jasper-10/+13
This gives at least some explanation for why a borrow is expected to last for a certain free region. Also: * Reports E0373: "closure may outlive the current function" with NLL. * Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515). * Special case assigning a reference to a local variable in a closure to a captured variable.
2018-10-19Rollup merge of #55013 - matthewjasper:propagate-generator-bounds, ↵kennytm-0/+45
r=nikomatsakis [NLL] Propagate bounds from generators This used to only be done for closures.
2018-10-18Propagate bounds from generatorsMatthew Jasper-0/+45
2018-10-18Extend closure special-casing for generators.David Wood-50/+45
This commit extends existing special-casing of closures to highlight the use of variables within generators that are causing the generator to borrow them.
2018-10-05Updates to .stderr output in ui tests from earlier changes.Felix S. Klock II-4/+11
2018-10-03Clearer later use messages for callsMatthew Jasper-2/+2
Give a special message when the later use is from a call. Use the span of the callee instead of the whole expression. For conflicting borrow messages say that the later use is of the first borrow.
2018-09-23Update tests for changes to drop accessMatthew Jasper-0/+2
2018-09-18Update NLL 3-point error message for fake reads in optimized let patternsRemy Rakic-2/+3
2018-08-05Fix doc link (again)Felix Rabe-2/+2
Similar to #52404. The link for comparison: - https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized (broken) - https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, stable 2nd ed) - https://doc.rust-lang.org/nightly/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, nightly 2nd ed) - https://doc.rust-lang.org/nightly/book/2018-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait (correct, nightly 2018 ed) This commit is the result of (first) searching via ripgrep (0.8.1 -SIMD -AVX): rg -l dynamically-sized-types-and-sized and then replacing all relevant occurrences via: find src/{libcore,test/ui} -type f -print0 | xargs -0 sed -i.bak \ s/dynamically-sized-types-and-sized/dynamically-sized-types-and-the-sized-trait/g find src/{libcore,test/ui} -type f -name '*.bak' -print0 | xargs -0 rm (Note: Tested on on macOS 10.13 (BSD). `sed -i.bak` should work on Linux (GNU sed) as well, but not tested.)
2018-08-01minor fallout from the change.Felix S. Klock II-2/+0
(Presumably the place that borrow_check ends up reporting for the error about is no longer the root `Local` itself, and thus the note diagnostic here stops firing.)