Skip to content

Commit 5bf2c55

Browse files
RalfJungNadrieril
andauthored
update comments: inference seems more tricky than temporary lifetimes
Co-authored-by: Nadrieril <Nadrieril@users.noreply.github.com>
1 parent 0b0ac54 commit 5bf2c55

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

library/alloc/src/intrinsics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use crate::boxed::Box;
88
/// Writes `x` into `b`.
99
///
1010
/// This is needed for `vec!`, which can't afford any extra copies of the argument (or else debug
11-
/// builds regress), has to be written fully as a call chain without `let` (or else the temporary
12-
/// lifetimes of the arguments change), and can't use an `unsafe` block as that would then also
11+
/// builds regress), has to be written fully as a call chain without `let` (or else this breaks inference
12+
/// of e.g. unsizing coercions), and can't use an `unsafe` block as that would then also
1313
/// include the user-provided `$x`.
1414
#[rustc_intrinsic]
1515
pub fn write_box_via_move<T>(b: Box<MaybeUninit<T>>, x: T) -> Box<MaybeUninit<T>>;

library/alloc/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ macro_rules! vec {
5050
// Using `write_box_via_move` produces a dramatic improvement in stack usage for unoptimized
5151
// programs using this code path to construct large Vecs. We can't use `write_via_move`
5252
// because this entire invocation has to remain a call chain without `let` bindings, or else
53-
// the temporary scopes change and things break (see `vec-macro-rvalue-scope` test).
53+
// inference changes and things break (see `vec-macro-rvalue-scope` and `autoderef-vec-box-fn-36786` tests).
5454
// This function isn't actually safe but the way we use it here is. We can't use an
5555
// unsafe block as that would also wrap `$x`.
5656
$crate::boxed::box_uninit_array_into_vec_unsafe(

0 commit comments

Comments
 (0)