-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//@ edition: 2021 | ||
|
||
struct Ty; | ||
|
||
impl TryFrom<Ty> for u8 { | ||
type Error = Ty; | ||
fn try_from(_: Ty) -> Result<Self, Self::Error> { | ||
//~^ ERROR type annotations needed | ||
loop {} | ||
} | ||
} | ||
|
||
impl TryFrom<Ty> for u8 { | ||
//~^ ERROR conflicting implementations of trait | ||
type Error = Ty; | ||
fn try_from(_: Ty) -> Result<Self, Self::Error> { | ||
//~^ ERROR type annotations needed | ||
loop {} | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
error[E0119]: conflicting implementations of trait `TryFrom<Ty>` for type `u8` | ||
--> $DIR/conflicting-impls.rs:12:1 | ||
| | ||
LL | impl TryFrom<Ty> for u8 { | ||
| ----------------------- first implementation here | ||
... | ||
LL | impl TryFrom<Ty> for u8 { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/conflicting-impls.rs:7:5 | ||
| | ||
LL | fn try_from(_: Ty) -> Result<Self, Self::Error> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | ||
| | ||
note: the requirement `_ <: _` appears on the `impl`'s method `try_from` but not on the corresponding trait's method | ||
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL | ||
| | ||
= note: in this trait | ||
::: $SRC_DIR/core/src/convert/mod.rs:LL:COL | ||
| | ||
= note: this trait's method doesn't have the requirement `_ <: _` | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/conflicting-impls.rs:14:5 | ||
| | ||
LL | fn try_from(_: Ty) -> Result<Self, Self::Error> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | ||
| | ||
note: the requirement `_ <: _` appears on the `impl`'s method `try_from` but not on the corresponding trait's method | ||
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL | ||
| | ||
= note: in this trait | ||
::: $SRC_DIR/core/src/convert/mod.rs:LL:COL | ||
| | ||
= note: this trait's method doesn't have the requirement `_ <: _` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0119, E0282. | ||
For more information about an error, try `rustc --explain E0119`. |