summaryrefslogtreecommitdiffstats
path: root/src/test/ui/coercion
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr2
-rw-r--r--src/test/ui/coercion/coerce-to-bang.stderr10
-rw-r--r--src/test/ui/coercion/coercion-missing-tail-expected-type.stderr4
-rw-r--r--src/test/ui/coercion/issue-101066.rs16
-rw-r--r--src/test/ui/coercion/issue-36007.rs20
5 files changed, 44 insertions, 8 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/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr
index a4843bca5..4c04bb113 100644
--- a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr
+++ b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr
@@ -6,7 +6,7 @@ LL | fn plus_one(x: i32) -> i32 {
| |
| implicitly returns `()` as its body has no tail or `return` expression
LL | x + 1;
- | - help: remove this semicolon
+ | - help: remove this semicolon to return this value
error[E0308]: mismatched types
--> $DIR/coercion-missing-tail-expected-type.rs:8:13
@@ -16,7 +16,7 @@ LL | fn foo() -> Result<u8, u64> {
| |
| implicitly returns `()` as its body has no tail or `return` expression
LL | Ok(1);
- | - help: remove this semicolon
+ | - help: remove this semicolon to return this value
|
= note: expected enum `Result<u8, u64>`
found unit type `()`
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() {}
diff --git a/src/test/ui/coercion/issue-36007.rs b/src/test/ui/coercion/issue-36007.rs
new file mode 100644
index 000000000..78812df87
--- /dev/null
+++ b/src/test/ui/coercion/issue-36007.rs
@@ -0,0 +1,20 @@
+// check-pass
+#![feature(coerce_unsized, unsize)]
+
+use std::marker::Unsize;
+use std::ops::CoerceUnsized;
+
+struct Foo<T: ?Sized>(Box<T>);
+
+impl<T> CoerceUnsized<Foo<dyn Baz>> for Foo<T> where T: Unsize<dyn Baz> {}
+
+struct Bar;
+
+trait Baz {}
+
+impl Baz for Bar {}
+
+fn main() {
+ let foo = Foo(Box::new(Bar));
+ let foobar: Foo<Bar> = foo;
+}