Skip to content

Commit e82d77c

Browse files
committed
Additional conditional compilation fix
1 parent 534d94b commit e82d77c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

wgpu-core/src/id.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::{storage::StorageItem, Epoch, Index};
2-
use alloc::sync::Arc;
1+
use crate::{Epoch, Index};
32
use core::{
43
cmp::Ordering,
54
fmt::{self, Debug},
@@ -169,16 +168,16 @@ impl<T: Marker> Hash for PointerId<T> {
169168
}
170169

171170
#[cfg(feature = "serde")]
172-
impl<T: StorageItem> From<&Arc<T>> for PointerId<T::Marker> {
173-
fn from(arc: &Arc<T>) -> Self {
171+
impl<T: crate::storage::StorageItem> From<&alloc::sync::Arc<T>> for PointerId<T::Marker> {
172+
fn from(arc: &alloc::sync::Arc<T>) -> Self {
174173
// Since the memory representation of `Arc<T>` is just a pointer to
175174
// `ArcInner<T>`, it would be nice to use that pointer as the trace ID,
176175
// since many `into_trace` implementations would then be no-ops at
177176
// runtime. However, `Arc::as_ptr` returns a pointer to the contained
178177
// data, not to the `ArcInner`. The `ArcInner` stores the reference
179178
// counts before the data, so the machine code for this conversion has
180179
// to add an offset to the pointer.
181-
PointerId::PointerId(Arc::as_ptr(arc) as usize, PhantomData)
180+
PointerId::PointerId(alloc::sync::Arc::as_ptr(arc) as usize, PhantomData)
182181
}
183182
}
184183

0 commit comments

Comments
 (0)