@@ -115,15 +115,14 @@ use crate::ops::ControlFlow;
115
115
#[ unstable( feature = "try_trait_v2" , issue = "84277" ) ]
116
116
#[ rustc_on_unimplemented(
117
117
on(
118
- all( from_method = "from_output" , from_desugaring = "TryBlock" ) ,
118
+ all( from_desugaring = "TryBlock" ) ,
119
119
message = "a `try` block must return `Result` or `Option` \
120
120
(or another type that implements `{Try}`)",
121
121
label = "could not wrap the final value of the block as `{Self}` doesn't implement `Try`" ,
122
122
) ,
123
123
on(
124
- all( from_method = "branch" , from_desugaring = "QuestionMark" ) ,
125
- message = "the `?` operator can only be applied to values \
126
- that implement `{Try}`",
124
+ all( from_desugaring = "QuestionMark" ) ,
125
+ message = "the `?` operator can only be applied to values that implement `{Try}`" ,
127
126
label = "the `?` operator cannot be applied to type `{Self}`"
128
127
)
129
128
) ]
@@ -226,7 +225,6 @@ pub trait Try: FromResidual {
226
225
#[ rustc_on_unimplemented(
227
226
on(
228
227
all(
229
- from_method = "from_residual" ,
230
228
from_desugaring = "QuestionMark" ,
231
229
_Self = "std::result::Result<T, E>" ,
232
230
R = "std::option::Option<std::convert::Infallible>"
@@ -238,7 +236,6 @@ pub trait Try: FromResidual {
238
236
) ,
239
237
on(
240
238
all(
241
- from_method = "from_residual" ,
242
239
from_desugaring = "QuestionMark" ,
243
240
_Self = "std::result::Result<T, E>" ,
244
241
) ,
@@ -252,7 +249,6 @@ pub trait Try: FromResidual {
252
249
) ,
253
250
on(
254
251
all(
255
- from_method = "from_residual" ,
256
252
from_desugaring = "QuestionMark" ,
257
253
_Self = "std::option::Option<T>" ,
258
254
R = "std::result::Result<T, E>" ,
@@ -264,7 +260,6 @@ pub trait Try: FromResidual {
264
260
) ,
265
261
on(
266
262
all(
267
- from_method = "from_residual" ,
268
263
from_desugaring = "QuestionMark" ,
269
264
_Self = "std::option::Option<T>" ,
270
265
) ,
@@ -277,7 +272,6 @@ pub trait Try: FromResidual {
277
272
) ,
278
273
on(
279
274
all(
280
- from_method = "from_residual" ,
281
275
from_desugaring = "QuestionMark" ,
282
276
_Self = "std::ops::ControlFlow<B, C>" ,
283
277
R = "std::ops::ControlFlow<B, C>" ,
@@ -290,7 +284,6 @@ pub trait Try: FromResidual {
290
284
) ,
291
285
on(
292
286
all(
293
- from_method = "from_residual" ,
294
287
from_desugaring = "QuestionMark" ,
295
288
_Self = "std::ops::ControlFlow<B, C>" ,
296
289
// `R` is not a `ControlFlow`, as that case was matched previously
@@ -301,10 +294,7 @@ pub trait Try: FromResidual {
301
294
enclosing_scope = "this function returns a `ControlFlow`" ,
302
295
) ,
303
296
on(
304
- all(
305
- from_method = "from_residual" ,
306
- from_desugaring = "QuestionMark"
307
- ) ,
297
+ all( from_desugaring = "QuestionMark" ) ,
308
298
message = "the `?` operator can only be used in {ItemContext} \
309
299
that returns `Result` or `Option` \
310
300
(or another type that implements `{FromResidual}`)",
0 commit comments