Skip to content
Permalink
Browse files

WIP fix tests

  • Loading branch information...
nikomatsakis committed Oct 2, 2019
1 parent 81cd596 commit dce20bf62a37cd8b22858c6f23de62cd36404fa1
@@ -20,7 +20,7 @@ fn return_targets_async_block_not_fn() -> u8 {
}

async fn return_targets_async_block_not_async_fn() -> u8 {
//~^ ERROR type mismatch resolving
//~^ ERROR mismatched types
let block = async {
return 0u8;
};
@@ -39,6 +39,22 @@ LL | let _: &dyn Future<Output = ()> = &block;
found type `()`
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`

error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:22:58
|
LL | async fn return_targets_async_block_not_async_fn() -> u8 {
| __________________________________________________________^
LL | |
LL | | let block = async {
LL | | return 0u8;
... |
LL | |
LL | | }
| |_^ expected u8, found ()
|
= note: expected type `u8`
found type `()`

error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
--> $DIR/async-block-control-flow-static-semantics.rs:27:39
|
@@ -49,16 +65,6 @@ LL | let _: &dyn Future<Output = ()> = &block;
found type `()`
= note: required for the cast to the object type `dyn std::future::Future<Output = ()>`

error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == u8`
--> $DIR/async-block-control-flow-static-semantics.rs:22:55
|
LL | async fn return_targets_async_block_not_async_fn() -> u8 {
| ^^ expected (), found u8
|
= note: expected type `()`
found type `u8`
= note: the return type of a function must have a statically known size

error[E0308]: mismatched types
--> $DIR/async-block-control-flow-static-semantics.rs:48:44
|
@@ -9,7 +9,7 @@ fn get_future() -> impl Future<Output = ()> {
}

async fn foo() {
let a; //~ ERROR type inside `async` object must be known in this context
let a; //~ ERROR type inside `async` fn body must be known in this context
get_future().await;
}

@@ -1,10 +1,10 @@
error[E0698]: type inside `async` object must be known in this context
error[E0698]: type inside `async` fn body must be known in this context
--> $DIR/async-error-span.rs:12:9
|
LL | let a;
| ^ cannot infer type
|
note: the type is part of the `async` object because of this `await`
note: the type is part of the `async` fn body because of this `await`
--> $DIR/async-error-span.rs:13:5
|
LL | get_future().await;
@@ -9,9 +9,9 @@ trait Foo {}
impl Xyz {
async fn do_sth<'a>(
&'a self, foo: &dyn Foo
) -> &dyn Foo //~ ERROR lifetime mismatch
) -> &dyn Foo
{
foo
foo //~ ERROR lifetime mismatch
}
}

@@ -1,12 +1,13 @@
error[E0623]: lifetime mismatch
--> $DIR/issue-63388-1.rs:12:10
--> $DIR/issue-63388-1.rs:14:9
|
LL | &'a self, foo: &dyn Foo
| -------- this parameter and the return type are declared with different lifetimes...
LL | ) -> &dyn Foo
| ^^^^^^^^
| |
| ...but data from `foo` is returned here
| --------
LL | {
LL | foo
| ^^^ ...but data from `foo` is returned here

error: aborting due to previous error

@@ -11,8 +11,9 @@ error: cannot infer an appropriate lifetime
|
LL | foo: &dyn Foo, bar: &'a dyn Foo
| ^^^ ...but this borrow...
LL | ) -> &dyn Foo
| -------- this return type evaluates to the `'static` lifetime...
...
LL | foo
| --- this return type evaluates to the `'static` lifetime...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 11:14
--> $DIR/issue-63388-2.rs:11:14
@@ -21,8 +22,8 @@ LL | foo: &dyn Foo, bar: &'a dyn Foo
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 11:14
|
LL | ) -> &dyn Foo + '_
| ^^^^^^^^^^^^^
LL | foo + '_
|

error: aborting due to 2 previous errors

@@ -7,9 +7,9 @@ async fn bar<T>() -> () {}

async fn foo() {
bar().await;
//~^ ERROR type inside `async` object must be known in this context
//~^ ERROR type inside `async` fn body must be known in this context
//~| NOTE cannot infer type for `T`
//~| NOTE the type is part of the `async` object because of this `await`
//~| NOTE the type is part of the `async` fn body because of this `await`
//~| NOTE in this expansion of desugaring of `await`
}
fn main() {}
@@ -1,10 +1,10 @@
error[E0698]: type inside `async` object must be known in this context
error[E0698]: type inside `async` fn body must be known in this context
--> $DIR/unresolved_type_param.rs:9:5
|
LL | bar().await;
| ^^^ cannot infer type for `T`
|
note: the type is part of the `async` object because of this `await`
note: the type is part of the `async` fn body because of this `await`
--> $DIR/unresolved_type_param.rs:9:5
|
LL | bar().await;
@@ -1,28 +1,25 @@
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:45
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ---- ^^^^
| | |
| | ...but data from `f` is returned here
| ---- ---- ^ ...but data from `f` is returned here
| |
| this parameter and the return type are declared with different lifetimes...

error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:55
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:82
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ----- ^^^^^^^^^^^^^^^^^
| | |
| | ...but data from `f` is returned here
| ----- ----------------- ^ ...but data from `f` is returned here
| |
| this parameter and the return type are declared with different lifetimes...

error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:58
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
|
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| ----- ^^^
| | |
| | ...but data from `arg` is returned here
| ----- --- ^^^ ...but data from `arg` is returned here
| |
| this parameter and the return type are declared with different lifetimes...

error: aborting due to 3 previous errors
@@ -11,29 +11,29 @@ impl<'a> Struct<'a> {
// Test using `&self` sugar:

async fn ref_self(&self, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

// Test using `&Self` explicitly:

async fn ref_Self(self: &Self, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}
}

@@ -1,56 +1,62 @@
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:13:42
--> $DIR/lt-ref-self-async.rs:14:9
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| ----- ----
| |
| this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here

error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:19:48
--> $DIR/lt-ref-self-async.rs:20:9
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| ----- ----
| |
| this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here

error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:23:57
--> $DIR/lt-ref-self-async.rs:24:9
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| ----- ----
| |
| this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here

error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:27:57
--> $DIR/lt-ref-self-async.rs:28:9
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| ----- ----
| |
| this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here

error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:31:66
--> $DIR/lt-ref-self-async.rs:32:9
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| ----- ----
| |
| this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here

error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:35:62
--> $DIR/lt-ref-self-async.rs:36:9
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| ----- ----
| |
| this parameter and the return type are declared with different lifetimes...
LL | f
| ^ ...but data from `f` is returned here

error: aborting due to 6 previous errors

@@ -10,30 +10,30 @@ struct Struct { }
impl Struct {
// Test using `&mut self` sugar:

async fn ref_self(&mut self, f: &u32) -> &u32 { //~ ERROR lifetime mismatch
f
async fn ref_self(&mut self, f: &u32) -> &u32 {
f //~ ERROR lifetime mismatch
}

// Test using `&mut Self` explicitly:

async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}

async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
f //~^ ERROR lifetime mismatch
f //~ ERROR lifetime mismatch
}
}

0 comments on commit dce20bf

Please sign in to comment.
You can’t perform that action at this time.