diff options
| author | Ozaren <krishna.sd.2012@gmail.com> | 2019-01-02 20:38:50 -0500 |
|---|---|---|
| committer | Ozaren <krishna.sd.2012@gmail.com> | 2019-01-02 20:38:50 -0500 |
| commit | ea68b3ff3dd5a49c5984c476570fb5404c342079 (patch) | |
| tree | ff7c3954b5ac5f0c256614aba874e7903f57dbc4 | |
| parent | 7dd078f53f4e1817207b089fb08d6a00121ca05b (diff) | |
| download | rust-ea68b3ff3dd5a49c5984c476570fb5404c342079.tar.gz rust-ea68b3ff3dd5a49c5984c476570fb5404c342079.zip | |
update to reflect changes recommended by @shepmaster his review
| -rw-r--r-- | src/test/run-pass/try_from.rs | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/test/run-pass/try_from.rs b/src/test/run-pass/try_from.rs index 767c2b91471..4522ce3a8d6 100644 --- a/src/test/run-pass/try_from.rs +++ b/src/test/run-pass/try_from.rs @@ -1,30 +1,23 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This test relies on `TryFrom` being auto impl for all `T: Into` -// and `TryInto` being auto impl for all `U: TryFrom` +// This test relies on `TryFrom` being blanket impl for all `T: Into` +// and `TryInto` being blanket impl for all `U: TryFrom` // This test was added to show the motivation for doing this -// over `TryFrom` being auto impl for all `T: From` +// over `TryFrom` being blanket impl for all `T: From` #![feature(try_from, never_type)] use std::convert::TryInto; struct Foo<T> { - t: T + t: T, } -/* // This fails to compile due to coherence restrictions -// as of rust version 1.32.x +// as of Rust version 1.32.x, therefore it could not be used +// instead of the `Into` version of the impl, and serves as +// motivation for a blanket impl for all `T: Into`, instead +// of a blanket impl for all `T: From` +/* impl<T> From<Foo<T>> for Box<T> { fn from(foo: Foo<T>) -> Box<T> { Box::new(foo.t) |
