example on String::from_raw_parts is correct in-context, but raise Miri error with seemingly sound modification #106593
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
Location
String::from_raw_parts example
Summary
The example is technically correct, however adding
s.reserve(1)
makes Miri complain about an invalid deallocation. From the documentation there is no obvious reason why that is.problematic code
I opened an issue on rust-lang/miri#2751, where @bjorn3 clarified that there is indeed an issue:
They also added:
I tagged this A-docs but the solution may be to actually create a
String::as_mut_ptr
and not update the documentation. An other solution is to describe the issue I experienced and change theManuallyDrop
line to beThe text was updated successfully, but these errors were encountered: