Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
56ebd57
Remove meaningless comments in src/test
sd234678 Aug 9, 2019
b7b4c3a
Update stderr files with --bless
sd234678 Aug 9, 2019
b21ee49
Bless tests with --compare-mode=nll
sd234678 Aug 16, 2019
1613fda
Add Rc::get_mut_unchecked, Arc::get_mut_unchecked
SimonSapin Jul 6, 2019
7b02b9f
Add new_uninit and assume_init on Box, Rc, and Arc
SimonSapin Jul 6, 2019
bde1924
Add new_uninit_slice and assume_init on Box, Rc, and Arc of [T]
SimonSapin Jul 6, 2019
170d933
Move constructors of boxed/rc’ed slices to matching `impl` blocks
SimonSapin Jul 6, 2019
4eeb623
Fix intra-rustdoc links
SimonSapin Jul 6, 2019
dab967a
Use `alloc::Global` in `Box::new_uninit`
SimonSapin Jul 16, 2019
1141136
Use ManuallyDrop instead of mem::forget
SimonSapin Jul 16, 2019
78264f5
Add tracking issue numbers
SimonSapin Aug 5, 2019
ae1e201
Add a comment on the usage of Layout::new::<RcBox<()>>()
SimonSapin Aug 5, 2019
810dfd7
Reuse more internal Rc and Arc methods
SimonSapin Aug 16, 2019
7a641f7
Relax the safety condition for get_mut_unchecked
SimonSapin Aug 16, 2019
5f7716d
invalid_value: factor finding dangerous inits into separate function
RalfJung Aug 17, 2019
25d8a0a
warn about uninit bools and chars
RalfJung Aug 17, 2019
0d242b3
invalid_value: warn for types with custom valid range
RalfJung Aug 17, 2019
9ab1d5c
multi-variant enums are tricky
RalfJung Aug 17, 2019
a9efa73
invalid_value: also detect transmute-from-0 (seen in the wild)
RalfJung Aug 17, 2019
4821663
Full stop
RalfJung Aug 17, 2019
689c210
fix tests
RalfJung Aug 17, 2019
f19087d
drift leftward
RalfJung Aug 17, 2019
ba03283
Doc nits
SimonSapin Aug 17, 2019
72d9fe8
less &
RalfJung Aug 17, 2019
b79ce1b
Rename private helper method allocate_for_unsized to allocate_for_layout
SimonSapin Aug 17, 2019
d479ff2
resolve: Properly integrate derives and `macro_rules` scopes
petrochenkov Aug 17, 2019
1064d41
resolve/expand: Rename some things for clarity
petrochenkov Aug 17, 2019
a7c34f1
fix typos
Dante-Broggi Aug 17, 2019
9bd7083
Doc nit
SimonSapin Aug 17, 2019
3288be5
test in a way that works even with musl
RalfJung Aug 17, 2019
a3b6e8e
Rollup merge of #62451 - SimonSapin:new_uninit, r=RalfJung
Centril Aug 17, 2019
a396434
Rollup merge of #63487 - sd234678:remove-meaningless-comments-in-src/…
Centril Aug 17, 2019
a00b4f1
Rollup merge of #63657 - RalfJung:invalid_value, r=Centril
Centril Aug 17, 2019
b60f245
Rollup merge of #63667 - petrochenkov:deriveholders, r=matthewjasper
Centril Aug 17, 2019
4ec9703
Rollup merge of #63669 - Dante-Broggi:patch-1, r=jonas-schievink
Centril Aug 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a comment on the usage of Layout::new::<RcBox<()>>()
  • Loading branch information
SimonSapin committed Aug 16, 2019
commit ae1e201a0cd37a48bd3dabf1c643ccd5f53f7680
2 changes: 2 additions & 0 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ impl<T> Rc<[T]> {
#[unstable(feature = "new_uninit", issue = "63291")]
pub fn new_uninit_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]> {
let data_layout = Layout::array::<mem::MaybeUninit<T>>(len).unwrap();
// This relies on `value` being the last field of `RcBox` in memory,
// so that the layout of `RcBox<T>` is the same as that of `RcBox<()>` followed by `T`.
let (layout, offset) = Layout::new::<RcBox<()>>().extend(data_layout).unwrap();
unsafe {
let allocated_ptr = Global.alloc(layout)
Expand Down
2 changes: 2 additions & 0 deletions src/liballoc/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ impl<T> Arc<[T]> {
#[unstable(feature = "new_uninit", issue = "63291")]
pub fn new_uninit_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
let data_layout = Layout::array::<mem::MaybeUninit<T>>(len).unwrap();
// This relies on `value` being the last field of `RcBox` in memory,
// so that the layout of `RcBox<T>` is the same as that of `RcBox<()>` followed by `T`.
let (layout, offset) = Layout::new::<ArcInner<()>>().extend(data_layout).unwrap();
unsafe {
let allocated_ptr = Global.alloc(layout)
Expand Down