summary refs log tree commit diff
path: root/src/test/ui/generator
AgeCommit message (Collapse)AuthorLines
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
2018-04-11Checkpoint the current status of NLL on `ui` tests via compare-mode=nll.Felix S. Klock II-0/+130
2018-04-11Workaround rust-lang/rust#49855 by forcing rustc_error in any mode, ↵Felix S. Klock II-6/+6
including NLL. NOTE: I was careful to make each change in a manner that preserves the existing diagnostic output (usually by ensuring that no lines were added or removed). This means that the resulting source files are not as nice to read as they were at the start. But we will have to review these cases by hand anyway as follow-up work, so cleanup could reasonably happen then (or not at all).
2018-03-25Rollup merge of #49194 - Zoxc:unsafe-generator, r=cramertjkennytm-48/+20
Make resuming generators unsafe instead of the creation of immovable generators cc @withoutboats Fixes #47787
2018-03-21use subtyping when we create a closure instead of for upvar typesNiko Matsakis-3/+3
We used to make the upvar types in the closure `==` but that was stronger than we needed. Subtyping suffices, since we are copying the upvar value into the closure field. This in turn allows us to infer smaller lifetimes in captured values in some cases (like the example here), avoiding errors.
2018-03-21Make resuming generators unsafe instead of the creation of immovable ↵John Kåre Alsaker-48/+20
generators. Fixes #47787
2018-03-16Rollup merge of #48706 - ehuss:main-not-found-in-crate, r=estebankkennytm-10/+8
Add crate name to "main function not found" error message. Fixes #44798 and rust-lang/cargo#4948. I was wondering if it might be cleaner to update the ui tests to add a simple `fn main() {}` for the unrelated tests. Let me know if you would prefer that.
2018-03-15Auto merge of #48138 - estebank:issue-45092, r=nikomatsakisbors-4/+4
Reword E0044 and message for `!Send` types - Reword E0044 help. - Change error message for types that don't implement `Send` CC #45092, #46678, #24909, #33307.
2018-03-14Reword E0044 and message for `!Send` typesEsteban Küber-4/+4
- Reword E0044 help. - Change error message for types that don't implement `Send`
2018-03-14Add empty main() to tests where it is missing.Eric Huss-10/+8
2018-03-14Add crate name to "main function not found" error message.Eric Huss-2/+2
Fixes #44798 and rust-lang/cargo#4948.
2018-03-14update testsGuillaume Gomez-22/+22
2018-02-26Update UI testsVadim Petrochenkov-7/+7
2018-02-26Update UI testsVadim Petrochenkov-61/+61
2018-02-25Update ui testsGuillaume Gomez-0/+22
2018-02-09Fix visitation order of calls so that it matches execution order. Fixes #48048John Kåre Alsaker-0/+33
2018-01-30Allow access of the state field before the generator transform. Fixes ↵John Kåre Alsaker-18/+18
#47482, #46476
2018-01-29Require yield types to be sizedJohn Kåre Alsaker-0/+43
2018-01-29Make `yield_in_scope_for_expr` work with patterns. Fixes #47758John Kåre Alsaker-0/+33
2018-01-23Port borrows across yield check to MIR borrowckJohn Kåre Alsaker-0/+54
2018-01-23Add dropck testJohn Kåre Alsaker-0/+44
2018-01-23Fix yield-while-local-borrowed.rs testJohn Kåre Alsaker-8/+42
2018-01-23Make immovable generators unsafeJohn Kåre Alsaker-0/+27
2018-01-23Adds support for immovable generators. Move checking of invalid borrows ↵John Kåre Alsaker-4/+97
across suspension points to borrowck. Fixes #44197, #45259 and #45093.
2018-01-15On E0283, point at method with the requirementsEsteban Küber-2/+10
On required type annotation diagnostic error, point at method with the requirements if the span is available.
2017-12-14Point at var in short lived borrowsEsteban Küber-8/+10
2017-11-24Merge cfail and ui tests into ui testsOliver Schneider-5/+5
2017-09-20add proofs and fix postorder traversalAriel Ben-Yehuda-4/+4
I don't think the "quasi-postorder" travesal could cause any issues, but there's no reason for it to stay broken.
2017-09-20Only consider yields coming after the expressions when computing generator ↵John Kåre Alsaker-34/+0
interiors
2017-08-17Fix more UI testsAlex Crichton-1/+1
2017-08-17Fix UI testsAlex Crichton-10/+2
2017-08-14Choose another error codeAlex Crichton-1/+1
2017-08-12Fix UI testAlex Crichton-4/+4
2017-08-09Add UI test outputsAlex Crichton-0/+89
2017-08-09Initial pass review commentsAlex Crichton-0/+120
2017-07-29Use a free error codeAlex Crichton-5/+5