Skip to content

Commit ed70331

Browse files
committed
---
yaml --- r: 72055 b: refs/heads/dist-snap c: c98f0cb h: refs/heads/master i: 72053: 6a1d5a2 72051: dd56f64 72047: 6a05e00 v: v3
1 parent e5320ad commit ed70331

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+278
-648
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: fdb4ef321ed5eee681c2b723dcb157c280aa72f2
10+
refs/heads/dist-snap: c98f0cb3627fbdc2f1e56cfe1aad20a96730d208
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/mk/rt.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ RUNTIME_CXXS_$(1) := \
7676
rt/boxed_region.cpp \
7777
rt/arch/$$(HOST_$(1))/context.cpp \
7878
rt/arch/$$(HOST_$(1))/gpr.cpp \
79-
rt/rust_android_dummy.cpp \
80-
rt/rust_test_helpers.cpp
79+
rt/rust_android_dummy.cpp
8180

8281
RUNTIME_CS_$(1) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
8382

branches/dist-snap/src/libcore/rt/uv/net.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ impl NativeHandle<*uvll::uv_write_t> for WriteRequest {
356356

357357

358358
#[test]
359+
#[ignore(reason = "ffi struct issues")]
359360
fn connect_close() {
360361
do run_in_bare_thread() {
361362
let mut loop_ = Loop::new();
@@ -408,6 +409,7 @@ fn connect_read() {
408409
}
409410
410411
#[test]
412+
#[ignore(reason = "ffi struct issues")]
411413
fn listen() {
412414
do run_in_bare_thread() {
413415
static MAX: int = 10;

branches/dist-snap/src/libcore/vec.rs

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
1818
use clone::Clone;
1919
use iter::BaseIter;
2020
use iter;
21+
#[cfg(stage1)]
22+
#[cfg(stage2)]
23+
#[cfg(stage3)]
24+
use iterator::Iterator;
2125
use kinds::Copy;
2226
use libc;
2327
use option::{None, Option, Some};
@@ -1919,6 +1923,7 @@ impl<'self,T> ImmutableVector<T> for &'self [T] {
19191923
#[cfg(stage3)]
19201924
pub trait ImmutableVector<'self, T> {
19211925
fn slice(&self, start: uint, end: uint) -> &'self [T];
1926+
fn iter(self) -> VecIterator<'self, T>;
19221927
fn head(&self) -> &'self T;
19231928
fn head_opt(&self) -> Option<&'self T>;
19241929
fn tail(&self) -> &'self [T];
@@ -1949,6 +1954,15 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
19491954
slice(*self, start, end)
19501955
}
19511956

1957+
#[inline]
1958+
fn iter(self) -> VecIterator<'self, T> {
1959+
unsafe {
1960+
let p = vec::raw::to_ptr(self);
1961+
VecIterator{ptr: p, end: p.offset(self.len()),
1962+
lifetime: cast::transmute(p)}
1963+
}
1964+
}
1965+
19521966
/// Returns the first element of a vector, failing if the vector is empty.
19531967
#[inline]
19541968
fn head(&self) -> &'self T { head(*self) }
@@ -2795,7 +2809,33 @@ impl<A:Clone> Clone for ~[A] {
27952809
}
27962810
}
27972811

2798-
// ___________________________________________________________________________
2812+
// could be implemented with &[T] with .slice(), but this avoids bounds checks
2813+
#[cfg(stage1)]
2814+
#[cfg(stage2)]
2815+
#[cfg(stage3)]
2816+
pub struct VecIterator<'self, T> {
2817+
priv ptr: *T,
2818+
priv end: *T,
2819+
priv lifetime: &'self T // FIXME: #5922
2820+
}
2821+
2822+
#[cfg(stage1)]
2823+
#[cfg(stage2)]
2824+
#[cfg(stage3)]
2825+
impl<'self, T> Iterator<&'self T> for VecIterator<'self, T> {
2826+
#[inline]
2827+
fn next(&mut self) -> Option<&'self T> {
2828+
unsafe {
2829+
if self.ptr == self.end {
2830+
None
2831+
} else {
2832+
let old = self.ptr;
2833+
self.ptr = self.ptr.offset(1);
2834+
Some(cast::transmute(old))
2835+
}
2836+
}
2837+
}
2838+
}
27992839

28002840
#[cfg(test)]
28012841
mod tests {
@@ -4421,6 +4461,19 @@ mod tests {
44214461
[1, 2, 3, 4, 5, 5, 5, 5].cmp(& &[1, 2, 3, 4, 5, 6]) == Less;
44224462
[2, 2].cmp(& &[1, 2, 3, 4]) == Greater;
44234463
}
4464+
4465+
#[test]
4466+
fn test_iterator() {
4467+
use iterator::*;
4468+
let xs = [1, 2, 5, 10, 11];
4469+
let ys = [1, 2, 5, 10, 11, 19];
4470+
let mut it = xs.iter();
4471+
let mut i = 0;
4472+
for it.advance |&x| {
4473+
assert_eq!(x, ys[i]);
4474+
i += 1;
4475+
}
4476+
}
44244477
}
44254478

44264479
// Local Variables:

branches/dist-snap/src/librustc/lib/llvm.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -125,25 +125,27 @@ pub enum RealPredicate {
125125
RealPredicateTrue = 15,
126126
}
127127

128-
// The LLVM TypeKind type - must stay in sync with the def of
128+
// enum for the LLVM TypeKind type - must stay in sync with the def of
129129
// LLVMTypeKind in llvm/include/llvm-c/Core.h
130-
pub type TypeKind = u32;
131-
pub static Void: TypeKind = 0;
132-
pub static Half: TypeKind = 1;
133-
pub static Float: TypeKind = 2;
134-
pub static Double: TypeKind = 3;
135-
pub static X86_FP80: TypeKind = 4;
136-
pub static FP128: TypeKind = 5;
137-
pub static PPC_FP128: TypeKind = 6;
138-
pub static Label: TypeKind = 7;
139-
pub static Integer: TypeKind = 8;
140-
pub static Function: TypeKind = 9;
141-
pub static Struct: TypeKind = 10;
142-
pub static Array: TypeKind = 11;
143-
pub static Pointer: TypeKind = 12;
144-
pub static Vector: TypeKind = 13;
145-
pub static Metadata: TypeKind = 14;
146-
pub static X86_MMX: TypeKind = 15;
130+
#[deriving(Eq)]
131+
pub enum TypeKind {
132+
Void = 0,
133+
Half = 1,
134+
Float = 2,
135+
Double = 3,
136+
X86_FP80 = 4,
137+
FP128 = 5,
138+
PPC_FP128 = 6,
139+
Label = 7,
140+
Integer = 8,
141+
Function = 9,
142+
Struct = 10,
143+
Array = 11,
144+
Pointer = 12,
145+
Vector = 13,
146+
Metadata = 14,
147+
X86_MMX = 15
148+
}
147149

148150
pub enum AtomicBinOp {
149151
Xchg = 0,
@@ -1580,8 +1582,7 @@ pub fn type_to_str_inner(names: @TypeNames, +outer0: &[TypeRef], ty: TypeRef)
15801582
}
15811583
Vector => return @"Vector",
15821584
Metadata => return @"Metadata",
1583-
X86_MMX => return @"X86_MMAX",
1584-
_ => fail!()
1585+
X86_MMX => return @"X86_MMAX"
15851586
}
15861587
}
15871588
}

branches/dist-snap/src/librustc/metadata/tydecode.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,8 @@ fn parse_ty(st: @mut PState, conv: conv_did) -> ty::t {
313313
let def = parse_def(st, NominalType, conv);
314314
let substs = parse_substs(st, conv);
315315
let store = parse_trait_store(st);
316-
let mt = parse_mutability(st);
317316
assert!(next(st) == ']');
318-
return ty::mk_trait(st.tcx, def, substs, store, mt);
317+
return ty::mk_trait(st.tcx, def, substs, store);
319318
}
320319
'p' => {
321320
let did = parse_def(st, TypeParameter, conv);
@@ -397,16 +396,13 @@ fn parse_ty(st: @mut PState, conv: conv_did) -> ty::t {
397396
}
398397
}
399398

