about summary refs log tree commit diff
path: root/src/test/ui/generator
AgeCommit message (Collapse)AuthorLines
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.)
2018-07-27Auto merge of #52681 - pnkfelix:z-borrowck-migrate, r=nikomatsakisbors-28/+8
Add `-Z borrowck=migrate` This adds `-Z borrowck=migrate`, which represents the way we want to migrate to NLL under Rust versions to come. It also hooks this new mode into `--edition 2018`, which means we're officially turning NLL on in the 2018 edition. The basic idea of `-Z borrowck=migrate` that there are cases where NLL is fixing old soundness bugs in the borrow-checker, but in order to avoid just breaking code by immediately rejecting the programs that hit those soundness bugs, we instead use the following strategy: If your code is accepted by NLL, then we accept it. If your code is rejected by both NLL and the old AST-borrowck, then we reject it. If your code is rejected by NLL but accepted by the old AST-borrowck, then we emit the new NLL errors as **warnings**. These warnings will be turned into hard errors in the future, and they say so in these diagnostics. Fix #46908
2018-07-26integrate the edition code.Felix S. Klock II-28/+8
As a driveby change, I made `#![feature(nll)]` *always* take precedence over `-Z borrowck`. The main effect this had is that it means tests with `#![feature(nll)]` will ignore uses of `-Z borrowck=compare`. This affected only one test as far as I can tell, and I think that test used `-Z borrowck=compare` only as a historical accident.
2018-07-23Don't match on region kinds when reporting NLL errorsMatthew Jasper-5/+5
With NLL region kinds are always ReVar
2018-07-17Fix doc linkFelix Rabe-2/+2
The link for comparison: - https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized (broken) - https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized (fixed) This commit is the result of (first) searching via: find src -type f -print0 | xargs -0 fgrep -l dynamically-sized-types--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--sized/dynamically-sized-types-and-sized/g find src/{libcore,test/ui} -type f -name '*.bak' -print0 | xargs -0 rm (Note: Commands run on macOS 10.13 (BSD). `sed -i.bak` should work on GNU/Linux as well, but not tested.)
2018-07-10Fix typo in error message E0277Rémy Rakic-5/+5
2018-07-01Make causal tracking lazySantiago Pastorino-20/+7
2018-06-22Auto merge of #51463 - estebank:error-codes, r=nikomatsakisbors-9/+14
Various changes to existing diagnostics * [Add code to `invalid ABI` error, add span label, move list to help to make message shorter](https://github.com/rust-lang/rust/pull/51463/commits/23ae5af274defa9ff884f593e44a2bbcaf814a02): ``` error[E0697]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI | ^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted ``` * [Add code to incorrect `pub` restriction error](https://github.com/rust-lang/rust/pull/51463/commits/e96fdea8a38f39f99f8b9a4000a689187a457e08) * [Add message to `rustc_on_unimplemented` attributes in core to have them set a custom message _and_ label](https://github.com/rust-lang/rust/pull/51463/commits/2cc7e5ed307aee936c20479cfdc7409d6b52a464): ``` error[E0277]: `W` does not have a constant size known at compile-time --> $DIR/unsized-enum2.rs:33:8 | LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type ``` ``` error[E0277]: `Foo` cannot be sent between threads safely --> $DIR/E0277-2.rs:26:5 | LL | is_send::<Foo>(); | ^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `Foo` ``` ``` error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:16:7 | LL | 5 < String::new(); | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}` ``` ``` error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:17:7 | LL | 6 == Ok(1); | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}` ``` ``` error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:16:19 | LL | struct WellFormed<Z = Foo<i32, i32>>(Z); | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` note: required by `Foo` --> $DIR/type-check-defaults.rs:15:1 | LL | struct Foo<T, U: FromIterator<T>>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` * [Add link to book for `Sized` errors](https://github.com/rust-lang/rust/pull/51463/commits/1244dc7c283323aea1a3457a4458d590a3e160c8): ``` error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:13:29 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: constant expressions must have a statically known size ``` * [Point to previous line for single expected token not found](https://github.com/rust-lang/rust/pull/51463/commits/48165168fb0f059d8536cd4a2276b609d4a7f721) (if the current token is in a different line)
2018-06-19Update message for `!Sized` typesEsteban Küber-7/+7
2018-06-19Suggest that values are dropped in the opposite order they are definedSantiago Pastorino-0/+4
2018-06-19Add link to book for `Sized` errorsEsteban Küber-0/+2
2018-06-19Add message to `rustc_on_unimplemented` attributes in coreEsteban Küber-7/+10
2018-06-06It turns out that the diagnostics generated from NLL for these cases are now ↵Felix S. Klock II-11/+0
exactly the same as that produced by AST borrowck. Bravo!
2018-05-25rust-lang/rust#51025: improve test robustness so that they work under NLL too.Felix S. Klock II-8/+27
2018-05-01Update ui/generator tests to reflect changes from new generator drop rules.Felix S. Klock II-32/+74
2018-04-27Access individual fields of tuples, closures and generators on drop.Matthew Jasper-30/+2