diff options
Diffstat (limited to 'src/test/ui/coercion')
-rw-r--r-- | src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/coercion/coerce-to-bang.stderr | 10 | ||||
-rw-r--r-- | src/test/ui/coercion/issue-101066.rs | 16 |
3 files changed, 22 insertions, 6 deletions
diff --git a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr index 36551e5af..5cbdef218 100644 --- a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr +++ b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr @@ -12,7 +12,7 @@ note: function defined here --> $DIR/coerce-reborrow-multi-arg-fail.rs:1:4 | LL | fn test<T>(_a: T, _b: T) {} - | ^^^^ ----- ----- + | ^^^^ ----- error: aborting due to previous error diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr index add8f14cf..1207dc7e7 100644 --- a/src/test/ui/coercion/coerce-to-bang.stderr +++ b/src/test/ui/coercion/coerce-to-bang.stderr @@ -12,7 +12,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:18:13 @@ -28,7 +28,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:26:12 @@ -44,7 +44,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:36:12 @@ -60,7 +60,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:45:12 @@ -76,7 +76,7 @@ note: function defined here --> $DIR/coerce-to-bang.rs:3:4 | LL | fn foo(x: usize, y: !, z: usize) { } - | ^^^ -------- ---- -------- + | ^^^ ---- error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:50:21 diff --git a/src/test/ui/coercion/issue-101066.rs b/src/test/ui/coercion/issue-101066.rs new file mode 100644 index 000000000..b658ed1e9 --- /dev/null +++ b/src/test/ui/coercion/issue-101066.rs @@ -0,0 +1,16 @@ +// check-pass + +use std::convert::TryFrom; + +pub trait FieldElement { + type Integer: TryFrom<usize, Error = std::num::TryFromIntError>; + + fn valid_integer_try_from<N>(i: N) -> Result<Self::Integer, ()> + where + Self::Integer: TryFrom<N>, + { + Self::Integer::try_from(i).map_err(|_| ()) + } +} + +fn main() {} |