You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if a_offset < a_info.size && b_offset < b_info.size{
398
369
0
370
+
}else{
371
+
// Otherwise, conservatively say we don't know.
372
+
// There are some cases we could still return `0` for, e.g.
373
+
// if the pointers being equal would require their statics to overlap
374
+
// one or more bytes, but for simplicity we currently only check
375
+
// strictly in-bounds pointers.
376
+
2
399
377
}
400
-
}else{
401
-
// Even if one of them is a static, as per https://doc.rust-lang.org/nightly/reference/items/static-items.html#r-items.static.storage-disjointness
402
-
// immutable statics can overlap with other kinds of allocations sometimes.
403
-
// FIXME: We could be more decisive for (non-zero-sized) mutable statics,
404
-
// which cannot overlap with other kinds of allocations.
405
-
// `GlobalAlloc::{Memory, Function, Vtable}` can at least be deduplicated with
406
-
// the same kind, so comparing two of the same kind of those should return 2.
407
-
// `GlobalAlloc::TypeId` exists mostly to prevent consteval from comparing
408
-
// `TypeId`s, so comparing two of those should always return 2.
409
-
// FIXME: Can we determine any other cases?
410
-
2
411
378
}
379
+
}else{
380
+
// All other cases we conservatively say we don't know.
381
+
//
382
+
// For comparing statics to non-statics, as per https://doc.rust-lang.org/nightly/reference/items/static-items.html#r-items.static.storage-disjointness
383
+
// immutable statics can overlap with other kinds of allocations sometimes.
384
+
//
385
+
// FIXME: We could be more decisive for (non-zero-sized) mutable statics,
386
+
// which cannot overlap with other kinds of allocations.
387
+
//
388
+
// Functions and vtables can be duplicated and deduplicated, so we
389
+
// cannot be sure of runtime equality of pointers to the same one, or the
390
+
// runtime inequality of pointers to different ones (see e.g. #73722),
391
+
// so comparing those should return 2, whether they are the same allocation
392
+
// or not.
393
+
//
394
+
// `GlobalAlloc::TypeId` exists mostly to prevent consteval from comparing
395
+
// `TypeId`s, so comparing those should always return 2, whether they are the
396
+
// same allocation or not.
397
+
//
398
+
// FIXME: We could revisit comparing pointers into the same
399
+
// `GlobalAlloc::Memory` once https://github.com/rust-lang/rust/issues/128775
400
+
// is fixed (but they can be deduplicated, so comparing pointers into different
0 commit comments