|
1 | | -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT |
2 | | -// file at the top-level directory of this distribution and at |
3 | | -// http://rust-lang.org/COPYRIGHT. |
4 | | -// |
5 | | -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
6 | | -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
7 | | -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
8 | | -// option. This file may not be copied, modified, or distributed |
9 | | -// except according to those terms. |
10 | | - |
11 | | -// This test relies on `TryFrom` being auto impl for all `T: Into` |
12 | | -// and `TryInto` being auto impl for all `U: TryFrom` |
| 1 | +// This test relies on `TryFrom` being blanket impl for all `T: Into` |
| 2 | +// and `TryInto` being blanket impl for all `U: TryFrom` |
13 | 3 |
|
14 | 4 | // This test was added to show the motivation for doing this |
15 | | -// over `TryFrom` being auto impl for all `T: From` |
| 5 | +// over `TryFrom` being blanket impl for all `T: From` |
16 | 6 |
|
17 | 7 | #![feature(try_from, never_type)] |
18 | 8 |
|
19 | 9 | use std::convert::TryInto; |
20 | 10 |
|
21 | 11 | struct Foo<T> { |
22 | | - t: T |
| 12 | + t: T, |
23 | 13 | } |
24 | 14 |
|
25 | | -/* |
26 | 15 | // This fails to compile due to coherence restrictions |
27 | | -// as of rust version 1.32.x |
| 16 | +// as of Rust version 1.32.x, therefore it could not be used |
| 17 | +// instead of the `Into` version of the impl, and serves as |
| 18 | +// motivation for a blanket impl for all `T: Into`, instead |
| 19 | +// of a blanket impl for all `T: From` |
| 20 | +/* |
28 | 21 | impl<T> From<Foo<T>> for Box<T> { |
29 | 22 | fn from(foo: Foo<T>) -> Box<T> { |
30 | 23 | Box::new(foo.t) |
|
0 commit comments