Skip to content

Commit 103d6ac

Browse files
committed
Ignore fat pointer vtables for Gc::ptr_eq
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>
1 parent 4c6fc31 commit 103d6ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gc/src/gc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<T: Trace> GcBox<T> {
121121
impl<T: Trace + ?Sized> GcBox<T> {
122122
/// Returns `true` if the two references refer to the same `GcBox`.
123123
pub(crate) fn ptr_eq(this: &GcBox<T>, other: &GcBox<T>) -> bool {
124-
// Ignore vtables with .header to work around
124+
// Use .header to ignore fat pointer vtables, to work around
125125
// https://github.com/rust-lang/rust/issues/46139
126126
ptr::eq(&this.header, &other.header)
127127
}

0 commit comments

Comments
 (0)