about summary refs log tree commit diff
path: root/src/test/ui/async-await/partial-drop-partial-reinit.rs
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-06-19 13:59:36 -0500
committerJoshua Nelson <jnelson@cloudflare.com>2022-06-19 15:31:22 -0500
commit1deca0425db3e74a61cb732e729c0777904e549c (patch)
tree0243373760ee6aa41c578a4d3a17dc9f026beb53 /src/test/ui/async-await/partial-drop-partial-reinit.rs
parentcdcc53b7dc002ea4a7a28105010c5a1126ee31b7 (diff)
downloadrust-1deca0425db3e74a61cb732e729c0777904e549c.tar.gz
rust-1deca0425db3e74a61cb732e729c0777904e549c.zip
Greatly improve error reporting for futures and generators in `note_obligation_cause_code`
Most futures don't go through this code path, because they're caught by
`maybe_note_obligation_cause_for_async_await`. But all generators do,
and `maybe_note` is imperfect and doesn't catch all futures. Improve the error message for those it misses.

At some point, we may want to consider unifying this with the code for `maybe_note_async_await`,
so that `async_await` notes all parent constraints, and `note_obligation` can point to yield points.
But both functions are quite complicated, and it's not clear to me how to combine them;
this seems like a good incremental improvement.
Diffstat (limited to 'src/test/ui/async-await/partial-drop-partial-reinit.rs')
-rw-r--r--src/test/ui/async-await/partial-drop-partial-reinit.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.rs b/src/test/ui/async-await/partial-drop-partial-reinit.rs
index 73f0ca8153c..4fcfacea3f8 100644
--- a/src/test/ui/async-await/partial-drop-partial-reinit.rs
+++ b/src/test/ui/async-await/partial-drop-partial-reinit.rs
@@ -5,9 +5,15 @@
 fn main() {
     gimme_send(foo());
     //~^ ERROR cannot be sent between threads safely
+    //~| NOTE cannot be sent
+    //~| NOTE bound introduced by
+    //~| NOTE appears within the type
+    //~| NOTE captures the following types
 }
 
 fn gimme_send<T: Send>(t: T) {
+//~^ NOTE required by this bound
+//~| NOTE required by a bound
     drop(t);
 }
 
@@ -20,6 +26,8 @@ impl Drop for NotSend {
 impl !Send for NotSend {}
 
 async fn foo() {
+//~^ NOTE used within this async block
+//~| NOTE within this `impl Future
     let mut x = (NotSend {},);
     drop(x.0);
     x.0 = NotSend {};