diff --git a/src/test/ui/generator-yielding-or-returning-itself.rs b/src/test/ui/generator-yielding-or-returning-itself.rs index fd5266798187..30788e3c1864 100644 --- a/src/test/ui/generator-yielding-or-returning-itself.rs +++ b/src/test/ui/generator-yielding-or-returning-itself.rs @@ -13,7 +13,7 @@ pub fn want_cyclic_generator_return(_: T) fn supply_cyclic_generator_return() { want_cyclic_generator_return(|| { - //~^ ERROR closure/generator type that references itself + //~^ ERROR type mismatch if false { yield None.unwrap(); } None.unwrap() }) diff --git a/src/test/ui/generator-yielding-or-returning-itself.stderr b/src/test/ui/generator-yielding-or-returning-itself.stderr index c9a71e03858f..1572219cf4ac 100644 --- a/src/test/ui/generator-yielding-or-returning-itself.stderr +++ b/src/test/ui/generator-yielding-or-returning-itself.stderr @@ -1,13 +1,13 @@ -error[E0644]: closure/generator type that references itself - --> $DIR/generator-yielding-or-returning-itself.rs:15:34 +error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6 _] as std::ops::Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6 _]` + --> $DIR/generator-yielding-or-returning-itself.rs:15:5 | -LL | want_cyclic_generator_return(|| { - | __________________________________^ -LL | | -LL | | if false { yield None.unwrap(); } -LL | | None.unwrap() -LL | | }) - | |_____^ cyclic type of infinite size +LL | pub fn want_cyclic_generator_return(_: T) + | ---------------------------- +LL | where T: Generator + | ---------- required by this bound in `want_cyclic_generator_return` +... +LL | want_cyclic_generator_return(|| { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, @@ -30,5 +30,4 @@ LL | want_cyclic_generator_yield(|| { error: aborting due to 2 previous errors -Some errors have detailed explanations: E0271, E0644. -For more information about an error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/generator/no-parameters-on-generators.rs b/src/test/ui/generator/no-parameters-on-generators.rs index 6b5a55793395..cad004895349 100644 --- a/src/test/ui/generator/no-parameters-on-generators.rs +++ b/src/test/ui/generator/no-parameters-on-generators.rs @@ -1,8 +1,10 @@ #![feature(generators)] fn main() { - let gen = |start| { //~ ERROR generators cannot have explicit parameters + let gen = |start| { //~^ ERROR type inside generator must be known in this context yield; + //~^ ERROR type inside generator must be known in this context + //~| ERROR type inside generator must be known in this context }; } diff --git a/src/test/ui/generator/no-parameters-on-generators.stderr b/src/test/ui/generator/no-parameters-on-generators.stderr index 5e8e043a391c..f5f83b047690 100644 --- a/src/test/ui/generator/no-parameters-on-generators.stderr +++ b/src/test/ui/generator/no-parameters-on-generators.stderr @@ -1,9 +1,3 @@ -error[E0628]: generators cannot have explicit parameters - --> $DIR/no-parameters-on-generators.rs:4:15 - | -LL | let gen = |start| { - | ^^^^^^^ - error[E0698]: type inside generator must be known in this context --> $DIR/no-parameters-on-generators.rs:4:16 | @@ -16,6 +10,30 @@ note: the type is part of the generator because of this `yield` LL | yield; | ^^^^^ -error: aborting due to 2 previous errors +error[E0698]: type inside generator must be known in this context + --> $DIR/no-parameters-on-generators.rs:6:9 + | +LL | yield; + | ^^^^^ cannot infer type + | +note: the type is part of the generator because of this `yield` + --> $DIR/no-parameters-on-generators.rs:6:9 + | +LL | yield; + | ^^^^^ + +error[E0698]: type inside generator must be known in this context + --> $DIR/no-parameters-on-generators.rs:6:9 + | +LL | yield; + | ^^^^^ cannot infer type + | +note: the type is part of the generator because of this `yield` + --> $DIR/no-parameters-on-generators.rs:6:9 + | +LL | yield; + | ^^^^^ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0698`. diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.rs b/src/test/ui/generator/type-mismatch-signature-deduction.rs index b9c6bc5d0796..7774ff48f56b 100644 --- a/src/test/ui/generator/type-mismatch-signature-deduction.rs +++ b/src/test/ui/generator/type-mismatch-signature-deduction.rs @@ -2,15 +2,15 @@ use std::ops::Generator; -fn foo() -> impl Generator { +fn foo() -> impl Generator { //~ ERROR type mismatch || { if false { - return Ok(6); //~ ERROR mismatched types [E0308] + return Ok(6); } yield (); - 5 + 5 //~ ERROR mismatched types [E0308] } } diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.stderr b/src/test/ui/generator/type-mismatch-signature-deduction.stderr index 8606ecd33dab..8de77798ff48 100644 --- a/src/test/ui/generator/type-mismatch-signature-deduction.stderr +++ b/src/test/ui/generator/type-mismatch-signature-deduction.stderr @@ -1,12 +1,23 @@ error[E0308]: mismatched types - --> $DIR/type-mismatch-signature-deduction.rs:8:20 + --> $DIR/type-mismatch-signature-deduction.rs:13:9 | -LL | return Ok(6); - | ^^^^^ expected `i32`, found enum `std::result::Result` +LL | 5 + | ^ expected enum `std::result::Result`, found integer | - = note: expected type `i32` - found enum `std::result::Result<{integer}, _>` + = note: expected type `std::result::Result<{integer}, _>` + found type `{integer}` -error: aborting due to previous error +error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:6:5: 14:6 _] as std::ops::Generator>::Return == i32` + --> $DIR/type-mismatch-signature-deduction.rs:5:13 + | +LL | fn foo() -> impl Generator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found `i32` + | + = note: expected enum `std::result::Result<{integer}, _>` + found type `i32` + = note: the return type of a function must have a statically known size -For more information about this error, try `rustc --explain E0308`. +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0271, E0308. +For more information about an error, try `rustc --explain E0271`.