diff options
| author | bors <bors@rust-lang.org> | 2017-11-02 00:06:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-11-02 00:06:16 +0000 |
| commit | d5b69d4670dc5c1e3a095b1112f9496cd84462ab (patch) | |
| tree | 14b237e8b87e303d7d08b9bff996804db3ce4aa7 /src/liballoc | |
| parent | 2be4cc040211a85b17f21e813ff62351ae4de642 (diff) | |
| parent | 1cc88be2ebc67e1f0e7ff57c12dec45ef9abc2ae (diff) | |
| download | rust-d5b69d4670dc5c1e3a095b1112f9496cd84462ab.tar.gz rust-d5b69d4670dc5c1e3a095b1112f9496cd84462ab.zip | |
Auto merge of #45306 - whitequark:ref_slice, r=alexcrichton
Bring back slice::ref_slice as slice::from_ref. These functions were deprecated and removed in 1.5, but such simple functionality shouldn't require using unsafe code, and it isn't cluttering libstd too much. The original removal was quite contentious (see #27774), since then we've had precedent for including such nuggets of functionality (see rust-lang/rfcs#1789), and @nikomatsakis has provided a lot of use cases in https://github.com/rust-lang/rfcs/pull/1789#issuecomment-314640034. Hence this PR. I'm not too sure what to do with stability, feel free to correct me. It seems pointless to go through stabilization for these functions though. cc @aturon
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/lib.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/slice.rs | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 0cbfc9e9dac..f654a6b5ba4 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -93,6 +93,7 @@ #![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(fmt_internals)] +#![feature(from_ref)] #![feature(fundamental)] #![feature(fused)] #![feature(generic_param_attrs)] diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 2045d5ddd97..0c5fec2cf74 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -119,6 +119,8 @@ pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut}; pub use core::slice::{RSplit, RSplitMut}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::slice::{from_raw_parts, from_raw_parts_mut}; +#[unstable(feature = "from_ref", issue = "45703")] +pub use core::slice::{from_ref, from_ref_mut}; #[unstable(feature = "slice_get_slice", issue = "35729")] pub use core::slice::SliceIndex; |
