You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
change blanket impls for [Pin]Init and add one for Result<T, E>
Remove the error from the blanket implementations `impl<T, E> Init<T, E>
for T` (and also for `PinInit`). Add implementations for `Result<T, E>`.
This allows one to easily construct (un)conditional failing
initializers. It also improves the compatibility with APIs that do not
use pin-init, because users can supply a `Result<T, E>` to a function
taking an `impl PinInit<T, E>`.
Suggested-by: Alice Ryhl <[email protected]>
Signed-off-by: Benno Lossin <[email protected]>
Copy file name to clipboardExpand all lines: tests/ui/compile-fail/init/invalid_init.stderr
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -10,5 +10,7 @@ error[E0277]: the trait bound `impl pin_init::PinInit<Bar>: Init<Bar>` is not sa
10
10
| |______the trait `Init<Bar>` is not implemented for `impl pin_init::PinInit<Bar>`
11
11
| required by a bound introduced by this call
12
12
|
13
-
= help: the trait `Init<T, E>` is implemented for `ChainInit<I, F, T, E>`
13
+
= help: the following other types implement trait `Init<T, E>`:
14
+
ChainInit<I, F, T, E>
15
+
Result<T, E>
14
16
= note: this error originates in the macro `$crate::__init_internal` which comes from the expansion of the macro `init` (in Nightly builds, run with -Z macro-backtrace for more info)
0 commit comments