]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/try-trait/bad-interconversion.rs
Auto merge of #79608 - alessandrod:bpf, r=nagisa
[rust.git] / src / test / ui / try-trait / bad-interconversion.rs
index 87585822f5719dc5c5682d0dd9b72fc3f0ebb5eb..385f5510fb414ea79aea2857d339dcceedaafb56 100644 (file)
@@ -20,7 +20,7 @@ fn control_flow_to_result() -> Result<u64, String> {
 
 fn result_to_option() -> Option<u16> {
     Some(Err("hello")?)
-    //~^ ERROR the `?` operator can only be used on `Option`s in a function that returns `Option`
+    //~^ ERROR the `?` operator can only be used on `Option`s, not `Result`s, in a function that returns `Option`
 }
 
 fn control_flow_to_option() -> Option<u64> {
@@ -30,18 +30,18 @@ fn control_flow_to_option() -> Option<u64> {
 
 fn result_to_control_flow() -> ControlFlow<String> {
     ControlFlow::Continue(Err("hello")?)
-    //~^ ERROR the `?` operator can only be used on `ControlFlow<B, _>`s in a function that returns `ControlFlow<B, _>`
+    //~^ ERROR the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
 }
 
 fn option_to_control_flow() -> ControlFlow<u64> {
     Some(3)?;
-    //~^ ERROR the `?` operator can only be used on `ControlFlow<B, _>`s in a function that returns `ControlFlow<B, _>`
+    //~^ ERROR the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow`
     ControlFlow::Break(10)
 }
 
 fn control_flow_to_control_flow() -> ControlFlow<i64> {
     ControlFlow::Break(4_u8)?;
-    //~^ ERROR the `?` operator can only be used on `ControlFlow<B, _>`s in a function that returns `ControlFlow<B, _>`
+    //~^ ERROR the `?` operator in a function that returns `ControlFlow<B, _>` can only be used on other `ControlFlow<B, _>`s
     ControlFlow::Continue(())
 }