Auto merge of #81905 - Dylan-DPC:rollup-mxpz1j7, r=Dylan-DPC
Rollup of 11 pull requests Successful merges: - #72209 (Add checking for no_mangle to unsafe_code lint) - #80732 (Allow Trait inheritance with cycles on associated types take 2) - #81697 (Add "every" as a doc alias for "all".) - #81826 (Prefer match over combinators to make some Box methods inlineable) - #81834 (Resolve typedef in HashMap lldb pretty-printer only if possible) - #81841 ([rustbuild] Output rustdoc-json-types docs ) - #81849 (Expand the docs for ops::ControlFlow a bit) - #81876 (parser: Fix panic in 'const impl' recovery) - #81882 (⬆️ rust-analyzer) - #81888 (Fix pretty printer macro_rules with semicolon.) - #81896 (Remove outdated comment in windows' mutex.rs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
f4008fe949
48 changed files with 920 additions and 183 deletions
|
@ -390,7 +390,12 @@ impl<T, A: Allocator> Box<T, A> {
|
|||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn new_uninit_in(alloc: A) -> Box<mem::MaybeUninit<T>, A> {
|
||||
let layout = Layout::new::<mem::MaybeUninit<T>>();
|
||||
Box::try_new_uninit_in(alloc).unwrap_or_else(|_| handle_alloc_error(layout))
|
||||
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
|
||||
// That would make code size bigger.
|
||||
match Box::try_new_uninit_in(alloc) {
|
||||
Ok(m) => m,
|
||||
Err(_) => handle_alloc_error(layout),
|
||||
}
|
||||
}
|
||||
|
||||
/// Constructs a new box with uninitialized contents in the provided allocator,
|
||||
|
@ -447,7 +452,12 @@ impl<T, A: Allocator> Box<T, A> {
|
|||
// #[unstable(feature = "new_uninit", issue = "63291")]
|
||||
pub fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A> {
|
||||
let layout = Layout::new::<mem::MaybeUninit<T>>();
|
||||
Box::try_new_zeroed_in(alloc).unwrap_or_else(|_| handle_alloc_error(layout))
|
||||
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
|
||||
// That would make code size bigger.
|
||||
match Box::try_new_zeroed_in(alloc) {
|
||||
Ok(m) => m,
|
||||
Err(_) => handle_alloc_error(layout),
|
||||
}
|
||||
}
|
||||
|
||||
/// Constructs a new `Box` with uninitialized contents, with the memory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue