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.
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.