]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsized/unsized-enum.stderr
Rollup merge of #106664 - chenyukang:yukang/fix-106597-remove-lseek, r=cuviper
[rust.git] / tests / 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 | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
5    |         -                          ^^^^^^ doesn't have a size known at compile-time
6    |         |
7    |         this type parameter needs to be `std::marker::Sized`
8    |
9 note: required by a bound in `Foo`
10   --> $DIR/unsized-enum.rs:4:10
11    |
12 LL | enum Foo<U> { FooSome(U), FooNone }
13    |          ^ required by this bound in `Foo`
14 help: you could relax the implicit `Sized` bound on `U` if it were used through indirection like `&U` or `Box<U>`
15   --> $DIR/unsized-enum.rs:4:10
16    |
17 LL | enum Foo<U> { FooSome(U), FooNone }
18    |          ^            - ...if indirection were used here: `Box<U>`
19    |          |
20    |          this could be changed to `U: ?Sized`...
21 help: consider removing the `?Sized` bound to make the type parameter `Sized`
22    |
23 LL - fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
24 LL + fn foo2<T>() { not_sized::<Foo<T>>() }
25    |
26
27 error: aborting due to previous error
28
29 For more information about this error, try `rustc --explain E0277`.