From 1885f38ee53993d626d46859b064a49df2e2f5c2 Mon Sep 17 00:00:00 2001 From: The8472 Date: Sat, 10 Oct 2020 01:29:05 +0200 Subject: [PATCH] reserve() was not annotated with free --- library/alloc/src/vec.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs index 587cea565c5de..5ed98a35e2c51 100644 --- a/library/alloc/src/vec.rs +++ b/library/alloc/src/vec.rs @@ -2390,34 +2390,34 @@ impl SpecExtend> for Vec { // // # illustration of some extend scenarios (not exhaustive) // - // == step == == memory == == self == == iter / v == - // 0123456789abcdef0123456789abcdef - // 0---------------1--------------- + // = step == == memory == == self == == iter / v == + // 0123456789abcdef0123456789abcdef + // 0---------------1--------------- // // ## non-empty self, partially consumed iterator // - // [initial] AAAA_-----__BBB___-------------- Vec(0x00, 4, 5) IntoIter(0x0a, 0x0c, 0x0f, 8) - // ³ into_vec AAAA_-----____BBB_-------------- Vec(0x00, 4, 5) Vec(0x0a, 7, 8) - // ² prepend _____-----AAAABBB_-------------- Vec(0x00, 0, 5) Vec(0x0a, 7, 8) - // ⁴ *self = v ----------AAAABBB_-------------- Vec(0x0a, 7, 8) + // [initial] AAAA_-----__BBB___-------------- Vec(0x00, 4, 5) IntoIter(0x0a, 0x0c, 0x0f, 8) + // ³ into_vec AAAA_-----____BBB_-------------- Vec(0x00, 4, 5) Vec(0x0a, 7, 8) + // ² prepend _____-----AAAABBB_-------------- Vec(0x00, 0, 5) Vec(0x0a, 7, 8) + // ⁴ *self = v ----------AAAABBB_-------------- Vec(0x0a, 7, 8) // // ## empty self, partially consumed iterator // - // [initial] ____------__BBBB__-------------- Vec(0x00, 0, 4) IntoIter(0x0a, 0x0c, 0x10, 8) - // ³ into_vec ____------BBBB____-------------- Vec(0x00, 0, 4) Vec(0x0a, 4, 8) - // ⁴ *self = v ----------BBBB____-------------- Vec(0x0a, 4, 8) + // [initial] ____------__BBBB__-------------- Vec(0x00, 0, 4) IntoIter(0x0a, 0x0c, 0x10, 8) + // ³ into_vec ____------BBBB____-------------- Vec(0x00, 0, 4) Vec(0x0a, 4, 8) + // ⁴ *self = v ----------BBBB____-------------- Vec(0x0a, 4, 8) // // ## empty self, pristine iterator // - // [initial] ----------BBBB____-------------- Vec(0x00, 0, 0) IntoIter(0x0a, 0x0a, 0x0e, 8) - // *self = v ----------BBBB____-------------- Vec(0x0a, 4, 8) + // [initial] ----------BBBB____-------------- Vec(0x00, 0, 0) IntoIter(0x0a, 0x0a, 0x0e, 8) + // *self = v ----------BBBB____-------------- Vec(0x0a, 4, 8) // // ## insufficient capacity // - // [initial] AAAAA-----BBBBBB__-------------- Vec(0x00, 5, 5) IntoIter(0x0a, 0x0a, 0x0f, 8) - // ¹² reserve(6) ----------BBBBBB__--AAAAA______- Vec(0x14, 5, 11) IntoIter(0x0a, 0x0a, 0x0f, 8) - // ² ptr:copy_n ----------________--AAAAABBBBBB- Vec(0x14, 11, 11) IntoIter(0x0a, 0x0f, 0x0f, 8) - // ⁴ drop --------------------AAAAABBBBBB- Vec(0x14, 11, 11) + // [initial] AAAAA-----BBBBBB__-------------- Vec(0x00, 5, 5) IntoIter(0x0a, 0x0a, 0x0f, 8) + // ¹²⁴ reserve(6) ----------BBBBBB__--AAAAA______- Vec(0x14, 5, 11) IntoIter(0x0a, 0x0a, 0x0f, 8) + // ² ptr:copy_n ----------________--AAAAABBBBBB- Vec(0x14, 11, 11) IntoIter(0x0a, 0x0f, 0x0f, 8) + // ⁴ drop --------------------AAAAABBBBBB- Vec(0x14, 11, 11) // // ¹ malloc // ² memcpy