LL | | };
| |_________- enclosing `async` block
-error[E0308]: mismatched types
- --> $DIR/async-block-control-flow-static-semantics.rs:13:43
- |
-LL | fn return_targets_async_block_not_fn() -> u8 {
- | --------------------------------- ^^ expected `u8`, found `()`
- | |
- | implicitly returns `()` as its body has no tail or `return` expression
-
-error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
- --> $DIR/async-block-control-flow-static-semantics.rs:18:39
- |
-LL | let _: &dyn Future<Output = ()> = █
- | ^^^^^^ expected `()`, found `u8`
- |
- = 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
|
|
= 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:13:43
+ |
+LL | fn return_targets_async_block_not_fn() -> u8 {
+ | --------------------------------- ^^ expected `u8`, found `()`
+ | |
+ | implicitly returns `()` as its body has no tail or `return` expression
+
+error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
+ --> $DIR/async-block-control-flow-static-semantics.rs:18:39
+ |
+LL | let _: &dyn Future<Output = ()> = █
+ | ^^^^^^ expected `()`, found `u8`
+ |
+ = 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:48:44
|
use std::future::Future;
fn get_future() -> impl Future<Output = ()> {
+//~^ ERROR the trait bound `(): std::future::Future` is not satisfied
panic!()
}
+error[E0277]: the trait bound `(): std::future::Future` is not satisfied
+ --> $DIR/async-error-span.rs:7:20
+ |
+LL | fn get_future() -> impl Future<Output = ()> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `()`
+LL |
+LL | panic!()
+ | -------- this returned value is of type `!`
+ |
+ = note: the return type of a function must have a statically known size
+
error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/async-error-span.rs:12:9
+ --> $DIR/async-error-span.rs:13:9
|
LL | let a;
| ^ cannot infer type
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/async-error-span.rs:13:5
+ --> $DIR/async-error-span.rs:14:5
|
LL | get_future().await;
| ^^^^^^^^^^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0698`.
+Some errors have detailed explanations: E0277, E0698.
+For more information about an error, try `rustc --explain E0277`.
fn foo11() -> Result<(), ()> {
let _ = await bar()?; //~ ERROR `await` is only allowed inside `async` functions and blocks
//~^ ERROR incorrect use of `await`
+ //~| ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
Ok(())
}
fn foo12() -> Result<(), ()> {
| ^^^^^^^^^^^^ help: `await` is a postfix operation: `bar()?.await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:68:14
+ --> $DIR/incorrect-syntax-suggestions.rs:69:14
|
LL | let _ = (await bar())?;
| ^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:73:24
+ --> $DIR/incorrect-syntax-suggestions.rs:74:24
|
LL | let _ = bar().await();
| ^^ help: `await` is not a method call, remove the parentheses
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:78:24
+ --> $DIR/incorrect-syntax-suggestions.rs:79:24
|
LL | let _ = bar().await()?;
| ^^ help: `await` is not a method call, remove the parentheses
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:106:13
+ --> $DIR/incorrect-syntax-suggestions.rs:107:13
|
LL | let _ = await!(bar());
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:110:13
+ --> $DIR/incorrect-syntax-suggestions.rs:111:13
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:115:17
+ --> $DIR/incorrect-syntax-suggestions.rs:116:17
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:123:17
+ --> $DIR/incorrect-syntax-suggestions.rs:124:17
|
LL | let _ = await!(bar())?;
| ^^^^^^^^^^^^^ help: `await` is a postfix operation: `bar().await`
error: expected expression, found `=>`
- --> $DIR/incorrect-syntax-suggestions.rs:131:25
+ --> $DIR/incorrect-syntax-suggestions.rs:132:25
|
LL | match await { await => () }
| ----- ^^ expected expression
| while parsing this incorrect await expression
error: incorrect use of `await`
- --> $DIR/incorrect-syntax-suggestions.rs:131:11
+ --> $DIR/incorrect-syntax-suggestions.rs:132:11
|
LL | match await { await => () }
| ^^^^^^^^^^^^^^^^^^^^^ help: `await` is a postfix operation: `{ await => () }.await`
error: expected one of `.`, `?`, `{`, or an operator, found `}`
- --> $DIR/incorrect-syntax-suggestions.rs:134:1
+ --> $DIR/incorrect-syntax-suggestions.rs:135:1
|
LL | match await { await => () }
| ----- - expected one of `.`, `?`, `{`, or an operator
| ^^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:68:14
+ --> $DIR/incorrect-syntax-suggestions.rs:69:14
|
LL | fn foo12() -> Result<(), ()> {
| ----- this is not `async`
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:73:13
+ --> $DIR/incorrect-syntax-suggestions.rs:74:13
|
LL | fn foo13() -> Result<(), ()> {
| ----- this is not `async`
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:78:13
+ --> $DIR/incorrect-syntax-suggestions.rs:79:13
|
LL | fn foo14() -> Result<(), ()> {
| ----- this is not `async`
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:83:13
+ --> $DIR/incorrect-syntax-suggestions.rs:84:13
|
LL | fn foo15() -> Result<(), ()> {
| ----- this is not `async`
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:87:13
+ --> $DIR/incorrect-syntax-suggestions.rs:88:13
|
LL | fn foo16() -> Result<(), ()> {
| ----- this is not `async`
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:92:17
+ --> $DIR/incorrect-syntax-suggestions.rs:93:17
|
LL | fn foo() -> Result<(), ()> {
| --- this is not `async`
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:99:17
+ --> $DIR/incorrect-syntax-suggestions.rs:100:17
|
LL | let foo = || {
| -- this is not `async`
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:115:17
+ --> $DIR/incorrect-syntax-suggestions.rs:116:17
|
LL | fn foo() -> Result<(), ()> {
| --- this is not `async`
| ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/incorrect-syntax-suggestions.rs:123:17
+ --> $DIR/incorrect-syntax-suggestions.rs:124:17
|
LL | let foo = || {
| -- this is not `async`
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
= note: required by `std::ops::Try::into_result`
-error: aborting due to 35 previous errors
+error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
+ --> $DIR/incorrect-syntax-suggestions.rs:63:19
+ |
+LL | let _ = await bar()?;
+ | ^^^^^^ the `?` operator cannot be applied to type `impl std::future::Future`
+ |
+ = help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
+ = note: required by `std::ops::Try::into_result`
+
+error: aborting due to 36 previous errors
Some errors have detailed explanations: E0277, E0728.
For more information about an error, try `rustc --explain E0277`.
--- /dev/null
+// edition:2018
+
+trait From {
+ fn from();
+}
+
+impl From for () {
+ fn from() {}
+}
+
+impl From for () {
+//~^ ERROR conflicting implementations of trait
+ fn from() {}
+}
+
+fn bar() -> impl core::future::Future<Output = ()> {
+ async move { From::from() }
+}
+
+fn main() {}
--- /dev/null
+error[E0119]: conflicting implementations of trait `From` for type `()`:
+ --> $DIR/issue-67651.rs:11:1
+ |
+LL | impl From for () {
+ | ---------------- first implementation here
+...
+LL | impl From for () {
+ | ^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
+++ /dev/null
-error[E0106]: missing lifetime specifier
- --> $DIR/issue-63388-2.rs:12:10
- |
-LL | foo: &dyn Foo, bar: &'a dyn Foo
- | -------- -----------
-LL | ) -> &dyn Foo
- | ^ help: consider using the named lifetime: `&'a`
- |
- = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0106`.
impl Xyz {
async fn do_sth<'a>(
- foo: &dyn Foo, bar: &'a dyn Foo //~ ERROR cannot infer
+ foo: &dyn Foo, bar: &'a dyn Foo
) -> &dyn Foo //~ ERROR missing lifetime specifier
{
foo
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar`
-error: cannot infer an appropriate lifetime
- --> $DIR/issue-63388-2.rs:11:9
- |
-LL | foo: &dyn Foo, bar: &'a dyn Foo
- | ^^^ ...but this borrow...
-...
-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
- |
-LL | foo: &dyn Foo, bar: &'a dyn Foo
- | ^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0106`.
async fn copy() -> Result<()> //~ ERROR wrong number of type arguments
{
Ok(())
+ //~^ type annotations needed
}
fn main() { }
LL | async fn copy() -> Result<()>
| ^^^^^^^^^^ expected 2 type arguments
-error: aborting due to previous error
+error[E0282]: type annotations needed
+ --> $DIR/issue-65159.rs:7:5
+ |
+LL | Ok(())
+ | ^^ cannot infer type for type parameter `E` declared on the enum `Result`
+
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0107`.
+Some errors have detailed explanations: E0107, E0282.
+For more information about an error, try `rustc --explain E0107`.
async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
//~^ ERROR ambiguous lifetime bound
//~| ERROR ambiguous lifetime bound
+ //~| ERROR ambiguous lifetime bound
+ //~| ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
+ //~| ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds
(a, b)
}
|
= help: add #![feature(member_constraints)] to the crate attributes to enable
-error: aborting due to 2 previous errors
+error: ambiguous lifetime bound in `impl Trait`
+ --> $DIR/ret-impl-trait-no-fg.rs:9:64
+ |
+LL | async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
+ | ^^^^^^^^^^^^^^^^^^ the elided lifetimes here do not outlive one another
+ |
+ = help: add #![feature(member_constraints)] to the crate attributes to enable
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+ --> $DIR/ret-impl-trait-no-fg.rs:9:1
+ |
+LL | / async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
+LL | |
+LL | |
+LL | |
+... |
+LL | | (a, b)
+LL | | }
+ | |_^
+ |
+ = note: hidden type `(&u8, &u8)` captures lifetime '_#4r
+
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+ --> $DIR/ret-impl-trait-no-fg.rs:9:1
+ |
+LL | / async fn async_ret_impl_trait<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
+LL | |
+LL | |
+LL | |
+... |
+LL | | (a, b)
+LL | | }
+ | |_^
+ |
+ = note: hidden type `(&u8, &u8)` captures lifetime '_#5r
+
+error: aborting due to 5 previous errors
+For more information about this error, try `rustc --explain E0700`.
-error[E0658]: `Wrap<&Struct, Struct>` cannot be used as the type of `self` without the `arbitrary_self_types` feature
- --> $DIR/ref-self-async.rs:47:39
+error: lifetime may not live long enough
+ --> $DIR/ref-self-async.rs:23:9
|
-LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
- | ^^^^^^^^^^^^^^^^^
+LL | async fn ref_self(&self, f: &u32) -> &u32 {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | f
+ | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: lifetime may not live long enough
+ --> $DIR/ref-self-async.rs:29:9
+ |
+LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | f
+ | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: lifetime may not live long enough
+ --> $DIR/ref-self-async.rs:33:9
|
- = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information
- = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable
- = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
+LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | f
+ | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: lifetime may not live long enough
+ --> $DIR/ref-self-async.rs:37:9
+ |
+LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | f
+ | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: lifetime may not live long enough
+ --> $DIR/ref-self-async.rs:41:9
+ |
+LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | f
+ | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: lifetime may not live long enough
+ --> $DIR/ref-self-async.rs:45:9
+ |
+LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | f
+ | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: lifetime may not live long enough
+ --> $DIR/ref-self-async.rs:49:9
+ |
+LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | f
+ | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
-error: aborting due to previous error
+error: aborting due to 7 previous errors
-For more information about this error, try `rustc --explain E0658`.
// edition:2018
#![allow(non_snake_case)]
+#![feature(arbitrary_self_types)]
use std::marker::PhantomData;
use std::ops::Deref;
error[E0623]: lifetime mismatch
- --> $DIR/ref-self-async.rs:22:9
+ --> $DIR/ref-self-async.rs:23:9
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ----- ----
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
- --> $DIR/ref-self-async.rs:28:9
+ --> $DIR/ref-self-async.rs:29:9
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ----- ----
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
- --> $DIR/ref-self-async.rs:32:9
+ --> $DIR/ref-self-async.rs:33:9
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ----
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
- --> $DIR/ref-self-async.rs:36:9
+ --> $DIR/ref-self-async.rs:37:9
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ----- ----
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
- --> $DIR/ref-self-async.rs:40:9
+ --> $DIR/ref-self-async.rs:41:9
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ----- ----
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
- --> $DIR/ref-self-async.rs:44:9
+ --> $DIR/ref-self-async.rs:45:9
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ----- ----
| ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch
- --> $DIR/ref-self-async.rs:48:9
+ --> $DIR/ref-self-async.rs:49:9
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ----- ---