Bless tests, fix ICE with ImplTraitPlaceholder
This commit is contained in:
parent
70775304cd
commit
1f03edeabe
@ -1960,8 +1960,13 @@ fn lower_async_fn_ret_ty(
|
|||||||
//
|
//
|
||||||
// Then, we will create `fn foo(..) -> Foo<'_, '_>`, and
|
// Then, we will create `fn foo(..) -> Foo<'_, '_>`, and
|
||||||
// hence the elision takes place at the fn site.
|
// hence the elision takes place at the fn site.
|
||||||
let future_bound =
|
let future_bound = this.lower_async_fn_output_type_to_future_bound(
|
||||||
this.lower_async_fn_output_type_to_future_bound(output, fn_def_id, span);
|
output,
|
||||||
|
span,
|
||||||
|
ImplTraitContext::ReturnPositionOpaqueTy {
|
||||||
|
origin: hir::OpaqueTyOrigin::FnReturn(fn_def_id),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
let generic_params = this.arena.alloc_from_iter(collected_lifetimes.iter().map(
|
let generic_params = this.arena.alloc_from_iter(collected_lifetimes.iter().map(
|
||||||
|&(new_node_id, lifetime, _)| {
|
|&(new_node_id, lifetime, _)| {
|
||||||
@ -2064,17 +2069,16 @@ fn lower_async_fn_ret_ty_in_trait(
|
|||||||
fn_node_id: NodeId,
|
fn_node_id: NodeId,
|
||||||
opaque_ty_node_id: NodeId,
|
opaque_ty_node_id: NodeId,
|
||||||
) -> hir::FnRetTy<'hir> {
|
) -> hir::FnRetTy<'hir> {
|
||||||
let span = output.span();
|
|
||||||
|
|
||||||
let opaque_ty_span = self.mark_span_with_reason(DesugaringKind::Async, span, None);
|
|
||||||
|
|
||||||
let fn_def_id = self.local_def_id(fn_node_id);
|
|
||||||
|
|
||||||
let kind = self.lower_impl_trait_in_trait(output.span(), opaque_ty_node_id, |lctx| {
|
let kind = self.lower_impl_trait_in_trait(output.span(), opaque_ty_node_id, |lctx| {
|
||||||
let bound =
|
let bound = lctx.lower_async_fn_output_type_to_future_bound(
|
||||||
lctx.lower_async_fn_output_type_to_future_bound(output, fn_def_id, output.span());
|
output,
|
||||||
|
output.span(),
|
||||||
|
ImplTraitContext::Disallowed(ImplTraitPosition::TraitReturn),
|
||||||
|
);
|
||||||
arena_vec![lctx; bound]
|
arena_vec![lctx; bound]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let opaque_ty_span = self.mark_span_with_reason(DesugaringKind::Async, output.span(), None);
|
||||||
let opaque_ty = self.ty(opaque_ty_span, kind);
|
let opaque_ty = self.ty(opaque_ty_span, kind);
|
||||||
hir::FnRetTy::Return(self.arena.alloc(opaque_ty))
|
hir::FnRetTy::Return(self.arena.alloc(opaque_ty))
|
||||||
}
|
}
|
||||||
@ -2083,8 +2087,8 @@ fn lower_async_fn_ret_ty_in_trait(
|
|||||||
fn lower_async_fn_output_type_to_future_bound(
|
fn lower_async_fn_output_type_to_future_bound(
|
||||||
&mut self,
|
&mut self,
|
||||||
output: &FnRetTy,
|
output: &FnRetTy,
|
||||||
fn_def_id: LocalDefId,
|
|
||||||
span: Span,
|
span: Span,
|
||||||
|
mut nested_impl_trait_context: ImplTraitContext,
|
||||||
) -> hir::GenericBound<'hir> {
|
) -> hir::GenericBound<'hir> {
|
||||||
// Compute the `T` in `Future<Output = T>` from the return type.
|
// Compute the `T` in `Future<Output = T>` from the return type.
|
||||||
let output_ty = match output {
|
let output_ty = match output {
|
||||||
@ -2092,10 +2096,7 @@ fn lower_async_fn_output_type_to_future_bound(
|
|||||||
// Not `OpaqueTyOrigin::AsyncFn`: that's only used for the
|
// Not `OpaqueTyOrigin::AsyncFn`: that's only used for the
|
||||||
// `impl Future` opaque type that `async fn` implicitly
|
// `impl Future` opaque type that `async fn` implicitly
|
||||||
// generates.
|
// generates.
|
||||||
let mut context = ImplTraitContext::ReturnPositionOpaqueTy {
|
self.lower_ty(ty, &mut nested_impl_trait_context)
|
||||||
origin: hir::OpaqueTyOrigin::FnReturn(fn_def_id),
|
|
||||||
};
|
|
||||||
self.lower_ty(ty, &mut context)
|
|
||||||
}
|
}
|
||||||
FnRetTy::Default(ret_ty_span) => self.arena.alloc(self.ty_tup(*ret_ty_span, &[])),
|
FnRetTy::Default(ret_ty_span) => self.arena.alloc(self.ty_tup(*ret_ty_span, &[])),
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use crate::astconv::AstConv;
|
use crate::astconv::AstConv;
|
||||||
use crate::rustc_middle::ty::subst::Subst;
|
use crate::rustc_middle::ty::subst::Subst;
|
||||||
|
use hir::def::DefKind;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_hir::lang_items::LangItem;
|
use rustc_hir::lang_items::LangItem;
|
||||||
@ -680,9 +681,18 @@ fn deduce_future_output_from_obligations(
|
|||||||
.map(|e| e.map_bound(|e| *e).transpose_tuple2())
|
.map(|e| e.map_bound(|e| *e).transpose_tuple2())
|
||||||
.find_map(|(p, s)| get_future_output(p.subst(self.tcx, substs), s.0))?,
|
.find_map(|(p, s)| get_future_output(p.subst(self.tcx, substs), s.0))?,
|
||||||
ty::Error(_) => return None,
|
ty::Error(_) => return None,
|
||||||
|
ty::Projection(proj)
|
||||||
|
if self.tcx.def_kind(proj.item_def_id) == DefKind::ImplTraitPlaceholder =>
|
||||||
|
{
|
||||||
|
self.tcx
|
||||||
|
.bound_explicit_item_bounds(proj.item_def_id)
|
||||||
|
.transpose_iter()
|
||||||
|
.map(|e| e.map_bound(|e| *e).transpose_tuple2())
|
||||||
|
.find_map(|(p, s)| get_future_output(p.subst(self.tcx, proj.substs), s.0))?
|
||||||
|
}
|
||||||
_ => span_bug!(
|
_ => span_bug!(
|
||||||
self.tcx.def_span(expr_def_id),
|
self.tcx.def_span(expr_def_id),
|
||||||
"async fn generator return type not an inference variable"
|
"async fn generator return type not an inference variable: {ret_ty}"
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
// edition:2018
|
// edition:2018
|
||||||
trait T {
|
trait T {
|
||||||
async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
|
async fn foo() {} //~ ERROR functions in traits cannot be declared `async`
|
||||||
|
//~^ ERROR mismatched types
|
||||||
async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`
|
async fn bar(&self) {} //~ ERROR functions in traits cannot be declared `async`
|
||||||
|
//~^ ERROR mismatched types
|
||||||
async fn baz() { //~ ERROR functions in traits cannot be declared `async`
|
async fn baz() { //~ ERROR functions in traits cannot be declared `async`
|
||||||
|
//~^ ERROR mismatched types
|
||||||
// Nested item must not ICE.
|
// Nested item must not ICE.
|
||||||
fn a() {}
|
fn a() {}
|
||||||
}
|
}
|
||||||
|
@ -2,40 +2,89 @@ error[E0706]: functions in traits cannot be declared `async`
|
|||||||
--> $DIR/async-trait-fn.rs:3:5
|
--> $DIR/async-trait-fn.rs:3:5
|
||||||
|
|
|
|
||||||
LL | async fn foo() {}
|
LL | async fn foo() {}
|
||||||
| -----^^^^^^^^^^^^
|
| -----^^^^^^^^^
|
||||||
| |
|
|
||||||
| `async` because of this
|
|
||||||
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
|
||||||
--> $DIR/async-trait-fn.rs:4:5
|
|
||||||
|
|
|
||||||
LL | async fn bar(&self) {}
|
|
||||||
| -----^^^^^^^^^^^^^^^^^
|
|
||||||
| |
|
| |
|
||||||
| `async` because of this
|
| `async` because of this
|
||||||
|
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/async-trait-fn.rs:5:5
|
--> $DIR/async-trait-fn.rs:5:5
|
||||||
|
|
|
|
||||||
LL | async fn baz() {
|
LL | async fn bar(&self) {}
|
||||||
| ^----
|
| -----^^^^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| _____`async` because of this
|
| `async` because of this
|
||||||
| |
|
|
||||||
LL | | // Nested item must not ICE.
|
|
||||||
LL | | fn a() {}
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/async-trait-fn.rs:7:5
|
||||||
|
|
|
||||||
|
LL | async fn baz() {
|
||||||
|
| -----^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0706`.
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/async-trait-fn.rs:3:20
|
||||||
|
|
|
||||||
|
LL | async fn foo() {}
|
||||||
|
| ^^ expected associated type, found opaque type
|
||||||
|
|
|
||||||
|
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||||
|
|
|
||||||
|
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
|
||||||
|
| ------------------------------- the found opaque type
|
||||||
|
|
|
||||||
|
= note: expected associated type `<Self as T>::foo::{opaque#0}`
|
||||||
|
found opaque type `impl Future<Output = ()>`
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/async-trait-fn.rs:5:25
|
||||||
|
|
|
||||||
|
LL | async fn bar(&self) {}
|
||||||
|
| ^^ expected associated type, found opaque type
|
||||||
|
|
|
||||||
|
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||||
|
|
|
||||||
|
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
|
||||||
|
| ------------------------------- the found opaque type
|
||||||
|
|
|
||||||
|
= note: expected associated type `<Self as T>::bar::{opaque#0}`
|
||||||
|
found opaque type `impl Future<Output = ()>`
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/async-trait-fn.rs:7:20
|
||||||
|
|
|
||||||
|
LL | async fn baz() {
|
||||||
|
| ____________________^
|
||||||
|
LL | |
|
||||||
|
LL | | // Nested item must not ICE.
|
||||||
|
LL | | fn a() {}
|
||||||
|
LL | | }
|
||||||
|
| |_____^ expected associated type, found opaque type
|
||||||
|
|
|
||||||
|
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||||
|
|
|
||||||
|
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
|
||||||
|
| ------------------------------- the found opaque type
|
||||||
|
|
|
||||||
|
= note: expected associated type `<Self as T>::baz::{opaque#0}`
|
||||||
|
found opaque type `impl Future<Output = ()>`
|
||||||
|
|
||||||
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0308, E0706.
|
||||||
|
For more information about an error, try `rustc --explain E0308`.
|
||||||
|
@ -16,7 +16,8 @@ async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
|||||||
|
|
||||||
trait Bar {
|
trait Bar {
|
||||||
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015
|
||||||
//~^ ERROR functions in traits cannot be declared `async`
|
//~^ ERROR functions in traits cannot be declared `async`
|
||||||
|
//~| ERROR mismatched types
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -53,7 +53,7 @@ LL | async fn foo() {}
|
|||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
--> $DIR/edition-deny-async-fns-2015.rs:36:9
|
--> $DIR/edition-deny-async-fns-2015.rs:37:9
|
||||||
|
|
|
|
||||||
LL | async fn bar() {}
|
LL | async fn bar() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
@ -62,7 +62,7 @@ LL | async fn bar() {}
|
|||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
--> $DIR/edition-deny-async-fns-2015.rs:26:9
|
--> $DIR/edition-deny-async-fns-2015.rs:27:9
|
||||||
|
|
|
|
||||||
LL | async fn foo() {}
|
LL | async fn foo() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
@ -71,7 +71,7 @@ LL | async fn foo() {}
|
|||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
--> $DIR/edition-deny-async-fns-2015.rs:31:13
|
--> $DIR/edition-deny-async-fns-2015.rs:32:13
|
||||||
|
|
|
|
||||||
LL | async fn bar() {}
|
LL | async fn bar() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
@ -83,14 +83,30 @@ error[E0706]: functions in traits cannot be declared `async`
|
|||||||
--> $DIR/edition-deny-async-fns-2015.rs:18:5
|
--> $DIR/edition-deny-async-fns-2015.rs:18:5
|
||||||
|
|
|
|
||||||
LL | async fn foo() {}
|
LL | async fn foo() {}
|
||||||
| -----^^^^^^^^^^^^
|
| -----^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| `async` because of this
|
| `async` because of this
|
||||||
|
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to 10 previous errors
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/edition-deny-async-fns-2015.rs:18:20
|
||||||
|
|
|
||||||
|
LL | async fn foo() {}
|
||||||
|
| ^^ expected associated type, found opaque type
|
||||||
|
|
|
||||||
|
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||||
|
|
|
||||||
|
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
|
||||||
|
| ------------------------------- the found opaque type
|
||||||
|
|
|
||||||
|
= note: expected associated type `<Self as Bar>::foo::{opaque#0}`
|
||||||
|
found opaque type `impl Future<Output = ()>`
|
||||||
|
|
||||||
Some errors have detailed explanations: E0670, E0706.
|
error: aborting due to 11 previous errors
|
||||||
For more information about an error, try `rustc --explain E0670`.
|
|
||||||
|
Some errors have detailed explanations: E0308, E0670, E0706.
|
||||||
|
For more information about an error, try `rustc --explain E0308`.
|
||||||
|
@ -8,6 +8,8 @@ LL | async fn new() -> [u8; _];
|
|||||||
|
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: in expressions, `_` can only be used on the left-hand side of an assignment
|
error: in expressions, `_` can only be used on the left-hand side of an assignment
|
||||||
--> $DIR/issue-95307.rs:7:28
|
--> $DIR/issue-95307.rs:7:28
|
||||||
|
@ -27,7 +27,6 @@ trait X {
|
|||||||
struct Y;
|
struct Y;
|
||||||
impl X for Y {
|
impl X for Y {
|
||||||
async fn ft1() {} //~ ERROR functions in traits cannot be declared `async`
|
async fn ft1() {} //~ ERROR functions in traits cannot be declared `async`
|
||||||
//~^ ERROR has an incompatible type for trait
|
|
||||||
unsafe fn ft2() {} // OK.
|
unsafe fn ft2() {} // OK.
|
||||||
const fn ft3() {} //~ ERROR functions in traits cannot be declared const
|
const fn ft3() {} //~ ERROR functions in traits cannot be declared const
|
||||||
extern "C" fn ft4() {}
|
extern "C" fn ft4() {}
|
||||||
@ -36,7 +35,6 @@ extern "C" fn ft4() {}
|
|||||||
//~| ERROR functions in traits cannot be declared const
|
//~| ERROR functions in traits cannot be declared const
|
||||||
//~| ERROR functions cannot be both `const` and `async`
|
//~| ERROR functions cannot be both `const` and `async`
|
||||||
//~| ERROR cycle detected
|
//~| ERROR cycle detected
|
||||||
//~| ERROR has an incompatible type for trait
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Y {
|
impl Y {
|
||||||
|
@ -7,17 +7,6 @@ LL | const async unsafe extern "C" fn ff5() {}
|
|||||||
| | `async` because of this
|
| | `async` because of this
|
||||||
| `const` because of this
|
| `const` because of this
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
|
||||||
--> $DIR/fn-header-semantic-fail.rs:17:9
|
|
||||||
|
|
|
||||||
LL | async fn ft1();
|
|
||||||
| -----^^^^^^^^^^
|
|
||||||
| |
|
|
||||||
| `async` because of this
|
|
||||||
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
|
||||||
|
|
||||||
error[E0379]: functions in traits cannot be declared const
|
error[E0379]: functions in traits cannot be declared const
|
||||||
--> $DIR/fn-header-semantic-fail.rs:19:9
|
--> $DIR/fn-header-semantic-fail.rs:19:9
|
||||||
|
|
|
|
||||||
@ -30,17 +19,6 @@ error[E0379]: functions in traits cannot be declared const
|
|||||||
LL | const async unsafe extern "C" fn ft5();
|
LL | const async unsafe extern "C" fn ft5();
|
||||||
| ^^^^^ functions in traits cannot be const
|
| ^^^^^ functions in traits cannot be const
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
|
||||||
--> $DIR/fn-header-semantic-fail.rs:21:9
|
|
||||||
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5();
|
|
||||||
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
| |
|
|
||||||
| `async` because of this
|
|
||||||
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
|
||||||
|
|
||||||
error: functions cannot be both `const` and `async`
|
error: functions cannot be both `const` and `async`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:21:9
|
--> $DIR/fn-header-semantic-fail.rs:21:9
|
||||||
|
|
|
|
||||||
@ -50,42 +28,20 @@ LL | const async unsafe extern "C" fn ft5();
|
|||||||
| | `async` because of this
|
| | `async` because of this
|
||||||
| `const` because of this
|
| `const` because of this
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
|
||||||
--> $DIR/fn-header-semantic-fail.rs:29:9
|
|
||||||
|
|
|
||||||
LL | async fn ft1() {}
|
|
||||||
| -----^^^^^^^^^^^^
|
|
||||||
| |
|
|
||||||
| `async` because of this
|
|
||||||
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
|
||||||
|
|
||||||
error[E0379]: functions in traits cannot be declared const
|
error[E0379]: functions in traits cannot be declared const
|
||||||
--> $DIR/fn-header-semantic-fail.rs:32:9
|
--> $DIR/fn-header-semantic-fail.rs:31:9
|
||||||
|
|
|
|
||||||
LL | const fn ft3() {}
|
LL | const fn ft3() {}
|
||||||
| ^^^^^ functions in traits cannot be const
|
| ^^^^^ functions in traits cannot be const
|
||||||
|
|
||||||
error[E0379]: functions in traits cannot be declared const
|
error[E0379]: functions in traits cannot be declared const
|
||||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5() {}
|
LL | const async unsafe extern "C" fn ft5() {}
|
||||||
| ^^^^^ functions in traits cannot be const
|
| ^^^^^ functions in traits cannot be const
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
|
||||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
|
||||||
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5() {}
|
|
||||||
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
| |
|
|
||||||
| `async` because of this
|
|
||||||
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
|
||||||
|
|
||||||
error: functions cannot be both `const` and `async`
|
error: functions cannot be both `const` and `async`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5() {}
|
LL | const async unsafe extern "C" fn ft5() {}
|
||||||
| ^^^^^-^^^^^------------------------------
|
| ^^^^^-^^^^^------------------------------
|
||||||
@ -94,7 +50,7 @@ LL | const async unsafe extern "C" fn ft5() {}
|
|||||||
| `const` because of this
|
| `const` because of this
|
||||||
|
|
||||||
error: functions cannot be both `const` and `async`
|
error: functions cannot be both `const` and `async`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:47:9
|
--> $DIR/fn-header-semantic-fail.rs:45:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn fi5() {}
|
LL | const async unsafe extern "C" fn fi5() {}
|
||||||
| ^^^^^-^^^^^------------------------------
|
| ^^^^^-^^^^^------------------------------
|
||||||
@ -103,7 +59,7 @@ LL | const async unsafe extern "C" fn fi5() {}
|
|||||||
| `const` because of this
|
| `const` because of this
|
||||||
|
|
||||||
error: functions in `extern` blocks cannot have qualifiers
|
error: functions in `extern` blocks cannot have qualifiers
|
||||||
--> $DIR/fn-header-semantic-fail.rs:53:18
|
--> $DIR/fn-header-semantic-fail.rs:51:18
|
||||||
|
|
|
|
||||||
LL | extern "C" {
|
LL | extern "C" {
|
||||||
| ---------- in this `extern` block
|
| ---------- in this `extern` block
|
||||||
@ -116,7 +72,7 @@ LL | fn fe1();
|
|||||||
| ~~
|
| ~~
|
||||||
|
|
||||||
error: functions in `extern` blocks cannot have qualifiers
|
error: functions in `extern` blocks cannot have qualifiers
|
||||||
--> $DIR/fn-header-semantic-fail.rs:54:19
|
--> $DIR/fn-header-semantic-fail.rs:52:19
|
||||||
|
|
|
|
||||||
LL | extern "C" {
|
LL | extern "C" {
|
||||||
| ---------- in this `extern` block
|
| ---------- in this `extern` block
|
||||||
@ -130,7 +86,7 @@ LL | fn fe2();
|
|||||||
| ~~
|
| ~~
|
||||||
|
|
||||||
error: functions in `extern` blocks cannot have qualifiers
|
error: functions in `extern` blocks cannot have qualifiers
|
||||||
--> $DIR/fn-header-semantic-fail.rs:55:18
|
--> $DIR/fn-header-semantic-fail.rs:53:18
|
||||||
|
|
|
|
||||||
LL | extern "C" {
|
LL | extern "C" {
|
||||||
| ---------- in this `extern` block
|
| ---------- in this `extern` block
|
||||||
@ -144,7 +100,7 @@ LL | fn fe3();
|
|||||||
| ~~
|
| ~~
|
||||||
|
|
||||||
error: functions in `extern` blocks cannot have qualifiers
|
error: functions in `extern` blocks cannot have qualifiers
|
||||||
--> $DIR/fn-header-semantic-fail.rs:56:23
|
--> $DIR/fn-header-semantic-fail.rs:54:23
|
||||||
|
|
|
|
||||||
LL | extern "C" {
|
LL | extern "C" {
|
||||||
| ---------- in this `extern` block
|
| ---------- in this `extern` block
|
||||||
@ -158,7 +114,7 @@ LL | fn fe4();
|
|||||||
| ~~
|
| ~~
|
||||||
|
|
||||||
error: functions in `extern` blocks cannot have qualifiers
|
error: functions in `extern` blocks cannot have qualifiers
|
||||||
--> $DIR/fn-header-semantic-fail.rs:57:42
|
--> $DIR/fn-header-semantic-fail.rs:55:42
|
||||||
|
|
|
|
||||||
LL | extern "C" {
|
LL | extern "C" {
|
||||||
| ---------- in this `extern` block
|
| ---------- in this `extern` block
|
||||||
@ -172,7 +128,7 @@ LL | fn fe5();
|
|||||||
| ~~
|
| ~~
|
||||||
|
|
||||||
error: functions cannot be both `const` and `async`
|
error: functions cannot be both `const` and `async`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:57:9
|
--> $DIR/fn-header-semantic-fail.rs:55:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn fe5();
|
LL | const async unsafe extern "C" fn fe5();
|
||||||
| ^^^^^-^^^^^----------------------------
|
| ^^^^^-^^^^^----------------------------
|
||||||
@ -180,6 +136,58 @@ LL | const async unsafe extern "C" fn fe5();
|
|||||||
| | `async` because of this
|
| | `async` because of this
|
||||||
| `const` because of this
|
| `const` because of this
|
||||||
|
|
||||||
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/fn-header-semantic-fail.rs:17:9
|
||||||
|
|
|
||||||
|
LL | async fn ft1();
|
||||||
|
| -----^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/fn-header-semantic-fail.rs:21:9
|
||||||
|
|
|
||||||
|
LL | const async unsafe extern "C" fn ft5();
|
||||||
|
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/fn-header-semantic-fail.rs:29:9
|
||||||
|
|
|
||||||
|
LL | async fn ft1() {}
|
||||||
|
| -----^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||||
|
|
|
||||||
|
LL | const async unsafe extern "C" fn ft5() {}
|
||||||
|
| ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0391]: cycle detected when computing type of `main::ff5::{opaque#0}`
|
error[E0391]: cycle detected when computing type of `main::ff5::{opaque#0}`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:12:44
|
--> $DIR/fn-header-semantic-fail.rs:12:44
|
||||||
|
|
|
|
||||||
@ -216,60 +224,24 @@ LL | | }
|
|||||||
LL | | }
|
LL | | }
|
||||||
| |_^
|
| |_^
|
||||||
|
|
||||||
error[E0053]: method `ft1` has an incompatible type for trait
|
|
||||||
--> $DIR/fn-header-semantic-fail.rs:29:24
|
|
||||||
|
|
|
||||||
LL | async fn ft1() {}
|
|
||||||
| ^
|
|
||||||
| |
|
|
||||||
| checked the `Output` of this `async fn`, found opaque type
|
|
||||||
| expected `()`, found opaque type
|
|
||||||
|
|
|
||||||
= note: while checking the return type of the `async fn`
|
|
||||||
note: type in trait
|
|
||||||
--> $DIR/fn-header-semantic-fail.rs:17:23
|
|
||||||
|
|
|
||||||
LL | async fn ft1();
|
|
||||||
| ^
|
|
||||||
= note: expected fn pointer `fn()`
|
|
||||||
found fn pointer `fn() -> impl Future<Output = ()>`
|
|
||||||
|
|
||||||
error[E0053]: method `ft5` has an incompatible type for trait
|
|
||||||
--> $DIR/fn-header-semantic-fail.rs:34:48
|
|
||||||
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5() {}
|
|
||||||
| ^
|
|
||||||
| |
|
|
||||||
| checked the `Output` of this `async fn`, found opaque type
|
|
||||||
| expected `()`, found opaque type
|
|
||||||
|
|
|
||||||
= note: while checking the return type of the `async fn`
|
|
||||||
note: type in trait
|
|
||||||
--> $DIR/fn-header-semantic-fail.rs:21:47
|
|
||||||
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5();
|
|
||||||
| ^
|
|
||||||
= note: expected fn pointer `unsafe extern "C" fn()`
|
|
||||||
found fn pointer `unsafe extern "C" fn() -> impl Future<Output = ()>`
|
|
||||||
|
|
||||||
error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5::{opaque#0}`
|
error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5::{opaque#0}`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:34:48
|
--> $DIR/fn-header-semantic-fail.rs:33:48
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5() {}
|
LL | const async unsafe extern "C" fn ft5() {}
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
|
note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
|
||||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5() {}
|
LL | const async unsafe extern "C" fn ft5() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
|
note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
|
||||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5() {}
|
LL | const async unsafe extern "C" fn ft5() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
|
note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`...
|
||||||
--> $DIR/fn-header-semantic-fail.rs:34:9
|
--> $DIR/fn-header-semantic-fail.rs:33:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn ft5() {}
|
LL | const async unsafe extern "C" fn ft5() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -288,30 +260,30 @@ LL | | }
|
|||||||
LL | | }
|
LL | | }
|
||||||
| |_^
|
| |_^
|
||||||
|
|
||||||
error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5::{opaque#0}`
|
error[E0391]: cycle detected when computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5::{opaque#0}`
|
||||||
--> $DIR/fn-header-semantic-fail.rs:47:48
|
--> $DIR/fn-header-semantic-fail.rs:45:48
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn fi5() {}
|
LL | const async unsafe extern "C" fn fi5() {}
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`...
|
note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5`...
|
||||||
--> $DIR/fn-header-semantic-fail.rs:47:9
|
--> $DIR/fn-header-semantic-fail.rs:45:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn fi5() {}
|
LL | const async unsafe extern "C" fn fi5() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`...
|
note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5`...
|
||||||
--> $DIR/fn-header-semantic-fail.rs:47:9
|
--> $DIR/fn-header-semantic-fail.rs:45:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn fi5() {}
|
LL | const async unsafe extern "C" fn fi5() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5`...
|
note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5`...
|
||||||
--> $DIR/fn-header-semantic-fail.rs:47:9
|
--> $DIR/fn-header-semantic-fail.rs:45:9
|
||||||
|
|
|
|
||||||
LL | const async unsafe extern "C" fn fi5() {}
|
LL | const async unsafe extern "C" fn fi5() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze...
|
= note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze...
|
||||||
= note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`...
|
= note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`...
|
||||||
= note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:42:5: 42:11>::fi5::{opaque#0}`, completing the cycle
|
= note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5::{opaque#0}`, completing the cycle
|
||||||
note: cycle used when checking item types in top-level module
|
note: cycle used when checking item types in top-level module
|
||||||
--> $DIR/fn-header-semantic-fail.rs:5:1
|
--> $DIR/fn-header-semantic-fail.rs:5:1
|
||||||
|
|
|
|
||||||
@ -324,7 +296,7 @@ LL | | }
|
|||||||
LL | | }
|
LL | | }
|
||||||
| |_^
|
| |_^
|
||||||
|
|
||||||
error: aborting due to 23 previous errors
|
error: aborting due to 21 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0053, E0379, E0391, E0706.
|
Some errors have detailed explanations: E0379, E0391, E0706.
|
||||||
For more information about an error, try `rustc --explain E0053`.
|
For more information about an error, try `rustc --explain E0379`.
|
||||||
|
@ -14,7 +14,6 @@ trait B {
|
|||||||
impl B for A {
|
impl B for A {
|
||||||
async fn associated(); //~ ERROR without body
|
async fn associated(); //~ ERROR without body
|
||||||
//~^ ERROR cannot be declared `async`
|
//~^ ERROR cannot be declared `async`
|
||||||
//~| ERROR has an incompatible type for trait
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -14,6 +14,14 @@ LL | async fn inherent();
|
|||||||
| |
|
| |
|
||||||
| help: provide a definition for the function: `{ <body> }`
|
| help: provide a definition for the function: `{ <body> }`
|
||||||
|
|
||||||
|
error: associated function in `impl` without body
|
||||||
|
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
|
||||||
|
|
|
||||||
|
LL | async fn associated();
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^-
|
||||||
|
| |
|
||||||
|
| help: provide a definition for the function: `{ <body> }`
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5
|
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:5
|
||||||
|
|
|
|
||||||
@ -24,14 +32,8 @@ LL | async fn associated();
|
|||||||
|
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
error: associated function in `impl` without body
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
|
|
||||||
|
|
|
||||||
LL | async fn associated();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^-
|
|
||||||
| |
|
|
||||||
| help: provide a definition for the function: `{ <body> }`
|
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
|
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:5
|
||||||
@ -43,26 +45,9 @@ LL | async fn associated();
|
|||||||
|
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
= note: `async` trait functions are not currently supported
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0053]: method `associated` has an incompatible type for trait
|
error: aborting due to 5 previous errors
|
||||||
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:15:26
|
|
||||||
|
|
|
||||||
LL | async fn associated();
|
|
||||||
| ^
|
|
||||||
| |
|
|
||||||
| checked the `Output` of this `async fn`, found opaque type
|
|
||||||
| expected `()`, found opaque type
|
|
||||||
|
|
|
||||||
= note: while checking the return type of the `async fn`
|
|
||||||
note: type in trait
|
|
||||||
--> $DIR/issue-70736-async-fn-no-body-def-collector.rs:11:26
|
|
||||||
|
|
|
||||||
LL | async fn associated();
|
|
||||||
| ^
|
|
||||||
= note: expected fn pointer `fn()`
|
|
||||||
found fn pointer `fn() -> impl Future<Output = ()>`
|
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
For more information about this error, try `rustc --explain E0706`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0053, E0706.
|
|
||||||
For more information about an error, try `rustc --explain E0053`.
|
|
||||||
|
@ -12,7 +12,8 @@ async fn create(path: impl AsRef<std::path::Path>) { //~ ERROR `async fn` is n
|
|||||||
|
|
||||||
trait C{async fn new(val: T) {} //~ ERROR `async fn` is not permitted in Rust 2015
|
trait C{async fn new(val: T) {} //~ ERROR `async fn` is not permitted in Rust 2015
|
||||||
//~^ ERROR functions in traits cannot be declared `async`
|
//~^ ERROR functions in traits cannot be declared `async`
|
||||||
//~^^ ERROR cannot find type `T` in this scope
|
//~| ERROR mismatched types
|
||||||
//~^^^ WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures]
|
//~| ERROR cannot find type `T` in this scope
|
||||||
|
//~| WARN changes to closure capture in Rust 2021 will affect drop order [rust_2021_incompatible_closure_captures]
|
||||||
|
|
||||||
//~ ERROR this file contains an unclosed delimiter
|
//~ ERROR this file contains an unclosed delimiter
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: this file contains an unclosed delimiter
|
error: this file contains an unclosed delimiter
|
||||||
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:18:53
|
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:19:53
|
||||||
|
|
|
|
||||||
LL | trait C{async fn new(val: T) {}
|
LL | trait C{async fn new(val: T) {}
|
||||||
| - unclosed delimiter
|
| - unclosed delimiter
|
||||||
@ -25,17 +25,6 @@ LL | trait C{async fn new(val: T) {}
|
|||||||
= help: pass `--edition 2021` to `rustc`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
|
||||||
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9
|
|
||||||
|
|
|
||||||
LL | trait C{async fn new(val: T) {}
|
|
||||||
| -----^^^^^^^^^^^^^^^^^^
|
|
||||||
| |
|
|
||||||
| `async` because of this
|
|
||||||
|
|
|
||||||
= note: `async` trait functions are not currently supported
|
|
||||||
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
|
||||||
|
|
||||||
error[E0423]: expected function, found module `crate`
|
error[E0423]: expected function, found module `crate`
|
||||||
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:9:5
|
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:9:5
|
||||||
|
|
|
|
||||||
@ -51,6 +40,19 @@ LL | pub struct A {}
|
|||||||
LL | trait C{async fn new(val: T) {}
|
LL | trait C{async fn new(val: T) {}
|
||||||
| ^ help: a struct with a similar name exists: `A`
|
| ^ help: a struct with a similar name exists: `A`
|
||||||
|
|
||||||
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:9
|
||||||
|
|
|
||||||
|
LL | trait C{async fn new(val: T) {}
|
||||||
|
| -----^^^^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| `async` because of this
|
||||||
|
|
|
||||||
|
= note: `async` trait functions are not currently supported
|
||||||
|
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
|
||||||
|
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
|
||||||
|
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
|
||||||
|
|
||||||
warning: changes to closure capture in Rust 2021 will affect drop order
|
warning: changes to closure capture in Rust 2021 will affect drop order
|
||||||
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57
|
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:6:57
|
||||||
|
|
|
|
||||||
@ -72,6 +74,20 @@ help: add a dummy let to cause `path` to be fully captured
|
|||||||
LL | async fn create(path: impl AsRef<std::path::Path>) { let _ = &path;
|
LL | async fn create(path: impl AsRef<std::path::Path>) { let _ = &path;
|
||||||
| ++++++++++++++
|
| ++++++++++++++
|
||||||
|
|
||||||
|
error[E0308]: mismatched types
|
||||||
|
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30
|
||||||
|
|
|
||||||
|
LL | trait C{async fn new(val: T) {}
|
||||||
|
| ^^ expected associated type, found opaque type
|
||||||
|
|
|
||||||
|
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
|
||||||
|
|
|
||||||
|
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
|
||||||
|
| ------------------------------- the found opaque type
|
||||||
|
|
|
||||||
|
= note: expected associated type `<Self as C>::new::{opaque#0}`
|
||||||
|
found opaque type `impl Future<Output = ()>`
|
||||||
|
|
||||||
warning: changes to closure capture in Rust 2021 will affect drop order
|
warning: changes to closure capture in Rust 2021 will affect drop order
|
||||||
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30
|
--> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:13:30
|
||||||
|
|
|
|
||||||
@ -87,7 +103,7 @@ help: add a dummy let to cause `val` to be fully captured
|
|||||||
LL | trait C{async fn new(val: T) { let _ = &val;}
|
LL | trait C{async fn new(val: T) { let _ = &val;}
|
||||||
| +++++++++++++
|
| +++++++++++++
|
||||||
|
|
||||||
error: aborting due to 6 previous errors; 2 warnings emitted
|
error: aborting due to 7 previous errors; 2 warnings emitted
|
||||||
|
|
||||||
Some errors have detailed explanations: E0412, E0423, E0670, E0706.
|
Some errors have detailed explanations: E0308, E0412, E0423, E0670, E0706.
|
||||||
For more information about an error, try `rustc --explain E0412`.
|
For more information about an error, try `rustc --explain E0308`.
|
||||||
|
Loading…
Reference in New Issue
Block a user