Clarify/Correct example of a dangling pointer in FFI/Passing-Strings #313
Labels
C-amendment
Category: Amendments to existing content
C-needs discussion
Area: Something that is not clear to everyone if it fixes something/adds valuable content
C-question
Category: Further information is requested
Hi.
I'm pretty new to Rust, so I may be missing something. But anyway :-)
So, ffi/passing-strings has this example:
I wonder, how can the pointer be dangling here, isn't the temporary that it's pointing to supposed to live until the end of the entire statement? I.e. the call to seterr should be completed before it's dropped.
Also, there was a review comment that suggested rewording this example completely, so that it would instead discourage constructing a temporary and obtaining a pointer to it in a let-statement. It seems that the comment's author also considered the example to be incorrect.
The text was updated successfully, but these errors were encountered: