forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#91462 - b-naber:use-try-normalize-erasing-r…
…egions, r=jackh726 Use try_normalize_erasing_regions in needs_drop Fixes rust-lang#81199 r? `@jackh726`
- Loading branch information
Showing
4 changed files
with
60 additions
and
4 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
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
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,21 @@ | ||
#[repr(C)] | ||
union PtrRepr<T: ?Sized> { | ||
const_ptr: *const T, | ||
mut_ptr: *mut T, | ||
components: PtrComponents<T>, | ||
//~^ ERROR the trait bound | ||
} | ||
|
||
#[repr(C)] | ||
struct PtrComponents<T: Pointee + ?Sized> { | ||
data_address: *const (), | ||
metadata: <T as Pointee>::Metadata, | ||
} | ||
|
||
|
||
|
||
pub trait Pointee { | ||
type Metadata; | ||
} | ||
|
||
fn main() {} |
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,29 @@ | ||
error[E0277]: the trait bound `T: Pointee` is not satisfied in `PtrComponents<T>` | ||
--> $DIR/issue-81199.rs:5:17 | ||
| | ||
LL | components: PtrComponents<T>, | ||
| ^^^^^^^^^^^^^^^^ within `PtrComponents<T>`, the trait `Pointee` is not implemented for `T` | ||
| | ||
note: required because it appears within the type `PtrComponents<T>` | ||
--> $DIR/issue-81199.rs:10:8 | ||
| | ||
LL | struct PtrComponents<T: Pointee + ?Sized> { | ||
| ^^^^^^^^^^^^^ | ||
= note: no field of a union may have a dynamically sized type | ||
= help: change the field's type to have a statically known size | ||
help: consider further restricting this bound | ||
| | ||
LL | union PtrRepr<T: ?Sized + Pointee> { | ||
| +++++++++ | ||
help: borrowed types always have a statically known size | ||
| | ||
LL | components: &PtrComponents<T>, | ||
| + | ||
help: the `Box` type always has a statically known size and allocates its contents in the heap | ||
| | ||
LL | components: Box<PtrComponents<T>>, | ||
| ++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |