File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: trace:: { Finalize , Trace } ;
2
2
use std:: cell:: { Cell , RefCell } ;
3
3
use std:: mem;
4
- use std:: ptr:: NonNull ;
4
+ use std:: ptr:: { self , NonNull } ;
5
5
6
6
const INITIAL_THRESHOLD : usize = 100 ;
7
7
@@ -119,6 +119,13 @@ impl<T: Trace> GcBox<T> {
119
119
}
120
120
121
121
impl < T : Trace + ?Sized > GcBox < T > {
122
+ /// Returns `true` if the two references refer to the same `GcBox`.
123
+ pub ( crate ) fn ptr_eq ( this : & GcBox < T > , other : & GcBox < T > ) -> bool {
124
+ // Ignore vtables with .header to work around
125
+ // https://github.com/rust-lang/rust/issues/46139
126
+ ptr:: eq ( & this. header , & other. header )
127
+ }
128
+
122
129
/// Marks this `GcBox` and marks through its data.
123
130
pub ( crate ) unsafe fn trace_inner ( & self ) {
124
131
let marked = self . header . marked . get ( ) ;
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ impl<T: Trace> Gc<T> {
90
90
impl < T : Trace + ?Sized > Gc < T > {
91
91
/// Returns `true` if the two `Gc`s point to the same allocation.
92
92
pub fn ptr_eq ( this : & Gc < T > , other : & Gc < T > ) -> bool {
93
- ptr :: eq ( this. inner ( ) , other. inner ( ) )
93
+ GcBox :: ptr_eq ( this. inner ( ) , other. inner ( ) )
94
94
}
95
95
}
96
96
You can’t perform that action at this time.
0 commit comments