diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2022-08-24 18:29:45 +0200 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2022-08-24 18:29:45 +0200 |
| commit | ad1d99324942c2c2749a0744c184271fb1e12d76 (patch) | |
| tree | f6cbf84cdc7c3e2764ca0bb93a559b36f3aff560 | |
| parent | ee8f8bfacd171375b3961ae2bafe0547bffccfaa (diff) | |
| parent | 5a9b11648ff069954b27f07e8fc7debdd013b8d8 (diff) | |
| download | rust-ad1d99324942c2c2749a0744c184271fb1e12d76.tar.gz rust-ad1d99324942c2c2749a0744c184271fb1e12d76.zip | |
Sync from rust 4a24f08ba43166cfee86d868b3fe8612aec6faca
| -rw-r--r-- | example/alloc_system.rs | 2 | ||||
| -rw-r--r-- | src/unsize.rs | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/example/alloc_system.rs b/example/alloc_system.rs index cf95c89bc31..50261c19397 100644 --- a/example/alloc_system.rs +++ b/example/alloc_system.rs @@ -94,7 +94,7 @@ mod platform { struct Header(*mut u8); const HEAP_ZERO_MEMORY: DWORD = 0x00000008; unsafe fn get_header<'a>(ptr: *mut u8) -> &'a mut Header { - &mut *(ptr as *mut Header).offset(-1) + &mut *(ptr as *mut Header).sub(1) } unsafe fn align_ptr(ptr: *mut u8, align: usize) -> *mut u8 { let aligned = ptr.add(align - (ptr as usize & (align - 1))); diff --git a/src/unsize.rs b/src/unsize.rs index 052ca0a082b..dd9d891ddbd 100644 --- a/src/unsize.rs +++ b/src/unsize.rs @@ -29,6 +29,7 @@ pub(crate) fn unsized_info<'tcx>( let old_info = old_info.expect("unsized_info: missing old info for trait upcasting coercion"); if data_a.principal_def_id() == data_b.principal_def_id() { + // A NOP cast that doesn't actually change anything, should be allowed even with invalid vtables. return old_info; } |
