Skip to content

Commit ea68b3f

Browse files
committed
update to reflect changes recommended by @shepmaster his review
1 parent 7dd078f commit ea68b3f

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

Diff for: src/test/run-pass/try_from.rs

+9-16
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
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`
133

144
// 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`
166

177
#![feature(try_from, never_type)]
188

199
use std::convert::TryInto;
2010

2111
struct Foo<T> {
22-
t: T
12+
t: T,
2313
}
2414

25-
/*
2615
// 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+
/*
2821
impl<T> From<Foo<T>> for Box<T> {
2922
fn from(foo: Foo<T>) -> Box<T> {
3023
Box::new(foo.t)

0 commit comments

Comments
 (0)