Update comment about leaking

This commit is contained in:
rodrimati1992 2021-01-31 14:20:04 -03:00 committed by GitHub
parent aa83e2aa04
commit 21c2343d3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,7 +192,7 @@ use crate::ptr;
/// unsafe { addr_of_mut!((*ptr).name).write("Bob".to_string()); } /// unsafe { addr_of_mut!((*ptr).name).write("Bob".to_string()); }
/// ///
/// // Initializing the `list` field /// // Initializing the `list` field
/// // If there was a panic here, then the `String` in the `name` field would be leaked. /// // If there is a panic here, then the `String` in the `name` field leaks.
/// unsafe { addr_of_mut!((*ptr).list).write(vec![0, 1, 2]); } /// unsafe { addr_of_mut!((*ptr).list).write(vec![0, 1, 2]); }
/// ///
/// // All the fields are initialized, so we call `assume_init` to get an initialized Foo. /// // All the fields are initialized, so we call `assume_init` to get an initialized Foo.