about summary refs log tree commit diff
path: root/library/alloc/src/boxed.rs
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-04-09 05:58:40 +0200
committerGitHub <noreply@github.com>2022-04-09 05:58:40 +0200
commitee8cea8ac48df14c9089720823910a5a8fddbb2c (patch)
treea00af7323be29284d7c58198a69d619d0023d2df /library/alloc/src/boxed.rs
parent340f6491bed3525acfabbdbd1545b6aee2fca62b (diff)
parenta87a0d089e793903844ef40851deae48c039f8bb (diff)
Rollup merge of #90066 - yaahc:thinbox, r=joshtriplett
Add new ThinBox type for 1 stack pointer wide heap allocated trait objects

**Zulip Thread**: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/ThinBox

Based on https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs

Tracking Issue: https://github.com/rust-lang/rust/issues/92791

Usage Trial: https://github.com/yaahc/pgx/pull/1/files

## TODO

- [x] make sure to test with #[repr(align(1024))] structs etc
Diffstat (limited to 'library/alloc/src/boxed.rs')
-rw-r--r--library/alloc/src/boxed.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs
index a56d4de03cd..e6faf1df3a8 100644
--- a/library/alloc/src/boxed.rs
+++ b/library/alloc/src/boxed.rs
@@ -163,6 +163,11 @@ use crate::str::from_boxed_utf8_unchecked;
 #[cfg(not(no_global_oom_handling))]
 use crate::vec::Vec;
 
+#[unstable(feature = "thin_box", issue = "92791")]
+pub use thin::ThinBox;
+
+mod thin;
+
 /// A pointer type for heap allocation.
 ///
 /// See the [module-level documentation](../../std/boxed/index.html) for more.