400-
fn parse_mutability(st: @mut PState) -> ast::mutability {
399+
fn parse_mt(st: @mut PState, conv: conv_did) -> ty::mt {
400+
let mut m;
401401
match peek(st) {
402-
'm' => { next(st); ast::m_mutbl }
403-
'?' => { next(st); ast::m_const }
404-
_ => { ast::m_imm }
402+
'm' => { next(st); m = ast::m_mutbl; }
403+
'?' => { next(st); m = ast::m_const; }
404+
_ => { m = ast::m_imm; }
405405
}
406-
}
407-
408-
fn parse_mt(st: @mut PState, conv: conv_did) -> ty::mt {
409-
let m = parse_mutability(st);
410406
ty::mt { ty: parse_ty(st, conv), mutbl: m }
411407
}
412408

branches/dist-snap/src/librustc/metadata/tyencode.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use core::io;
2222
use core::uint;
2323
use core::vec;
2424
use syntax::abi::AbiSet;
25-
use syntax::ast;
2625
use syntax::ast::*;
2726
use syntax::diagnostic::span_handler;
2827
use syntax::print::pprust::*;
@@ -114,17 +113,12 @@ pub fn enc_ty(w: @io::Writer, cx: @ctxt, t: ty::t) {
114113
}
115114
}
116115
}
117-
118-
fn enc_mutability(w: @io::Writer, mt: ast::mutability) {
119-
match mt {
116+
fn enc_mt(w: @io::Writer, cx: @ctxt, mt: ty::mt) {
117+
match mt.mutbl {
120118
m_imm => (),
121119
m_mutbl => w.write_char('m'),
122120
m_const => w.write_char('?')
123121
}
124-
}
125-
126-
fn enc_mt(w: @io::Writer, cx: @ctxt, mt: ty::mt) {
127-
enc_mutability(w, mt.mutbl);
128122
enc_ty(w, cx, mt.ty);
129123
}
130124

@@ -275,13 +269,12 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, +st: ty::sty) {
275269
enc_substs(w, cx, (*substs));
276270
w.write_char(']');
277271
}
278-
ty::ty_trait(def, ref substs, store, mt) => {
272+
ty::ty_trait(def, ref substs, store) => {
279273
w.write_str(&"x[");
280274
w.write_str((cx.ds)(def));
281275
w.write_char('|');
282276
enc_substs(w, cx, (*substs));
283277
enc_trait_store(w, cx, store);
284-
enc_mutability(w, mt);
285278
w.write_char(']');
286279
}
287280
ty::ty_tup(ts) => {

branches/dist-snap/src/librustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ pub fn check_cast_for_escaping_regions(
589589
pub fn check_kind_bounds_of_cast(cx: Context, source: @expr, target: @expr) {
590590
let target_ty = ty::expr_ty(cx.tcx, target);
591591
match ty::get(target_ty).sty {
592-
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
592+
ty::ty_trait(_, _, ty::UniqTraitStore) => {
593593
let source_ty = ty::expr_ty(cx.tcx, source);
594594
if !ty::type_is_owned(cx.tcx, source_ty) {
595595
cx.tcx.sess.span_err(

branches/dist-snap/src/librustc/middle/trans/cabi.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,37 @@ pub impl FnType {
180180
Ret(bcx, llretval);
181181
}
182182
}
183+
184+
enum LLVM_ABIInfo { LLVM_ABIInfo }
185+
186+
impl ABIInfo for LLVM_ABIInfo {
187+
fn compute_info(&self,
188+
atys: &[TypeRef],
189+
rty: TypeRef,
190+
_ret_def: bool) -> FnType {
191+
let arg_tys = do atys.map |a| {
192+
LLVMType { cast: false, ty: *a }
193+
};
194+
let ret_ty = LLVMType {
195+
cast: false,
196+
ty: rty
197+
};
198+
let attrs = do atys.map |_| {
199+
option::None
200+
};
201+
let sret = false;
202+
203+
return FnType {
204+
arg_tys: arg_tys,
205+
ret_ty: ret_ty,
206+
attrs: attrs,
207+
sret: sret
208+
};
209+
}
210+
}
211+
212+
pub fn llvm_abi_info() -> @ABIInfo {
213+
return @LLVM_ABIInfo as @ABIInfo;
214+
}
215+
216+

branches/dist-snap/src/librustc/middle/trans/cabi_mips.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,6 @@ impl ABIInfo for MIPS_ABIInfo {
227227
}
228228
}
229229

230-
pub fn abi_info() -> @ABIInfo {
230+
pub fn mips_abi_info() -> @ABIInfo {
231231
return @MIPS_ABIInfo as @ABIInfo;
232232
}

branches/dist-snap/src/librustc/middle/trans/cabi_x86.rs

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

branches/dist-snap/src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,6 @@ impl ABIInfo for X86_64_ABIInfo {
410410
}
411411
}
412412

413-
pub fn abi_info() -> @ABIInfo {
413+
pub fn x86_64_abi_info() -> @ABIInfo {
414414
return @X86_64_ABIInfo as @ABIInfo;
415415
}

0 commit comments

Comments
 (0)