From c96d888bdfb23122c7823445f471b3d284dd07e6 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Fri, 25 Nov 2022 09:53:58 +0100 Subject: [PATCH] Pretty-print generators with their `generator_kind` After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future` mainly to avoid too much diagnostics changes originally. This now reverses that change so that async fn/blocks are pretty-printed as `[$movability `async` $something@$source-position]` in various diagnostics, and updates the tests that this touches. --- .../src/transform/check_consts/ops.rs | 2 +- compiler/rustc_hir/src/hir.rs | 6 +-- .../src/generator_interior/mod.rs | 3 +- compiler/rustc_middle/src/ty/print/pretty.rs | 25 ++++------ .../src/traits/error_reporting/suggestions.rs | 2 +- ...ync-block-control-flow-static-semantics.rs | 4 +- ...block-control-flow-static-semantics.stderr | 8 ++-- src/test/ui/async-await/generator-desc.stderr | 8 ++-- .../issue-67252-unnamed-future.stderr | 2 +- src/test/ui/async-await/issue-86507.stderr | 2 +- ...6-raw-ptr-not-send.no_drop_tracking.stderr | 2 +- src/test/ui/chalkify/bugs/async.stderr | 22 ++++----- src/test/ui/generator/clone-impl-async.rs | 27 +++++------ src/test/ui/generator/clone-impl-async.stderr | 48 +++++++++---------- src/test/ui/impl-trait/issue-55872-3.rs | 2 +- src/test/ui/impl-trait/issue-55872-3.stderr | 4 +- src/test/ui/impl-trait/issues/issue-78722.rs | 2 +- .../ui/impl-trait/issues/issue-78722.stderr | 2 +- .../pattern/non-structural-match-types.stderr | 2 +- .../expected-boxed-future-isnt-pinned.stderr | 2 +- 20 files changed, 85 insertions(+), 90 deletions(-) diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs index c62c6651587..3d74d689db2 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -381,7 +381,7 @@ impl<'tcx> NonConstOp<'tcx> for Generator { ccx: &ConstCx<'_, 'tcx>, span: Span, ) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> { - let msg = format!("{}s are not allowed in {}s", self.0, ccx.const_kind()); + let msg = format!("{}s are not allowed in {}s", self.0.descr(), ccx.const_kind()); if let hir::GeneratorKind::Async(hir::AsyncGeneratorKind::Block) = self.0 { ccx.tcx.sess.create_feature_err( UnallowedOpInConstContext { span, msg }, diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 473a04f33a9..3ed599fd2cc 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1514,9 +1514,9 @@ pub enum AsyncGeneratorKind { impl fmt::Display for AsyncGeneratorKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(match self { - AsyncGeneratorKind::Block => "`async` block", - AsyncGeneratorKind::Closure => "`async` closure body", - AsyncGeneratorKind::Fn => "`async fn` body", + AsyncGeneratorKind::Block => "async block", + AsyncGeneratorKind::Closure => "async closure body", + AsyncGeneratorKind::Fn => "async fn body", }) } } diff --git a/compiler/rustc_hir_typeck/src/generator_interior/mod.rs b/compiler/rustc_hir_typeck/src/generator_interior/mod.rs index bd3589c6c43..1e6056101f1 100644 --- a/compiler/rustc_hir_typeck/src/generator_interior/mod.rs +++ b/compiler/rustc_hir_typeck/src/generator_interior/mod.rs @@ -118,7 +118,8 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> { } else { let note = format!( "the type is part of the {} because of this {}", - self.kind, yield_data.source + self.kind.descr(), + yield_data.source ); self.fcx diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index c54edf10c2d..77f9cec5118 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -681,25 +681,20 @@ pub trait PrettyPrinter<'tcx>: } ty::Str => p!("str"), ty::Generator(did, substs, movability) => { - // FIXME(swatinem): async constructs used to be pretty printed - // as `impl Future` previously due to the `from_generator` wrapping. - // lets special case this here for now to avoid churn in diagnostics. - let generator_kind = self.tcx().generator_kind(did); - if matches!(generator_kind, Some(hir::GeneratorKind::Async(..))) { - let return_ty = substs.as_generator().return_ty(); - p!(write("impl Future", return_ty)); - - return Ok(self); - } - p!(write("[")); - match movability { - hir::Movability::Movable => {} - hir::Movability::Static => p!("static "), + let generator_kind = self.tcx().generator_kind(did).unwrap(); + let should_print_movability = + self.should_print_verbose() || generator_kind == hir::GeneratorKind::Gen; + + if should_print_movability { + match movability { + hir::Movability::Movable => {} + hir::Movability::Static => p!("static "), + } } if !self.should_print_verbose() { - p!("generator"); + p!(write("{}", generator_kind)); // FIXME(eddyb) should use `def_span`. if let Some(did) = did.as_local() { let span = self.tcx().def_span(did); diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 30207033236..482c6f06cd3 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2677,7 +2677,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let sp = self.tcx.def_span(def_id); // Special-case this to say "async block" instead of `[static generator]`. - let kind = tcx.generator_kind(def_id).unwrap(); + let kind = tcx.generator_kind(def_id).unwrap().descr(); err.span_note( sp, &format!("required because it's used within this {}", kind), diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs index 446212ca767..bc9d127931d 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.rs +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.rs @@ -15,7 +15,7 @@ fn return_targets_async_block_not_fn() -> u8 { return 0u8; }; let _: &dyn Future = █ - //~^ ERROR expected `impl Future` to be a future that resolves to `()`, but it resolves to `u8` + //~^ ERROR to be a future that resolves to `()`, but it resolves to `u8` } async fn return_targets_async_block_not_async_fn() -> u8 { @@ -24,7 +24,7 @@ async fn return_targets_async_block_not_async_fn() -> u8 { return 0u8; }; let _: &dyn Future = █ - //~^ ERROR expected `impl Future` to be a future that resolves to `()`, but it resolves to `u8` + //~^ ERROR to be a future that resolves to `()`, but it resolves to `u8` } fn no_break_in_async_block() { diff --git a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr index b8ca64fae83..c4487eb840a 100644 --- a/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr +++ b/src/test/ui/async-await/async-block-control-flow-static-semantics.stderr @@ -29,13 +29,13 @@ LL | | LL | | } | |_^ expected `u8`, found `()` -error[E0271]: expected `impl Future` to be a future that resolves to `()`, but it resolves to `u8` +error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to be a future that resolves to `()`, but it resolves to `u8` --> $DIR/async-block-control-flow-static-semantics.rs:26:39 | LL | let _: &dyn Future = █ | ^^^^^^ expected `()`, found `u8` | - = note: required for the cast from `impl Future` to the object type `dyn Future` + = note: required for the cast from `[async block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to the object type `dyn Future` error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:12:43 @@ -45,13 +45,13 @@ LL | fn return_targets_async_block_not_fn() -> u8 { | | | implicitly returns `()` as its body has no tail or `return` expression -error[E0271]: expected `impl Future` to be a future that resolves to `()`, but it resolves to `u8` +error[E0271]: expected `[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to be a future that resolves to `()`, but it resolves to `u8` --> $DIR/async-block-control-flow-static-semantics.rs:17:39 | LL | let _: &dyn Future = █ | ^^^^^^ expected `()`, found `u8` | - = note: required for the cast from `impl Future` to the object type `dyn Future` + = note: required for the cast from `[async block@$DIR/async-block-control-flow-static-semantics.rs:14:17: 16:6]` to the object type `dyn Future` error[E0308]: mismatched types --> $DIR/async-block-control-flow-static-semantics.rs:49:44 diff --git a/src/test/ui/async-await/generator-desc.stderr b/src/test/ui/async-await/generator-desc.stderr index 774c97966b1..1686153acf9 100644 --- a/src/test/ui/async-await/generator-desc.stderr +++ b/src/test/ui/async-await/generator-desc.stderr @@ -8,8 +8,8 @@ LL | fun(async {}, async {}); | | arguments to this function are incorrect | the expected `async` block | - = note: expected `async` block `impl Future` (`async` block) - found `async` block `impl Future` (`async` block) + = note: expected `async` block `[async block@$DIR/generator-desc.rs:10:9: 10:17]` + found `async` block `[async block@$DIR/generator-desc.rs:10:19: 10:27]` note: function defined here --> $SRC_DIR/core/src/future/mod.rs:LL:COL | @@ -53,8 +53,8 @@ LL | fun((async || {})(), (async || {})()); | | the expected `async` closure body | arguments to this function are incorrect | - = note: expected `async` closure body `impl Future` (`async` closure body) - found `async` closure body `impl Future` (`async` closure body) + = note: expected `async` closure body `[async closure body@$DIR/generator-desc.rs:14:19: 14:21]` + found `async` closure body `[async closure body@$DIR/generator-desc.rs:14:36: 14:38]` note: function defined here --> $DIR/generator-desc.rs:8:4 | diff --git a/src/test/ui/async-await/issue-67252-unnamed-future.stderr b/src/test/ui/async-await/issue-67252-unnamed-future.stderr index af99b608ca1..fcba4410ba9 100644 --- a/src/test/ui/async-await/issue-67252-unnamed-future.stderr +++ b/src/test/ui/async-await/issue-67252-unnamed-future.stderr @@ -8,7 +8,7 @@ LL | | AFuture.await; LL | | }); | |_____^ future created by async block is not `Send` | - = help: within `impl Future`, the trait `Send` is not implemented for `*mut ()` + = help: within `[async block@$DIR/issue-67252-unnamed-future.rs:18:11: 21:6]`, the trait `Send` is not implemented for `*mut ()` note: future is not `Send` as this value is used across an await --> $DIR/issue-67252-unnamed-future.rs:20:16 | diff --git a/src/test/ui/async-await/issue-86507.stderr b/src/test/ui/async-await/issue-86507.stderr index 0e21dba980d..8c2c06da25c 100644 --- a/src/test/ui/async-await/issue-86507.stderr +++ b/src/test/ui/async-await/issue-86507.stderr @@ -13,7 +13,7 @@ note: captured value is not `Send` because `&` references cannot be sent unless | LL | let x = x; | ^ has type `&T` which is not `Send`, because `T` is not `Sync` - = note: required for the cast from `impl Future` to the object type `dyn Future + Send` + = note: required for the cast from `[async block@$DIR/issue-86507.rs:18:17: 20:18]` to the object type `dyn Future + Send` help: consider further restricting this bound | LL | fn bar<'me, 'async_trait, T: Send + std::marker::Sync>(x: &'me T) diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr index a723503776b..ab196dca20c 100644 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr +++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr @@ -8,7 +8,7 @@ LL | | bar(Foo(std::ptr::null())).await; LL | | }) | |_____^ future created by async block is not `Send` | - = help: within `impl Future`, the trait `Send` is not implemented for `*const u8` + = help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:16:17: 19:6]`, the trait `Send` is not implemented for `*const u8` note: future is not `Send` as this value is used across an await --> $DIR/issue-65436-raw-ptr-not-send.rs:18:35 | diff --git a/src/test/ui/chalkify/bugs/async.stderr b/src/test/ui/chalkify/bugs/async.stderr index 6f22d2c593a..4804df13340 100644 --- a/src/test/ui/chalkify/bugs/async.stderr +++ b/src/test/ui/chalkify/bugs/async.stderr @@ -1,4 +1,4 @@ -error[E0277]: `impl Future` is not a future +error[E0277]: `[async fn body@$DIR/async.rs:7:29: 9:2]` is not a future --> $DIR/async.rs:7:29 | LL | async fn foo(x: u32) -> u32 { @@ -7,18 +7,18 @@ LL | | x LL | | } | | ^ | | | - | |_`impl Future` is not a future + | |_`[async fn body@$DIR/async.rs:7:29: 9:2]` is not a future | required by a bound introduced by this call | - = help: the trait `Future` is not implemented for `impl Future` - = note: impl Future must be a future or must implement `IntoFuture` to be awaited + = help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:7:29: 9:2]` + = note: [async fn body@$DIR/async.rs:7:29: 9:2] must be a future or must implement `IntoFuture` to be awaited note: required by a bound in `identity_future` --> $SRC_DIR/core/src/future/mod.rs:LL:COL | LL | pub const fn identity_future>(f: Fut) -> Fut { | ^^^^^^^^^^^^^^^^^^ required by this bound in `identity_future` -error[E0277]: the size for values of type ` as Future>::Output` cannot be known at compilation time +error[E0277]: the size for values of type `<[async fn body@$DIR/async.rs:7:29: 9:2] as Future>::Output` cannot be known at compilation time --> $DIR/async.rs:7:29 | LL | async fn foo(x: u32) -> u32 { @@ -27,23 +27,23 @@ LL | | x LL | | } | |_^ doesn't have a size known at compile-time | - = help: the trait `Sized` is not implemented for ` as Future>::Output` + = help: the trait `Sized` is not implemented for `<[async fn body@$DIR/async.rs:7:29: 9:2] as Future>::Output` note: required by a bound in `identity_future` --> $SRC_DIR/core/src/future/mod.rs:LL:COL | LL | pub const fn identity_future>(f: Fut) -> Fut { | ^ required by this bound in `identity_future` -error[E0277]: `impl Future` is not a future +error[E0277]: `[async fn body@$DIR/async.rs:7:29: 9:2]` is not a future --> $DIR/async.rs:7:25 | LL | async fn foo(x: u32) -> u32 { - | ^^^ `impl Future` is not a future + | ^^^ `[async fn body@$DIR/async.rs:7:29: 9:2]` is not a future | - = help: the trait `Future` is not implemented for `impl Future` - = note: impl Future must be a future or must implement `IntoFuture` to be awaited + = help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:7:29: 9:2]` + = note: [async fn body@$DIR/async.rs:7:29: 9:2] must be a future or must implement `IntoFuture` to be awaited -error[E0280]: the requirement ` as Future>::Output == u32` is not satisfied +error[E0280]: the requirement `<[async fn body@$DIR/async.rs:7:29: 9:2] as Future>::Output == u32` is not satisfied --> $DIR/async.rs:7:25 | LL | async fn foo(x: u32) -> u32 { diff --git a/src/test/ui/generator/clone-impl-async.rs b/src/test/ui/generator/clone-impl-async.rs index 83c51526b7b..9e9b59d3633 100644 --- a/src/test/ui/generator/clone-impl-async.rs +++ b/src/test/ui/generator/clone-impl-async.rs @@ -15,42 +15,42 @@ fn main() { drop(non_clone); }; check_copy(&inner_non_clone); - //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + //~^ ERROR : Copy` is not satisfied check_clone(&inner_non_clone); - //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + //~^ ERROR : Clone` is not satisfied let non_clone = NonClone; let outer_non_clone = async move { drop(non_clone); }; check_copy(&outer_non_clone); - //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + //~^ ERROR : Copy` is not satisfied check_clone(&outer_non_clone); - //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + //~^ ERROR : Clone` is not satisfied let maybe_copy_clone = async move {}; check_copy(&maybe_copy_clone); - //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + //~^ ERROR : Copy` is not satisfied check_clone(&maybe_copy_clone); - //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + //~^ ERROR : Clone` is not satisfied let inner_non_clone_fn = the_inner_non_clone_fn(); check_copy(&inner_non_clone_fn); - //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + //~^ ERROR : Copy` is not satisfied check_clone(&inner_non_clone_fn); - //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + //~^ ERROR : Clone` is not satisfied let outer_non_clone_fn = the_outer_non_clone_fn(NonClone); check_copy(&outer_non_clone_fn); - //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + //~^ ERROR : Copy` is not satisfied check_clone(&outer_non_clone_fn); - //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + //~^ ERROR : Clone` is not satisfied let maybe_copy_clone_fn = the_maybe_copy_clone_fn(); check_copy(&maybe_copy_clone_fn); - //~^ ERROR the trait bound `impl Future: Copy` is not satisfied + //~^ ERROR : Copy` is not satisfied check_clone(&maybe_copy_clone_fn); - //~^ ERROR the trait bound `impl Future: Clone` is not satisfied + //~^ ERROR : Clone` is not satisfied } async fn the_inner_non_clone_fn() { @@ -64,8 +64,7 @@ async fn the_outer_non_clone_fn(non_clone: NonClone) { drop(non_clone); } -async fn the_maybe_copy_clone_fn() { -} +async fn the_maybe_copy_clone_fn() {} fn check_copy(_x: &T) {} fn check_clone(_x: &T) {} diff --git a/src/test/ui/generator/clone-impl-async.stderr b/src/test/ui/generator/clone-impl-async.stderr index cbb58d2af18..9854728876f 100644 --- a/src/test/ui/generator/clone-impl-async.stderr +++ b/src/test/ui/generator/clone-impl-async.stderr @@ -1,83 +1,83 @@ -error[E0277]: the trait bound `impl Future: Copy` is not satisfied +error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]: Copy` is not satisfied --> $DIR/clone-impl-async.rs:17:16 | LL | check_copy(&inner_non_clone); - | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:69:18 | LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `impl Future: Clone` is not satisfied +error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]: Clone` is not satisfied --> $DIR/clone-impl-async.rs:19:17 | LL | check_clone(&inner_non_clone); - | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:12:27: 16:6]` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:70:19 | LL | fn check_clone(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `impl Future: Copy` is not satisfied +error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]: Copy` is not satisfied --> $DIR/clone-impl-async.rs:26:16 | LL | check_copy(&outer_non_clone); - | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:69:18 | LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `impl Future: Clone` is not satisfied +error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]: Clone` is not satisfied --> $DIR/clone-impl-async.rs:28:17 | LL | check_clone(&outer_non_clone); - | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:23:27: 25:6]` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:70:19 | LL | fn check_clone(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `impl Future: Copy` is not satisfied +error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]: Copy` is not satisfied --> $DIR/clone-impl-async.rs:32:16 | LL | check_copy(&maybe_copy_clone); - | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:69:18 | LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `impl Future: Clone` is not satisfied +error[E0277]: the trait bound `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]: Clone` is not satisfied --> $DIR/clone-impl-async.rs:34:17 | LL | check_clone(&maybe_copy_clone); - | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future` + | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `[async block@$DIR/clone-impl-async.rs:31:28: 31:41]` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:70:19 | LL | fn check_clone(_x: &T) {} | ^^^^^ required by this bound in `check_clone` @@ -91,7 +91,7 @@ LL | check_copy(&inner_non_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:69:18 | LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` @@ -105,7 +105,7 @@ LL | check_clone(&inner_non_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:70:19 | LL | fn check_clone(_x: &T) {} | ^^^^^ required by this bound in `check_clone` @@ -119,7 +119,7 @@ LL | check_copy(&outer_non_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:69:18 | LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` @@ -133,7 +133,7 @@ LL | check_clone(&outer_non_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:70:19 | LL | fn check_clone(_x: &T) {} | ^^^^^ required by this bound in `check_clone` @@ -147,7 +147,7 @@ LL | check_copy(&maybe_copy_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:70:18 + --> $DIR/clone-impl-async.rs:69:18 | LL | fn check_copy(_x: &T) {} | ^^^^ required by this bound in `check_copy` @@ -161,7 +161,7 @@ LL | check_clone(&maybe_copy_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:71:19 + --> $DIR/clone-impl-async.rs:70:19 | LL | fn check_clone(_x: &T) {} | ^^^^^ required by this bound in `check_clone` diff --git a/src/test/ui/impl-trait/issue-55872-3.rs b/src/test/ui/impl-trait/issue-55872-3.rs index 3ffce85e61b..91811df93cd 100644 --- a/src/test/ui/impl-trait/issue-55872-3.rs +++ b/src/test/ui/impl-trait/issue-55872-3.rs @@ -12,7 +12,7 @@ pub trait Bar { impl Bar for S { type E = impl std::marker::Copy; fn foo() -> Self::E { - //~^ ERROR the trait bound `impl Future: Copy` is not satisfied [E0277] + //~^ ERROR : Copy` is not satisfied [E0277] async {} } } diff --git a/src/test/ui/impl-trait/issue-55872-3.stderr b/src/test/ui/impl-trait/issue-55872-3.stderr index 6ab540e8751..c6e10f0f350 100644 --- a/src/test/ui/impl-trait/issue-55872-3.stderr +++ b/src/test/ui/impl-trait/issue-55872-3.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `impl Future: Copy` is not satisfied +error[E0277]: the trait bound `[async block@$DIR/issue-55872-3.rs:16:9: 16:17]: Copy` is not satisfied --> $DIR/issue-55872-3.rs:14:20 | LL | fn foo() -> Self::E { - | ^^^^^^^ the trait `Copy` is not implemented for `impl Future` + | ^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/issue-55872-3.rs:16:9: 16:17]` error: aborting due to previous error diff --git a/src/test/ui/impl-trait/issues/issue-78722.rs b/src/test/ui/impl-trait/issues/issue-78722.rs index 9ee1ba3d3b4..78233f300bd 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.rs +++ b/src/test/ui/impl-trait/issues/issue-78722.rs @@ -7,7 +7,7 @@ type F = impl core::future::Future; struct Bug { V1: [(); { fn concrete_use() -> F { - //~^ ERROR expected `impl Future` to be a future that resolves to `u8`, but it resolves to `()` + //~^ ERROR to be a future that resolves to `u8`, but it resolves to `()` async {} } let f: F = async { 1 }; diff --git a/src/test/ui/impl-trait/issues/issue-78722.stderr b/src/test/ui/impl-trait/issues/issue-78722.stderr index a96994f5a7f..c00df8087e8 100644 --- a/src/test/ui/impl-trait/issues/issue-78722.stderr +++ b/src/test/ui/impl-trait/issues/issue-78722.stderr @@ -16,7 +16,7 @@ LL | let f: F = async { 1 }; LL | }], | - value is dropped here -error[E0271]: expected `impl Future` to be a future that resolves to `u8`, but it resolves to `()` +error[E0271]: expected `[async block@$DIR/issue-78722.rs:11:13: 11:21]` to be a future that resolves to `u8`, but it resolves to `()` --> $DIR/issue-78722.rs:9:30 | LL | fn concrete_use() -> F { diff --git a/src/test/ui/pattern/non-structural-match-types.stderr b/src/test/ui/pattern/non-structural-match-types.stderr index 45e16264973..dea7c4695cc 100644 --- a/src/test/ui/pattern/non-structural-match-types.stderr +++ b/src/test/ui/pattern/non-structural-match-types.stderr @@ -4,7 +4,7 @@ error: `[closure@$DIR/non-structural-match-types.rs:9:17: 9:19]` cannot be used LL | const { || {} } => {}, | ^^^^^^^^^^^^^^^ -error: `impl Future` cannot be used in patterns +error: `[async block@$DIR/non-structural-match-types.rs:12:17: 12:25]` cannot be used in patterns --> $DIR/non-structural-match-types.rs:12:9 | LL | const { async {} } => {}, diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index 918d37e6559..34ff59a9bb0 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -87,7 +87,7 @@ LL | | } | arguments to this function are incorrect | = note: expected struct `Pin + Send>>` - found `async` block `impl Future` + found `async` block `[async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6]` note: function defined here --> $SRC_DIR/core/src/future/mod.rs:LL:COL |