diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index b151842458d35..7c0faf0659a2c 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1062,7 +1062,7 @@ impl String { /// let mut output = String::new(); /// /// // Pre-reserve the memory, exiting if we can't - /// output.try_reserve(data.len())?; + /// output.try_reserve_exact(data.len())?; /// /// // Now we know this can't OOM in the middle of our complex work /// output.push_str(data);