]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unsized/unsized-enum.stderr
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[rust.git] / src / test / ui / unsized / unsized-enum.stderr
1 error[E0277]: the size for values of type `T` cannot be known at compilation time
2   --> $DIR/unsized-enum.rs:6:36
3    |
4 LL | enum Foo<U> { FooSome(U), FooNone }
5    |          - required by this bound in `Foo`
6 LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
7 LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
8    |         -                          ^^^^^^ doesn't have a size known at compile-time
9    |         |
10    |         this type parameter needs to be `std::marker::Sized`
11    |
12 help: you could relax the implicit `Sized` bound on `U` if it were used through indirection like `&U` or `Box<U>`
13   --> $DIR/unsized-enum.rs:4:10
14    |
15 LL | enum Foo<U> { FooSome(U), FooNone }
16    |          ^            - ...if indirection was used here: `Box<U>`
17    |          |
18    |          this could be changed to `U: ?Sized`...
19
20 error: aborting due to previous error
21
22 For more information about this error, try `rustc --explain E0277`.