Skip to content

Commit ffd60a5

Browse files
committed
---
yaml --- r: 233201 b: refs/heads/beta c: 47041fe h: refs/heads/master i: 233199: b054cbb v: v3
1 parent e493dc5 commit ffd60a5

File tree

7 files changed

+15
-51
lines changed

7 files changed

+15
-51
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 22ec5f4af7b5a85ad375d672ed727571b49f3cad
26+
refs/heads/beta: 47041fe28920326807b29c1246ca9712e184f885
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/libcollections/slice.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ pub use core::slice::{IntSliceExt, SplitMut, ChunksMut, Split};
109109
pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
110110
pub use core::slice::{bytes, mut_ref_slice, ref_slice};
111111
pub use core::slice::{from_raw_parts, from_raw_parts_mut};
112-
pub use core::slice::{transmute, transmute_mut};
113112

114113
////////////////////////////////////////////////////////////////////////////////
115114
// Basic slice extension methods

branches/beta/src/libcore/slice.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,8 +1455,7 @@ fn check_types<T,U>() {
14551455
/// This functions panics if the above preconditions about the types are not
14561456
/// met.
14571457
#[inline]
1458-
#[unstable(feature = "slice_transmute", reason = "recent API addition")]
1459-
pub unsafe fn transmute<T,U>(slice: &[T]) -> &[U] {
1458+
unsafe fn transmute<T,U>(slice: &[T]) -> &[U] {
14601459
check_types::<T,U>();
14611460
from_raw_parts(slice.as_ptr() as *const U, slice.len())
14621461
}
@@ -1466,8 +1465,7 @@ pub unsafe fn transmute<T,U>(slice: &[T]) -> &[U] {
14661465
///
14671466
/// Equivalent of `slice::transmute` for mutable slices.
14681467
#[inline]
1469-
#[unstable(feature = "slice_transmute", reason = "recent API addition")]
1470-
pub unsafe fn transmute_mut<T,U>(slice: &mut [T]) -> &mut [U] {
1468+
unsafe fn transmute_mut<T,U>(slice: &mut [T]) -> &mut [U] {
14711469
check_types::<T,U>();
14721470
from_raw_parts_mut(slice.as_mut_ptr() as *mut U, slice.len())
14731471
}

branches/beta/src/librustc_trans/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2626
html_root_url = "http://doc.rust-lang.org/nightly/")]
2727

28-
#![cfg_attr(not(stage0), feature(slice_transmute))]
2928
#![feature(box_patterns)]
3029
#![feature(box_syntax)]
3130
#![feature(const_fn)]

branches/beta/src/librustc_trans/trans/type_.rs

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ impl Type {
5959
}).expect("non-UTF8 type description from LLVM")
6060
}
6161

62+
pub fn to_ref_slice(slice: &[Type]) -> &[TypeRef] {
63+
unsafe { mem::transmute(slice) }
64+
}
65+
6266
pub fn void(ccx: &CrateContext) -> Type {
6367
ty!(llvm::LLVMVoidTypeInContext(ccx.llcx()))
6468
}
@@ -151,45 +155,20 @@ impl Type {
151155
}
152156
}
153157

154-
#[cfg(stage0)]
155-
pub fn func(args: &[Type], ret: &Type) -> Type {
156-
let vec : &[TypeRef] = unsafe { mem::transmute(args) };
157-
ty!(llvm::LLVMFunctionType(ret.to_ref(), vec.as_ptr(),
158-
args.len() as c_uint, False))
159-
}
160-
161-
#[cfg(not(stage0))]
162158
pub fn func(args: &[Type], ret: &Type) -> Type {
163-
let vec: &[TypeRef] = unsafe { slice::transmute(args) };
164-
ty!(llvm::LLVMFunctionType(ret.to_ref(), vec.as_ptr(),
159+
let slice: &[TypeRef] = Type::to_ref_slice(args);
160+
ty!(llvm::LLVMFunctionType(ret.to_ref(), slice.as_ptr(),
165161
args.len() as c_uint, False))
166162
}
167163

168-
#[cfg(stage0)]
169164
pub fn variadic_func(args: &[Type], ret: &Type) -> Type {
170-
let vec : &[TypeRef] = unsafe { mem::transmute(args) };
171-
ty!(llvm::LLVMFunctionType(ret.to_ref(), vec.as_ptr(),
165+
let slice: &[TypeRef] = Type::to_ref_slice(args);
166+
ty!(llvm::LLVMFunctionType(ret.to_ref(), slice.as_ptr(),
172167
args.len() as c_uint, True))
173168
}
174169

175-
#[cfg(not(stage0))]
176-
pub fn variadic_func(args: &[Type], ret: &Type) -> Type {
177-
let vec: &[TypeRef] = unsafe { slice::transmute(args) };
178-
ty!(llvm::LLVMFunctionType(ret.to_ref(), vec.as_ptr(),
179-
args.len() as c_uint, True))
180-
}
181-
182-
#[cfg(stage0)]
183-
pub fn struct_(ccx: &CrateContext, els: &[Type], packed: bool) -> Type {
184-
let els : &[TypeRef] = unsafe { mem::transmute(els) };
185-
ty!(llvm::LLVMStructTypeInContext(ccx.llcx(), els.as_ptr(),
186-
els.len() as c_uint,
187-
packed as Bool))
188-
}
189-
190-
#[cfg(not(stage0))]
191170
pub fn struct_(ccx: &CrateContext, els: &[Type], packed: bool) -> Type {
192-
let els : &[TypeRef] = unsafe { slice::transmute(els) };
171+
let els: &[TypeRef] = Type::to_ref_slice(els);
193172
ty!(llvm::LLVMStructTypeInContext(ccx.llcx(), els.as_ptr(),
194173
els.len() as c_uint,
195174
packed as Bool))
@@ -236,20 +215,10 @@ impl Type {
236215
}
237216
}
238217

239-
#[cfg(stage0)]
240-
pub fn set_struct_body(&mut self, els: &[Type], packed: bool) {
241-
unsafe {
242-
let vec : &[TypeRef] = mem::transmute(els);
243-
llvm::LLVMStructSetBody(self.to_ref(), vec.as_ptr(),
244-
els.len() as c_uint, packed as Bool)
245-
}
246-
}
247-
248-
#[cfg(not(stage0))]
249218
pub fn set_struct_body(&mut self, els: &[Type], packed: bool) {
219+
let slice: &[TypeRef] = Type::to_ref_slice(els);
250220
unsafe {
251-
let vec: &[TypeRef] = slice::transmute(els);
252-
llvm::LLVMStructSetBody(self.to_ref(), vec.as_ptr(),
221+
llvm::LLVMStructSetBody(self.to_ref(), slice.as_ptr(),
253222
els.len() as c_uint, packed as Bool)
254223
}
255224
}

branches/beta/src/libstd/ffi/c_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ impl CStr {
395395
/// > length calculation whenever this method is called.
396396
#[stable(feature = "rust1", since = "1.0.0")]
397397
pub fn to_bytes_with_nul(&self) -> &[u8] {
398-
unsafe { slice::transmute(&self.inner) }
398+
unsafe { mem::transmute(&self.inner) }
399399
}
400400

401401
/// Yields a `&str` slice if the `CStr` contains valid UTF-8.

branches/beta/src/libstd/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@
234234
#![feature(reflect_marker)]
235235
#![feature(slice_bytes)]
236236
#![feature(slice_patterns)]
237-
#![feature(slice_transmute)]
238237
#![feature(staged_api)]
239238
#![feature(str_as_bytes_mut)]
240239
#![feature(str_char)]

0 commit comments

Comments
 (0)