Skip to content

Rollup of 10 pull requests #64562

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

Merged
merged 21 commits into from
Sep 18, 2019
Merged
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
cfcc5c2
Updated RELEASES.md for 1.38.0
XAMPPRocky Sep 8, 2019
7f0637d
Shrink `SubregionOrigin`.
nnethercote Sep 12, 2019
62e86b4
Fix inconsistent link formatting
pickfire Sep 16, 2019
388cd5d
avoid duplicate issues for Miri build failures
RalfJung Sep 16, 2019
02c1b89
Fix failure note `to_str` implementation
afnanenayet Sep 13, 2019
daafeb3
document Miri error categories
RalfJung Sep 17, 2019
522f4e1
Add an example to Pin::as_mut
taiki-e Sep 17, 2019
a22e9ee
Update src/libcore/pin.rs
taiki-e Sep 17, 2019
0de9485
Get rid of special const intrinsic query in favour of `const_eval`
oli-obk Jun 7, 2019
a4dc33b
build-manifest: add some comments
RalfJung Sep 17, 2019
ab6e108
improve Vec example soundness in mem::transmute docs
llogiq Sep 13, 2019
6bbb935
Rollup merge of #61626 - oli-obk:const_eval_intrinsics, r=eddyb
tmandry Sep 17, 2019
20d43d0
Rollup merge of #64283 - XAMPPRocky:master, r=Mark-Simulacrum
tmandry Sep 17, 2019
ec905cf
Rollup merge of #64394 - nnethercote:shrink-SubregionOrigin, r=Mark-S…
tmandry Sep 17, 2019
ffee7bb
Rollup merge of #64429 - afnanenayet:afnan/fix-failure-note-json-leve…
tmandry Sep 17, 2019
d6f2205
Rollup merge of #64436 - llogiq:transmute-docs, r=RalfJung
tmandry Sep 17, 2019
3a1390c
Rollup merge of #64502 - RalfJung:miri-toolstate, r=pietroalbini
tmandry Sep 17, 2019
b544284
Rollup merge of #64505 - pickfire:patch-1, r=Mark-Simulacrum
tmandry Sep 17, 2019
d782f09
Rollup merge of #64529 - taiki-e:docs-pin-as-mut, r=RalfJung
tmandry Sep 17, 2019
f8b6e26
Rollup merge of #64541 - RalfJung:miri-errors, r=oli-obk
tmandry Sep 17, 2019
93d6108
Rollup merge of #64544 - RalfJung:build-manifest, r=pietroalbini
tmandry Sep 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,21 +845,26 @@ extern "rust-intrinsic" {
///
/// ```
/// let store = [0, 1, 2, 3];
/// let mut v_orig = store.iter().collect::<Vec<&i32>>();
/// let v_orig = store.iter().collect::<Vec<&i32>>();
///
/// // clone the vector as we will reuse them later
/// let v_clone = v_orig.clone();
///
/// // Using transmute: this is Undefined Behavior, and a bad idea.
/// // However, it is no-copy.
/// let v_transmuted = unsafe {
/// std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(
/// v_orig.clone())
/// std::mem::transmute::<Vec<&i32>, Vec<Option<&i32>>>(v_clone)
/// };
///
/// let v_clone = v_orig.clone();
///
/// // This is the suggested, safe way.
/// // It does copy the entire vector, though, into a new array.
/// let v_collected = v_orig.clone()
/// .into_iter()
/// .map(|r| Some(r))
/// .collect::<Vec<Option<&i32>>>();
/// let v_collected = v_clone.into_iter()
/// .map(Some)
/// .collect::<Vec<Option<&i32>>>();
///
/// let v_clone = v_orig.clone();
///
/// // The no-copy, unsafe way, still using transmute, but not UB.
/// // This is equivalent to the original, but safer, and reuses the
Expand All @@ -869,11 +874,12 @@ extern "rust-intrinsic" {
/// // 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() as *mut Option<&i32>,
/// v_orig.len(),
/// v_orig.capacity())
/// // Ensure the original vector is not dropped.
/// let mut v_clone = std::mem::ManuallyDrop::new(v_clone);
/// Vec::from_raw_parts(v_clone.as_mut_ptr() as *mut Option<&i32>,
/// v_clone.len(),
/// v_clone.capacity())
/// };
/// std::mem::forget(v_orig);
/// ```
///
/// Implementing `split_at_mut`:
Expand Down