Extend HIR WF checking to fields

This commit is contained in:
Aaron Hill 2021-07-20 10:56:33 -05:00
parent f913a4fe90
commit 0ebd6e4891
No known key found for this signature in database
GPG key ID: B4087E510E98B164
6 changed files with 15 additions and 13 deletions

View file

@ -1,8 +1,8 @@
error[E0038]: the trait `Qiz` cannot be made into an object
--> $DIR/issue-19380.rs:11:9
--> $DIR/issue-19380.rs:11:29
|
LL | foos: &'static [&'static (dyn Qiz + 'static)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Qiz` cannot be made into an object
| ^^^^^^^^^^^^^^^^^ `Qiz` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-19380.rs:2:6

View file

@ -1,11 +1,11 @@
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/wf-in-fn-type-arg.rs:9:8
--> $DIR/wf-in-fn-type-arg.rs:9:11
|
LL | struct MustBeCopy<T:Copy> {
| ---- required by this bound in `MustBeCopy`
...
LL | x: fn(MustBeCopy<T>)
| ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
help: consider restricting type parameter `T`
|

View file

@ -1,11 +1,11 @@
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/wf-in-fn-type-ret.rs:9:8
--> $DIR/wf-in-fn-type-ret.rs:9:16
|
LL | struct MustBeCopy<T:Copy> {
| ---- required by this bound in `MustBeCopy`
...
LL | x: fn() -> MustBeCopy<T>
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
help: consider restricting type parameter `T`
|

View file

@ -1,11 +1,11 @@
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/wf-in-obj-type-trait.rs:11:8
--> $DIR/wf-in-obj-type-trait.rs:11:19
|
LL | struct MustBeCopy<T:Copy> {
| ---- required by this bound in `MustBeCopy`
...
LL | x: dyn Object<MustBeCopy<T>>
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
help: consider restricting type parameter `T`
|