-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for ICE: Unexpected unsized type tail: &ReStatic [u8] #122488
Fixes #122488
- Loading branch information
1 parent
5dc7fe4
commit 7d9e106
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// ICE Unexpected unsized type tail: &ReStatic [u8] | ||
// issue: rust-lang/rust#122488 | ||
use std::ops::Deref; | ||
|
||
struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U); | ||
//~^ ERROR the size for values of type `V` cannot be known at compilation time | ||
|
||
const DATA: *const ArenaSet<Vec<u8>> = std::ptr::null_mut(); | ||
|
||
pub fn main() {} |
27 changes: 27 additions & 0 deletions
27
tests/ui/layout/issue-unsized-tail-restatic-ice-122488.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error[E0277]: the size for values of type `V` cannot be known at compilation time | ||
--> $DIR/issue-unsized-tail-restatic-ice-122488.rs:5:61 | ||
| | ||
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U); | ||
| -------------------------------- ^ doesn't have a size known at compile-time | ||
| | | ||
| this type parameter needs to be `Sized` | ||
| | ||
= note: only the last field of a struct may have a dynamically sized type | ||
= help: change the field's type to have a statically known size | ||
help: consider removing the `?Sized` bound to make the type parameter `Sized` | ||
| | ||
LL - struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U); | ||
LL + struct ArenaSet<U: Deref, V = <U as Deref>::Target>(V, U); | ||
| | ||
help: borrowed types always have a statically known size | ||
| | ||
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(&V, U); | ||
| + | ||
help: the `Box` type always has a statically known size and allocates its contents in the heap | ||
| | ||
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(Box<V>, U); | ||
| ++++ + | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |