Skip to content

Commit

Permalink
Ignore fat pointer vtables for Gc::ptr_eq
Browse files Browse the repository at this point in the history
Rust doesn’t guarantee that fat pointer comparison works as expected
due to duplicated vtables:

rust-lang/rust#46139

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Loading branch information
andersk committed Dec 30, 2020
1 parent 4c6fc31 commit 103d6ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gc/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl<T: Trace> GcBox<T> {
impl<T: Trace + ?Sized> GcBox<T> {
/// Returns `true` if the two references refer to the same `GcBox`.
pub(crate) fn ptr_eq(this: &GcBox<T>, other: &GcBox<T>) -> bool {
// Ignore vtables with .header to work around
// Use .header to ignore fat pointer vtables, to work around
// https://github.com/rust-lang/rust/issues/46139
ptr::eq(&this.header, &other.header)
}
Expand Down

0 comments on commit 103d6ac

Please sign in to comment.