1
Fork 0

Guess head span of async blocks

This commit is contained in:
Oli Scherer 2022-01-27 16:22:22 +00:00
parent 7fd9c7e6de
commit 5518d1931d
4 changed files with 6 additions and 16 deletions

View file

@ -1680,6 +1680,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
)); ));
let original_span = err.span.primary_span().unwrap(); let original_span = err.span.primary_span().unwrap();
let original_span = self.tcx.sess.source_map().guess_head_span(original_span);
let mut span = MultiSpan::from_span(original_span); let mut span = MultiSpan::from_span(original_span);
let message = outer_generator let message = outer_generator

View file

@ -1,14 +1,8 @@
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/issue-64130-4-async-move.rs:17:5 --> $DIR/issue-64130-4-async-move.rs:17:5
| |
LL | / async move { LL | async move {
LL | | | ^^^^^^^^^^ future created by async block is not `Send`
LL | | match client.status() {
LL | | 200 => {
... |
LL | | }
LL | | }
| |_____^ future created by async block is not `Send`
| |
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` = help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await

View file

@ -2,7 +2,7 @@ error: future cannot be sent between threads safely
--> $DIR/issue-70818.rs:5:5 --> $DIR/issue-70818.rs:5:5
| |
LL | async { (ty, ty1) } LL | async { (ty, ty1) }
| ^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | ^^^^^ future created by async block is not `Send`
| |
note: captured value is not `Send` note: captured value is not `Send`
--> $DIR/issue-70818.rs:5:18 --> $DIR/issue-70818.rs:5:18

View file

@ -1,13 +1,8 @@
error: future cannot be sent between threads safely error: future cannot be sent between threads safely
--> $DIR/issue-70935-complex-spans.rs:11:5 --> $DIR/issue-70935-complex-spans.rs:11:5
| |
LL | / async move { LL | async move {
LL | | | ^^^^^^^^^^ future created by async block is not `Send`
LL | | baz(|| async{
LL | | foo(tx.clone());
LL | | }).await;
LL | | }
| |_____^ future created by async block is not `Send`
| |
= help: the trait `Sync` is not implemented for `Sender<i32>` = help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await