about summary refs log tree commit diff
path: root/tests/ui/async-await/try-in-sync.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-10-11 10:59:09 -0400
committerMichael Goulet <michael@errs.io>2024-10-12 06:14:45 -0400
commit5e8820caaa91f3d7740303e9e7047fbfb82281ce (patch)
tree947b1a31a2451d496436d44a800700dbda43a909 /tests/ui/async-await/try-in-sync.rs
parentfb20e4d3b96d1de459d086980a8b99d5060ad9fe (diff)
downloadrust-5e8820caaa91f3d7740303e9e7047fbfb82281ce.tar.gz
rust-5e8820caaa91f3d7740303e9e7047fbfb82281ce.zip
Add a note for ? on future in sync function
Diffstat (limited to 'tests/ui/async-await/try-in-sync.rs')
-rw-r--r--tests/ui/async-await/try-in-sync.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ui/async-await/try-in-sync.rs b/tests/ui/async-await/try-in-sync.rs
new file mode 100644
index 00000000000..81d72c3fb9a
--- /dev/null
+++ b/tests/ui/async-await/try-in-sync.rs
@@ -0,0 +1,9 @@
+//@ edition: 2021
+
+async fn foo() -> Result<(), ()> { todo!() }
+
+fn main() -> Result<(), ()> {
+    foo()?;
+    //~^ ERROR the `?` operator can only be applied to values that implement `Try`
+    Ok(())
+}