Use u64 instead of usize in ElementId (#29493)

Truncation to a 32 bit `usize` could cause two distinct IDs to be
considered the same element.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-04-26 20:31:25 -06:00 committed by GitHub
parent bb7a5b13df
commit 60ec55b179
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 25 additions and 22 deletions

View file

@ -1,5 +1,4 @@
use std::hash::{Hash, Hasher};
use std::usize;
use std::{ops::Range, path::Path, sync::Arc};
use collections::HashSet;
@ -85,7 +84,7 @@ impl AgentContext {
/// ID created at time of context add, for use in ElementId. This is not the stable identity of a
/// context, instead that's handled by the `PartialEq` and `Hash` impls of `AgentContextKey`.
#[derive(Debug, Copy, Clone)]
pub struct ContextId(usize);
pub struct ContextId(u64);
impl ContextId {
pub fn zero() -> Self {
@ -93,7 +92,7 @@ impl ContextId {
}
fn for_lookup() -> Self {
ContextId(usize::MAX)
ContextId(u64::MAX)
}
pub fn post_inc(&mut self) -> Self {