We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
TryInto
TryFrom
1 parent e645e51 commit a37873dCopy full SHA for a37873d
library/coretests/tests/convert.rs
@@ -14,3 +14,20 @@ fn convert() {
14
const BAR: Vec<String> = into(Vec::new());
15
assert_eq!(BAR, Vec::<String>::new());
16
}
17
+
18
+#[test]
19
+fn into_as_try_into() {
20
+ struct A;
21
+ struct B;
22
23
+ impl Into<B> for A {
24
+ fn into(self) -> B {
25
+ B
26
+ }
27
28
29
+ // This wouldn't compile if the `TryInto`/`TryFrom` blanket impls used
30
+ // `U: From<T>` instead of `T: Into<U>`
31
+ let Ok(B) = A.try_into();
32
+ let Ok(B) = B::try_from(A);
33
+}
0 commit comments