summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsized
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/unsized')
-rw-r--r--src/test/ui/unsized/issue-71659.stderr6
-rw-r--r--src/test/ui/unsized/issue-75707.stderr4
-rw-r--r--src/test/ui/unsized/issue-75899-but-gats.rs21
-rw-r--r--src/test/ui/unsized/issue-75899.rs18
-rw-r--r--src/test/ui/unsized/unsized-fn-param.stderr16
-rw-r--r--src/test/ui/unsized/unsized-struct.stderr4
-rw-r--r--src/test/ui/unsized/unsized3.stderr10
7 files changed, 54 insertions, 25 deletions
diff --git a/src/test/ui/unsized/issue-71659.stderr b/src/test/ui/unsized/issue-71659.stderr
index d7b95f557..50060e53a 100644
--- a/src/test/ui/unsized/issue-71659.stderr
+++ b/src/test/ui/unsized/issue-71659.stderr
@@ -1,8 +1,10 @@
error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied
- --> $DIR/issue-71659.rs:30:15
+ --> $DIR/issue-71659.rs:30:13
|
LL | let x = x.cast::<[i32]>();
- | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo`
+ | ^ ---- required by a bound introduced by this call
+ | |
+ | the trait `CastTo<[i32]>` is not implemented for `dyn Foo`
|
note: required by a bound in `Cast::cast`
--> $DIR/issue-71659.rs:19:15
diff --git a/src/test/ui/unsized/issue-75707.stderr b/src/test/ui/unsized/issue-75707.stderr
index 7d0a2cb85..97618ed05 100644
--- a/src/test/ui/unsized/issue-75707.stderr
+++ b/src/test/ui/unsized/issue-75707.stderr
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `MyCall: Callback` is not satisfied
- --> $DIR/issue-75707.rs:15:5
+ --> $DIR/issue-75707.rs:15:9
|
LL | f::<dyn Processing<Call = MyCall>>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall`
|
note: required by a bound in `f`
--> $DIR/issue-75707.rs:9:9
diff --git a/src/test/ui/unsized/issue-75899-but-gats.rs b/src/test/ui/unsized/issue-75899-but-gats.rs
new file mode 100644
index 000000000..5716817f4
--- /dev/null
+++ b/src/test/ui/unsized/issue-75899-but-gats.rs
@@ -0,0 +1,21 @@
+// check-pass
+
+use std::fmt::Debug;
+use std::marker::PhantomData;
+
+trait Foo {
+ type Gat<'a>: ?Sized where Self: 'a;
+}
+
+struct Bar<'a, T: Foo + 'a>(T::Gat<'a>);
+
+struct Baz<T: ?Sized>(PhantomData<T>);
+
+impl<T: ?Sized> Foo for Baz<T> {
+ type Gat<'a> = T where Self: 'a;
+}
+
+fn main() {
+ let x = Bar::<'_, Baz<()>>(());
+ let y: &Bar<'_, Baz<dyn Debug>> = &x;
+}
diff --git a/src/test/ui/unsized/issue-75899.rs b/src/test/ui/unsized/issue-75899.rs
new file mode 100644
index 000000000..abff17e11
--- /dev/null
+++ b/src/test/ui/unsized/issue-75899.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+trait Trait {}
+impl<T> Trait for T {}
+
+trait Noop {
+ type Assoc: ?Sized;
+}
+impl<T: ?Sized> Noop for T {
+ type Assoc = T;
+}
+
+struct NoopNewtype<T: ?Sized + Noop>(T::Assoc);
+fn coerce_newtype<T: Trait>(x: &NoopNewtype<T>) -> &NoopNewtype<dyn Trait + '_> {
+ x
+}
+
+fn main() {}
diff --git a/src/test/ui/unsized/unsized-fn-param.stderr b/src/test/ui/unsized/unsized-fn-param.stderr
index 0221ef16b..b47726054 100644
--- a/src/test/ui/unsized/unsized-fn-param.stderr
+++ b/src/test/ui/unsized/unsized-fn-param.stderr
@@ -2,9 +2,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
--> $DIR/unsized-fn-param.rs:11:11
|
LL | foo11("bar", &"baz");
- | ----- ^^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: required for the cast from `str` to the object type `dyn AsRef<Path>`
@@ -17,9 +15,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
--> $DIR/unsized-fn-param.rs:13:19
|
LL | foo12(&"bar", "baz");
- | ----- ^^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: required for the cast from `str` to the object type `dyn AsRef<Path>`
@@ -32,9 +28,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
--> $DIR/unsized-fn-param.rs:16:11
|
LL | foo21("bar", &"baz");
- | ----- ^^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: required for the cast from `str` to the object type `dyn AsRef<str>`
@@ -47,9 +41,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t
--> $DIR/unsized-fn-param.rs:18:19
|
LL | foo22(&"bar", "baz");
- | ----- ^^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: required for the cast from `str` to the object type `dyn AsRef<str>`
diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr
index c9510e92f..dff1b0a51 100644
--- a/src/test/ui/unsized/unsized-struct.stderr
+++ b/src/test/ui/unsized/unsized-struct.stderr
@@ -25,10 +25,10 @@ LL + fn foo2<T>() { not_sized::<Foo<T>>() }
|
error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> $DIR/unsized-struct.rs:13:24
+ --> $DIR/unsized-struct.rs:13:35
|
LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
- | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ | - ^^^^^^ doesn't have a size known at compile-time
| |
| this type parameter needs to be `std::marker::Sized`
|
diff --git a/src/test/ui/unsized/unsized3.stderr b/src/test/ui/unsized/unsized3.stderr
index d64091b15..9ad1ac6b4 100644
--- a/src/test/ui/unsized/unsized3.stderr
+++ b/src/test/ui/unsized/unsized3.stderr
@@ -79,14 +79,12 @@ LL | fn f5<Y: ?Sized>(x: &Y) {}
| ++++++++
error[E0277]: the size for values of type `X` cannot be known at compilation time
- --> $DIR/unsized3.rs:40:8
+ --> $DIR/unsized3.rs:40:5
|
LL | fn f9<X: ?Sized>(x1: Box<S<X>>) {
| - this type parameter needs to be `std::marker::Sized`
LL | f5(&(*x1, 34));
- | -- ^^^^^^^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^ doesn't have a size known at compile-time
|
note: required because it appears within the type `S<X>`
--> $DIR/unsized3.rs:28:8
@@ -106,9 +104,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
LL | fn f10<X: ?Sized>(x1: Box<S<X>>) {
| - this type parameter needs to be `std::marker::Sized`
LL | f5(&(32, *x1));
- | -- ^^^^^^^^^ doesn't have a size known at compile-time
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^ doesn't have a size known at compile-time
|
note: required because it appears within the type `S<X>`
--> $DIR/unsized3.rs:28:8