|
66 | 66 | #[lang = "fn"]
|
67 | 67 | #[stable(feature = "rust1", since = "1.0.0")]
|
68 | 68 | #[rustc_paren_sugar]
|
| 69 | +#[rustc_on_unimplemented( |
| 70 | + on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"), |
| 71 | + message="expected a `{Fn}<{Args}>` closure, found `{Self}`", |
| 72 | + label="expected an `Fn<{Args}>` closure, found `{Self}`", |
| 73 | +)] |
69 | 74 | #[fundamental] // so that regex can rely that `&str: !FnMut`
|
70 | 75 | pub trait Fn<Args> : FnMut<Args> {
|
71 | 76 | /// Performs the call operation.
|
@@ -139,6 +144,11 @@ pub trait Fn<Args> : FnMut<Args> {
|
139 | 144 | #[lang = "fn_mut"]
|
140 | 145 | #[stable(feature = "rust1", since = "1.0.0")]
|
141 | 146 | #[rustc_paren_sugar]
|
| 147 | +#[rustc_on_unimplemented( |
| 148 | + on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"), |
| 149 | + message="expected a `{FnMut}<{Args}>` closure, found `{Self}`", |
| 150 | + label="expected an `FnMut<{Args}>` closure, found `{Self}`", |
| 151 | +)] |
142 | 152 | #[fundamental] // so that regex can rely that `&str: !FnMut`
|
143 | 153 | pub trait FnMut<Args> : FnOnce<Args> {
|
144 | 154 | /// Performs the call operation.
|
@@ -212,6 +222,11 @@ pub trait FnMut<Args> : FnOnce<Args> {
|
212 | 222 | #[lang = "fn_once"]
|
213 | 223 | #[stable(feature = "rust1", since = "1.0.0")]
|
214 | 224 | #[rustc_paren_sugar]
|
| 225 | +#[rustc_on_unimplemented( |
| 226 | + on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"), |
| 227 | + message="expected a `{FnOnce}<{Args}>` closure, found `{Self}`", |
| 228 | + label="expected an `FnOnce<{Args}>` closure, found `{Self}`", |
| 229 | +)] |
215 | 230 | #[fundamental] // so that regex can rely that `&str: !FnMut`
|
216 | 231 | pub trait FnOnce<Args> {
|
217 | 232 | /// The returned type after the call operator is used.
|
|
0 commit comments