-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix example in transmute; add safety requirement to Vec::from_raw_parts #44536
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me 👍
thanks @Havvy
src/libcore/intrinsics.rs
Outdated
/// // the original inner type (`&i32`) to the converted inner type | ||
/// // (`Option<&i32>`), so read the nomicon pages linked above. | ||
/// let v_from_raw = unsafe { | ||
/// Vec::from_raw_parts(v_orig.as_mut_ptr(), | ||
/// Vec::from_raw_parts(v_orig.as_mut_ptr() as *mut Option<&T>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean as *mut Option<&i32>
here?
[01:05:15] ---- intrinsics.rs - intrinsics::transmute (line 837) stdout ----
[01:05:15] error[E0412]: cannot find type `T` in this scope
[01:05:15] --> intrinsics.rs:29:61
[01:05:15] |
[01:05:15] 29 | Vec::from_raw_parts(v_orig.as_mut_ptr() as *mut Option<&T>,
[01:05:15] | ^ not found in this scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ fixed
e069039
to
1d04254
Compare
1d04254
to
9dd2ee1
Compare
@bors: r+ rollup thanks! |
📌 Commit 9dd2ee1 has been approved by |
Fix example in transmute; add safety requirement to Vec::from_raw_parts This fixes the second bullet point on rust-lang#44281 and also removes some incorrect information.
Fix example in transmute; add safety requirement to Vec::from_raw_parts This fixes the second bullet point on rust-lang#44281 and also removes some incorrect information.
Fix example in transmute; add safety requirement to Vec::from_raw_parts This fixes the second bullet point on rust-lang#44281 and also removes some incorrect information.
This fixes the second bullet point on #44281 and also removes some incorrect information.