Skip to content

Commit 7691046

Browse files
committed
---
yaml --- r: 60106 b: refs/heads/master c: 0c02d0f h: refs/heads/master v: v3
1 parent a9d2b05 commit 7691046

File tree

12 files changed

+31
-201
lines changed

12 files changed

+31
-201
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5a65f51d666855d7685850808cc06e49c3d21c72
2+
refs/heads/master: 0c02d0f92ecabb9486482c3e4d660e736346803b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/src/libcore/iter.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ breaking out of iteration. The adaptors in the module work with any such iterato
1717
tied to specific traits. For example:
1818
1919
~~~~
20-
use core::iter::iter_to_vec;
21-
println(iter_to_vec(|f| uint::range(0, 20, f)).to_str());
20+
println(iter::to_vec(|f| uint::range(0, 20, f)).to_str());
2221
~~~~
2322
2423
An external iterator object implementing the interface in the `iterator` module can be used as an
@@ -55,12 +54,12 @@ pub trait Times {
5554
*
5655
* ~~~
5756
* let xs = ~[1, 2, 3];
58-
* let ys = do iter_to_vec |f| { xs.each(|x| f(*x)) };
57+
* let ys = do iter::to_vec |f| { xs.each(|x| f(*x)) };
5958
* assert_eq!(xs, ys);
6059
* ~~~
6160
*/
6261
#[inline(always)]
63-
pub fn iter_to_vec<T>(iter: &fn(f: &fn(T) -> bool)) -> ~[T] {
62+
pub fn to_vec<T>(iter: &fn(f: &fn(T) -> bool)) -> ~[T] {
6463
let mut v = ~[];
6564
for iter |x| { v.push(x) }
6665
v
@@ -185,9 +184,9 @@ mod tests {
185184
use prelude::*;
186185

187186
#[test]
188-
fn test_iter_to_vec() {
187+
fn test_to_vec() {
189188
let xs = ~[1, 2, 3];
190-
let ys = do iter_to_vec |f| { xs.each(|x| f(*x)) };
189+
let ys = do to_vec |f| { xs.each(|x| f(*x)) };
191190
assert_eq!(xs, ys);
192191
}
193192

trunk/src/libcore/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ mod tests {
378378
#[test]
379379
fn test_counter_to_vec() {
380380
let mut it = Counter::new(0, 5).take(10);
381-
let xs = iter::iter_to_vec(|f| it.advance(f));
381+
let xs = iter::to_vec(|f| it.advance(f));
382382
assert_eq!(xs, ~[0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
383383
}
384384

trunk/src/libcore/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ pub mod weak_task;
3030
pub mod exchange_alloc;
3131
#[path = "unstable/intrinsics.rs"]
3232
pub mod intrinsics;
33-
#[path = "unstable/simd.rs"]
34-
pub mod simd;
3533
#[path = "unstable/extfmt.rs"]
3634
pub mod extfmt;
3735
#[path = "unstable/lang.rs"]

trunk/src/libcore/unstable/simd.rs

Lines changed: 0 additions & 43 deletions
This file was deleted.

trunk/src/librustc/middle/trans/build.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -963,28 +963,20 @@ pub fn ExtractElement(cx: block, VecVal: ValueRef, Index: ValueRef) ->
963963
}
964964
965965
pub fn InsertElement(cx: block, VecVal: ValueRef, EltVal: ValueRef,
966-
Index: ValueRef) -> ValueRef {
966+
Index: ValueRef) {
967967
unsafe {
968-
if cx.unreachable { return llvm::LLVMGetUndef(T_nil()); }
968+
if cx.unreachable { return; }
969969
count_insn(cx, "insertelement");
970-
llvm::LLVMBuildInsertElement(B(cx), VecVal, EltVal, Index, noname())
970+
llvm::LLVMBuildInsertElement(B(cx), VecVal, EltVal, Index, noname());
971971
}
972972
}
973973
974974
pub fn ShuffleVector(cx: block, V1: ValueRef, V2: ValueRef,
975-
Mask: ValueRef) -> ValueRef {
975+
Mask: ValueRef) {
976976
unsafe {
977-
if cx.unreachable { return llvm::LLVMGetUndef(T_nil()); }
977+
if cx.unreachable { return; }
978978
count_insn(cx, "shufflevector");
979-
llvm::LLVMBuildShuffleVector(B(cx), V1, V2, Mask, noname())
980-
}
981-
}
982-
983-
pub fn VectorSplat(cx: block, NumElts: uint, EltVal: ValueRef) -> ValueRef {
984-
unsafe {
985-
let Undef = llvm::LLVMGetUndef(T_vector(val_ty(EltVal), NumElts));
986-
let VecVal = InsertElement(cx, Undef, EltVal, C_i32(0));
987-
ShuffleVector(cx, VecVal, Undef, C_null(T_vector(T_i32(), NumElts)))
979+
llvm::LLVMBuildShuffleVector(B(cx), V1, V2, Mask, noname());
988980
}
989981
}
990982

trunk/src/librustc/middle/trans/common.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -984,12 +984,6 @@ pub fn T_array(t: TypeRef, n: uint) -> TypeRef {
984984
}
985985
}
986986

987-
pub fn T_vector(t: TypeRef, n: uint) -> TypeRef {
988-
unsafe {
989-
return llvm::LLVMVectorType(t, n as c_uint);
990-
}
991-
}
992-
993987
// Interior vector.
994988
pub fn T_vec2(targ_cfg: @session::config, t: TypeRef) -> TypeRef {
995989
return T_struct(~[T_int(targ_cfg), // fill

trunk/src/librustc/middle/trans/type_of.rs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,9 @@ pub fn sizing_type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
155155
}
156156

157157
ty::ty_struct(did, _) => {
158-
if ty::type_is_simd(cx.tcx, t) {
159-
let et = ty::simd_type(cx.tcx, t);
160-
let n = ty::simd_size(cx.tcx, t);
161-
T_vector(type_of(cx, et), n)
162-
} else {
163-
let repr = adt::represent_type(cx, t);
164-
let packed = ty::lookup_packed(cx.tcx, did);
165-
T_struct(adt::sizing_fields_of(cx, repr), packed)
166-
}
158+
let repr = adt::represent_type(cx, t);
159+
let packed = ty::lookup_packed(cx.tcx, did);
160+
T_struct(adt::sizing_fields_of(cx, repr), packed)
167161
}
168162

169163
ty::ty_self(_) | ty::ty_infer(*) | ty::ty_param(*) | ty::ty_err(*) => {
@@ -269,19 +263,14 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
269263
}
270264
ty::ty_opaque_closure_ptr(_) => T_opaque_box_ptr(cx),
271265
ty::ty_struct(did, ref substs) => {
272-
if ty::type_is_simd(cx.tcx, t) {
273-
let et = ty::simd_type(cx.tcx, t);
274-
let n = ty::simd_size(cx.tcx, t);
275-
T_vector(type_of(cx, et), n)
276-
} else {
277-
// Only create the named struct, but don't fill it in. We fill it
278-
// in *after* placing it into the type cache. This prevents
279-
// infinite recursion with recursive struct types.
280-
T_named_struct(llvm_type_name(cx,
281-
a_struct,
282-
did,
283-
/*bad*/ copy substs.tps))
284-
}
266+
// Only create the named struct, but don't fill it in. We fill it
267+
// in *after* placing it into the type cache. This prevents
268+
// infinite recursion with recursive struct types.
269+
270+
common::T_named_struct(llvm_type_name(cx,
271+
a_struct,
272+
did,
273+
/*bad*/ copy substs.tps))
285274
}
286275
ty::ty_self(*) => cx.tcx.sess.unimpl(~"type_of: ty_self"),
287276
ty::ty_infer(*) => cx.tcx.sess.bug(~"type_of with ty_infer"),
@@ -300,12 +289,10 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
300289
}
301290

302291
ty::ty_struct(did, _) => {
303-
if !ty::type_is_simd(cx.tcx, t) {
304-
let repr = adt::represent_type(cx, t);
305-
let packed = ty::lookup_packed(cx.tcx, did);
306-
common::set_struct_body(llty, adt::fields_of(cx, repr),
307-
packed);
308-
}
292+
let repr = adt::represent_type(cx, t);
293+
let packed = ty::lookup_packed(cx.tcx, did);
294+
common::set_struct_body(llty, adt::fields_of(cx, repr),
295+
packed);
309296
}
310297
_ => ()
311298
}

trunk/src/librustc/middle/ty.rs

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,13 +1567,6 @@ pub fn type_is_sequence(ty: t) -> bool {
15671567
}
15681568
}
15691569

1570-
pub fn type_is_simd(cx: ctxt, ty: t) -> bool {
1571-
match get(ty).sty {
1572-
ty_struct(did, _) => lookup_simd(cx, did),
1573-
_ => false
1574-
}
1575-
}
1576-
15771570
pub fn type_is_str(ty: t) -> bool {
15781571
match get(ty).sty {
15791572
ty_estr(_) => true,
@@ -1590,26 +1583,6 @@ pub fn sequence_element_type(cx: ctxt, ty: t) -> t {
15901583
}
15911584
}
15921585

1593-
pub fn simd_type(cx: ctxt, ty: t) -> t {
1594-
match get(ty).sty {
1595-
ty_struct(did, ref substs) => {
1596-
let fields = lookup_struct_fields(cx, did);
1597-
lookup_field_type(cx, did, fields[0].id, substs)
1598-
}
1599-
_ => fail!(~"simd_type called on invalid type")
1600-
}
1601-
}
1602-
1603-
pub fn simd_size(cx: ctxt, ty: t) -> uint {
1604-
match get(ty).sty {
1605-
ty_struct(did, _) => {
1606-
let fields = lookup_struct_fields(cx, did);
1607-
fields.len()
1608-
}
1609-
_ => fail!(~"simd_size called on invalid type")
1610-
}
1611-
}
1612-
16131586
pub fn get_element_type(ty: t, i: uint) -> t {
16141587
match get(ty).sty {
16151588
ty_tup(ref ts) => return ts[i],
@@ -2408,14 +2381,6 @@ pub fn type_is_signed(ty: t) -> bool {
24082381
}
24092382
}
24102383
2411-
pub fn type_is_machine(ty: t) -> bool {
2412-
match get(ty).sty {
2413-
ty_int(ast::ty_i) | ty_uint(ast::ty_u) | ty_float(ast::ty_f) => false,
2414-
ty_int(*) | ty_uint(*) | ty_float(*) => true,
2415-
_ => false
2416-
}
2417-
}
2418-
24192384
// Whether a type is Plain Old Data -- meaning it does not contain pointers
24202385
// that the cycle collector might care about.
24212386
pub fn type_is_pod(cx: ctxt, ty: t) -> bool {
@@ -3931,7 +3896,7 @@ pub fn has_attr(tcx: ctxt, did: def_id, attr: &str) -> bool {
39313896
attrs: ref attrs,
39323897
_
39333898
}, _)) => attr::attrs_contains_name(*attrs, attr),
3934-
_ => tcx.sess.bug(fmt!("has_attr: %? is not an item",
3899+
_ => tcx.sess.bug(fmt!("lookup_packed: %? is not an item",
39353900
did))
39363901
}
39373902
} else {
@@ -3943,16 +3908,11 @@ pub fn has_attr(tcx: ctxt, did: def_id, attr: &str) -> bool {
39433908
}
39443909
}
39453910
3946-
/// Determine whether an item is annotated with `#[packed]`
3911+
/// Determine whether an item is annotated with `#[packed]` or not
39473912
pub fn lookup_packed(tcx: ctxt, did: def_id) -> bool {
39483913
has_attr(tcx, did, "packed")
39493914
}
39503915
3951-
/// Determine whether an item is annotated with `#[simd]`
3952-
pub fn lookup_simd(tcx: ctxt, did: def_id) -> bool {
3953-
has_attr(tcx, did, "simd")
3954-
}
3955-
39563916
// Look up a field ID, whether or not it's local
39573917
// Takes a list of type substs in case the struct is generic
39583918
pub fn lookup_field_type(tcx: ctxt,

trunk/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,8 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt,
561561
}
562562

563563
pub fn check_struct(ccx: @mut CrateCtxt, id: ast::node_id, span: span) {
564-
let tcx = ccx.tcx;
565-
566564
// Check that the class is instantiable
567-
check_instantiable(tcx, span, id);
568-
569-
if ty::lookup_simd(tcx, local_def(id)) {
570-
check_simd(tcx, span, id);
571-
}
565+
check_instantiable(ccx.tcx, span, id);
572566
}
573567

574568
pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
@@ -3040,35 +3034,6 @@ pub fn check_instantiable(tcx: ty::ctxt,
30403034
}
30413035
}
30423036

3043-
pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::node_id) {
3044-
let t = ty::node_id_to_type(tcx, id);
3045-
if ty::type_needs_subst(t) {
3046-
tcx.sess.span_err(sp, "SIMD vector cannot be generic");
3047-
return;
3048-
}
3049-
match ty::get(t).sty {
3050-
ty::ty_struct(did, ref substs) => {
3051-
let fields = ty::lookup_struct_fields(tcx, did);
3052-
if fields.is_empty() {
3053-
tcx.sess.span_err(sp, "SIMD vector cannot be empty");
3054-
return;
3055-
}
3056-
let e = ty::lookup_field_type(tcx, did, fields[0].id, substs);
3057-
if !vec::all(fields,
3058-
|f| ty::lookup_field_type(tcx, did, f.id, substs) == e) {
3059-
tcx.sess.span_err(sp, "SIMD vector should be homogeneous");
3060-
return;
3061-
}
3062-
if !ty::type_is_machine(e) {
3063-
tcx.sess.span_err(sp, "SIMD vector element type should be \
3064-
machine type");
3065-
return;
3066-
}
3067-
}
3068-
_ => ()
3069-
}
3070-
}
3071-
30723037
pub fn check_enum_variants(ccx: @mut CrateCtxt,
30733038
sp: span,
30743039
vs: &[ast::variant],

trunk/src/test/compile-fail/simd-type.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

trunk/src/test/run-pass/simd-type.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)