Skip to content

Commit c927f33

Browse files
committed
Expose the new trait and Allocation
1 parent 77b22fc commit c927f33

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

alloc-traits/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ mod local;
2424
mod ref_;
2525

2626
pub use crate::layout::{Layout, NonZeroLayout};
27-
pub use crate::local::{AllocTime, Allocation, LocalAlloc};
27+
pub use crate::local::{AllocTime, LocalAlloc};
28+
#[deprecated="Use the name `LocalAllocation` instead"]
29+
pub use crate::local::Allocation;
30+
pub use crate::local::Allocation as LocalAllocation;
2831
#[allow(deprecated)]
2932
pub use crate::local::Invariant;
33+
pub use crate::ref_::{AllocRef, Allocation as RefAllocation};

alloc-traits/src/ref_.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ impl Allocation {
8080
}
8181
}
8282

83-
/// Note the
83+
/// A reference is an `AllocRef`.
84+
///
85+
/// Note the lifetime of the references is exactly the same as the lifetime of the trait. If the
86+
/// reference outlived the parameter then the returned allocations would not live long enough.
87+
/// Conversely, if the parameter outlived the lifetime then it would not be possible to construct
88+
/// the reference necessary for the trait.
8489
unsafe impl<'rf, T> AllocRef for &'rf T
8590
where T: LocalAlloc<'rf>
8691
{

0 commit comments

Comments
 (0)