@@ -57,31 +57,15 @@ struct VerifierClosure {
57
57
impl Eq for VerifierClosure { }
58
58
impl PartialEq for VerifierClosure {
59
59
fn eq ( & self , other : & Self ) -> bool {
60
- // WARNING:
60
+ // The libs team has resolved to update Arc::ptr_eq so that it doesn't compare
61
+ // meta data for the wrapped value (such as a dyn trait vtable):
62
+ // https://github.com/rust-lang/rust/issues/103763
61
63
//
62
- // `Arc::ptr_eq(&self.func, &other.func)` is effectively implemented as:
63
- //
64
- // `Arc::as_ptr(&arc_a) == Arc::as_ptr(&arc_b)`
65
- //
66
- // which will notably result in comparing the vtable pointer for (wide) trait object pointers
67
- // and does _not_ match the API documentation that states:
68
- //
69
- // > Returns true if the two Arcs point to the same allocation (in a vein similar to ptr::eq).
70
- //
71
- // (which is what we need here)
72
- //
73
- // See: https://github.com/rust-lang/rust/pull/80505
74
- //
75
- // To ensure we are comparing the data pointer component of any wide pointer then we
76
- // additionally cast `Arc::as_ptr(&arc)` to a thin pointer to discard the vtable
77
- //
78
- // This avoid getting a `clippy::vtable_address_comparisons` error
79
- //
80
- // Ref: https://github.com/rust-lang/rust-clippy/issues/6524
81
-
82
- let a = Arc :: as_ptr ( & self . func ) as * const u8 ;
83
- let b = Arc :: as_ptr ( & other. func ) as * const u8 ;
84
- std:: ptr:: eq ( a, b)
64
+ // In the meantime we can silence this clippy suggestion since the vtable is
65
+ // benign in this case anyway:
66
+ // https://github.com/rust-lang/rust-clippy/issues/6524
67
+ #[ allow( clippy:: vtable_address_comparisons) ]
68
+ Arc :: ptr_eq ( & self . func , & other. func )
85
69
}
86
70
}
87
71
impl std:: fmt:: Debug for VerifierClosure {
0 commit comments