Skip to content

Commit 8e8e778

Browse files
committed
---
yaml --- r: 151186 b: refs/heads/try2 c: 33259d9 h: refs/heads/master v: v3
1 parent 3c88628 commit 8e8e778

Some content is hidden

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

50 files changed

+520
-621
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 58ab4a0064641ca5a27b0998ee7d0e33f9c677cd
8+
refs/heads/try2: 33259d979742e643a5dda4889d17d59c6fcf63e4
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/tests.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,16 @@ TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
349349
$$(foreach crate,$$(TARGET_CRATES),\
350350
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
351351
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
352+
353+
# The regex crate depends on the regex_macros crate during testing, but it
354+
# notably depend on the *host* regex_macros crate, not the target version.
355+
# Additionally, this is not a dependency in stage1, only in stage2.
356+
ifeq ($(4),regex)
357+
ifneq ($(1),1)
358+
TESTDEP_$(1)_$(2)_$(3)_$(4) += $$(TLIB$(1)_T_$(3)_H_$(3))/stamp.regex_macros
359+
endif
360+
endif
361+
352362
else
353363
TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
354364
endif

branches/try2/src/librustc/back/link.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,18 @@ fn link_args(sess: &Session,
11641164
sess.opts.optimize == session::Aggressive {
11651165
args.push("-Wl,-O1".to_owned());
11661166
}
1167+
} else if sess.targ_cfg.os == abi::OsMacos {
1168+
// The dead_strip option to the linker specifies that functions and data
1169+
// unreachable by the entry point will be removed. This is quite useful
1170+
// with Rust's compilation model of compiling libraries at a time into
1171+
// one object file. For example, this brings hello world from 1.7MB to
1172+
// 458K.
1173+
//
1174+
// Note that this is done for both executables and dynamic libraries. We
1175+
// won't get much benefit from dylibs because LLVM will have already
1176+
// stripped away as much as it could. This has not been seen to impact
1177+
// link times negatively.
1178+
args.push("-Wl,-dead_strip".to_owned());
11671179
}
11681180

11691181
if sess.targ_cfg.os == abi::OsWin32 {

branches/try2/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +138,6 @@ pub fn parse_substs_data(data: &[u8], crate_num: ast::CrateNum, pos: uint, tcx:
138138
parse_substs(&mut st, conv)
139139
}
140140

141-
fn parse_vstore(st: &mut PState, conv: conv_did) -> ty::Vstore {
142-
assert_eq!(next(st), '/');
143-
144-
let c = peek(st);
145-
if '0' <= c && c <= '9' {
146-
let n = parse_uint(st);
147-
assert_eq!(next(st), '|');
148-
return ty::VstoreFixed(n);
149-
}
150-
151-
match next(st) {
152-
'~' => ty::VstoreUniq,
153-
'&' => ty::VstoreSlice(parse_region(st, conv)),
154-
c => st.tcx.sess.bug(format!("parse_vstore(): bad input '{}'", c))
155-
}
156-
}
157-
158141
fn parse_size(st: &mut PState) -> Option<uint> {
159142
assert_eq!(next(st), '/');
160143

@@ -361,8 +344,7 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
361344
return ty::mk_vec(st.tcx, mt, sz);
362345
}
363346
'v' => {
364-
let v = parse_vstore(st, |x,y| conv(x,y));
365-
return ty::mk_str(st.tcx, v);
347+
return ty::mk_str(st.tcx);
366348
}
367349
'T' => {
368350
assert_eq!(next(st), '[');

branches/try2/src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,6 @@ fn enc_bound_region(w: &mut MemWriter, cx: &ctxt, br: ty::BoundRegion) {
177177
}
178178
}
179179

180-
pub fn enc_vstore(w: &mut MemWriter, cx: &ctxt,
181-
v: ty::Vstore,
182-
enc_mut: |&mut MemWriter|) {
183-
mywrite!(w, "/");
184-
match v {
185-
ty::VstoreFixed(u) => mywrite!(w, "{}|", u),
186-
ty::VstoreUniq => mywrite!(w, "~"),
187-
ty::VstoreSlice(r) => {
188-
mywrite!(w, "&");
189-
enc_region(w, cx, r);
190-
enc_mut(w);
191-
}
192-
}
193-
}
194-
195180
pub fn enc_trait_ref(w: &mut MemWriter, cx: &ctxt, s: &ty::TraitRef) {
196181
mywrite!(w, "{}|", (cx.ds)(s.def_id));
197182
enc_substs(w, cx, &s.substs);
@@ -275,9 +260,8 @@ fn enc_sty(w: &mut MemWriter, cx: &ctxt, st: &ty::sty) {
275260
None => mywrite!(w, "|"),
276261
}
277262
}
278-
ty::ty_str(v) => {
263+
ty::ty_str => {
279264
mywrite!(w, "v");
280-
enc_vstore(w, cx, v, |_| {});
281265
}
282266
ty::ty_closure(ref f) => {
283267
mywrite!(w, "f");

branches/try2/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ fn missing_ctor(cx: &MatchCheckCtxt,
405405
ty::ty_struct(..) => check_matrix_for_wild(cx, m),
406406
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty: ty, ..}) => match ty::get(ty).sty {
407407
ty::ty_vec(_, None) => ctor_for_slice(m),
408+
ty::ty_str => Some(single),
408409
_ => check_matrix_for_wild(cx, m),
409410
},
410411
ty::ty_enum(eid, _) => {

branches/try2/src/librustc/middle/effect.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ impl<'a> EffectCheckVisitor<'a> {
6868
debug!("effect: checking index with base type {}",
6969
ppaux::ty_to_str(self.tcx, base_type));
7070
match ty::get(base_type).sty {
71-
ty::ty_str(..) => {
71+
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
72+
ty::ty_str => {
73+
self.tcx.sess.span_err(e.span,
74+
"modification of string types is not allowed");
75+
}
76+
_ => {}
77+
},
78+
ty::ty_str => {
7279
self.tcx.sess.span_err(e.span,
7380
"modification of string types is not allowed");
7481
}

branches/try2/src/librustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) {
911911
ty::ty_box(_) => {
912912
n_box += 1;
913913
}
914-
ty::ty_uniq(_) | ty::ty_str(ty::VstoreUniq) |
914+
ty::ty_uniq(_) |
915915
ty::ty_trait(~ty::TyTrait { store: ty::UniqTraitStore, .. }) |
916916
ty::ty_closure(~ty::ClosureTy { store: ty::UniqTraitStore, .. }) => {
917917
n_uniq += 1;

branches/try2/src/librustc/middle/mem_categorization.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
174174
match ty::get(t).sty {
175175
ty::ty_uniq(_) |
176176
ty::ty_trait(~ty::TyTrait { store: ty::UniqTraitStore, .. }) |
177-
ty::ty_str(ty::VstoreUniq) |
178177
ty::ty_closure(~ty::ClosureTy {store: ty::UniqTraitStore, ..}) => {
179178
Some(deref_ptr(OwnedPtr))
180179
}
@@ -188,7 +187,6 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
188187
Some(deref_ptr(BorrowedPtr(kind, r)))
189188
}
190189

191-
ty::ty_str(ty::VstoreSlice(r)) |
192190
ty::ty_closure(~ty::ClosureTy {store: ty::RegionTraitStore(r, _), ..}) => {
193191
Some(deref_ptr(BorrowedPtr(ty::ImmBorrow, r)))
194192
}
@@ -206,8 +204,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
206204
Some(deref_interior(InteriorField(PositionalField(0))))
207205
}
208206

209-
ty::ty_vec(_, Some(_)) |
210-
ty::ty_str(ty::VstoreFixed(_)) => {
207+
ty::ty_vec(_, Some(_)) => {
211208
Some(deref_interior(InteriorElement(element_kind(t))))
212209
}
213210

@@ -1306,10 +1303,10 @@ fn element_kind(t: ty::t) -> ElementKind {
13061303
ty::ty_rptr(_, ty::mt{ty:ty, ..}) |
13071304
ty::ty_uniq(ty) => match ty::get(ty).sty {
13081305
ty::ty_vec(_, None) => VecElement,
1306+
ty::ty_str => StrElement,
13091307
_ => OtherElement
13101308
},
13111309
ty::ty_vec(..) => VecElement,
1312-
ty::ty_str(..) => StrElement,
13131310
_ => OtherElement
13141311
}
13151312
}

branches/try2/src/librustc/middle/trans/_match.rs

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,40 +1293,50 @@ fn compare_values<'a>(
12931293
rhs: ValueRef,
12941294
rhs_t: ty::t)
12951295
-> Result<'a> {
1296+
fn compare_str<'a>(cx: &'a Block<'a>,
1297+
lhs: ValueRef,
1298+
rhs: ValueRef,
1299+
rhs_t: ty::t)
1300+
-> Result<'a> {
1301+
let did = langcall(cx, None,
1302+
format!("comparison of `{}`", cx.ty_to_str(rhs_t)),
1303+
StrEqFnLangItem);
1304+
let result = callee::trans_lang_call(cx, did, [lhs, rhs], None);
1305+
Result {
1306+
bcx: result.bcx,
1307+
val: bool_to_i1(result.bcx, result.val)
1308+
}
1309+
}
1310+
12961311
let _icx = push_ctxt("compare_values");
12971312
if ty::type_is_scalar(rhs_t) {
1298-
let rs = compare_scalar_types(cx, lhs, rhs, rhs_t, ast::BiEq);
1299-
return rslt(rs.bcx, rs.val);
1313+
let rs = compare_scalar_types(cx, lhs, rhs, rhs_t, ast::BiEq);
1314+
return rslt(rs.bcx, rs.val);
13001315
}
13011316

13021317
match ty::get(rhs_t).sty {
1303-
ty::ty_str(ty::VstoreUniq) => {
1304-
let scratch_lhs = alloca(cx, val_ty(lhs), "__lhs");
1305-
Store(cx, lhs, scratch_lhs);
1306-
let scratch_rhs = alloca(cx, val_ty(rhs), "__rhs");
1307-
Store(cx, rhs, scratch_rhs);
1308-
let did = langcall(cx, None,
1309-
format!("comparison of `{}`", cx.ty_to_str(rhs_t)),
1310-
UniqStrEqFnLangItem);
1311-
let result = callee::trans_lang_call(cx, did, [scratch_lhs, scratch_rhs], None);
1312-
Result {
1313-
bcx: result.bcx,
1314-
val: bool_to_i1(result.bcx, result.val)
1315-
}
1316-
}
1317-
ty::ty_str(_) => {
1318-
let did = langcall(cx, None,
1319-
format!("comparison of `{}`", cx.ty_to_str(rhs_t)),
1320-
StrEqFnLangItem);
1321-
let result = callee::trans_lang_call(cx, did, [lhs, rhs], None);
1322-
Result {
1323-
bcx: result.bcx,
1324-
val: bool_to_i1(result.bcx, result.val)
1318+
ty::ty_uniq(t) => match ty::get(t).sty {
1319+
ty::ty_str => {
1320+
let scratch_lhs = alloca(cx, val_ty(lhs), "__lhs");
1321+
Store(cx, lhs, scratch_lhs);
1322+
let scratch_rhs = alloca(cx, val_ty(rhs), "__rhs");
1323+
Store(cx, rhs, scratch_rhs);
1324+
let did = langcall(cx, None,
1325+
format!("comparison of `{}`", cx.ty_to_str(rhs_t)),
1326+
UniqStrEqFnLangItem);
1327+
let result = callee::trans_lang_call(cx, did, [scratch_lhs, scratch_rhs], None);
1328+
Result {
1329+
bcx: result.bcx,
1330+
val: bool_to_i1(result.bcx, result.val)
1331+
}
13251332
}
1326-
}
1327-
_ => {
1328-
cx.sess().bug("only scalars and strings supported in compare_values");
1329-
}
1333+
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
1334+
},
1335+
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
1336+
ty::ty_str => compare_str(cx, lhs, rhs, rhs_t),
1337+
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
1338+
},
1339+
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
13301340
}
13311341
}
13321342

branches/try2/src/librustc/middle/trans/adt.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,10 @@ impl Case {
270270
self.tys.iter().position(|&ty| {
271271
match ty::get(ty).sty {
272272
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
273-
ty::ty_vec(_, None) => false,
273+
ty::ty_vec(_, None) | ty::ty_str => false,
274274
_ => true,
275275
},
276276
ty::ty_uniq(..) | ty::ty_box(..) |
277-
ty::ty_str(ty::VstoreUniq) |
278277
ty::ty_bare_fn(..) => true,
279278
// Is that everything? Would closures or slices qualify?
280279
_ => false

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv,
188188
// `~` pointer return values never alias because ownership is transferred
189189
// FIXME #6750 ~Trait cannot be directly marked as
190190
// noalias because the actual object pointer is nested.
191-
ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
192-
ty::ty_str(ty::VstoreUniq) => {
191+
ty::ty_uniq(..) // | ty::ty_trait(_, _, ty::UniqTraitStore, _, _)
192+
=> {
193193
unsafe {
194194
llvm::LLVMAddReturnAttribute(llfn, lib::llvm::NoAliasAttribute as c_uint);
195195
}
@@ -261,7 +261,6 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
261261
// FIXME #6750 ~Trait cannot be directly marked as
262262
// noalias because the actual object pointer is nested.
263263
ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
264-
ty::ty_str(ty::VstoreUniq) |
265264
ty::ty_closure(~ty::ClosureTy {store: ty::UniqTraitStore, ..}) => {
266265
unsafe {
267266
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
@@ -665,11 +664,6 @@ pub fn iter_structural_ty<'r,
665664
}
666665
})
667666
}
668-
ty::ty_str(ty::VstoreFixed(n)) => {
669-
let unit_ty = ty::sequence_element_type(cx.tcx(), t);
670-
let (base, len) = tvec::get_fixed_base_and_byte_len(cx, av, unit_ty, n);
671-
cx = tvec::iter_vec_raw(cx, base, unit_ty, len, f);
672-
}
673667
ty::ty_vec(_, Some(n)) => {
674668
let unit_ty = ty::sequence_element_type(cx.tcx(), t);
675669
let (base, len) = tvec::get_fixed_base_and_byte_len(cx, av, unit_ty, n);

branches/try2/src/librustc/middle/trans/callee.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,10 @@ pub fn trans_call_inner<'a>(
659659
match ty::get(ret_ty).sty {
660660
// `~` pointer return values never alias because ownership
661661
// is transferred
662-
ty::ty_uniq(..) => {
663-
attrs.push((0, NoAliasAttribute));
664-
}
662+
ty::ty_uniq(ty) => match ty::get(ty).sty {
663+
ty::ty_str => {}
664+
_ => attrs.push((0, NoAliasAttribute)),
665+
},
665666
_ => {}
666667
}
667668

branches/try2/src/librustc/middle/trans/consts.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn const_deref(cx: &CrateContext, v: ValueRef, t: ty::t, explicit: bool)
141141
let dv = match ty::get(t).sty {
142142
ty::ty_ptr(mt) | ty::ty_rptr(_, mt) => {
143143
match ty::get(mt.ty).sty {
144-
ty::ty_vec(_, None) => cx.sess().bug("unexpected slice"),
144+
ty::ty_vec(_, None) | ty::ty_str => cx.sess().bug("unexpected slice"),
145145
_ => const_deref_ptr(cx, v),
146146
}
147147
}
@@ -432,13 +432,9 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
432432
"index is not an integer-constant expression")
433433
};
434434
let (arr, len) = match ty::get(bt).sty {
435-
ty::ty_str(ty::VstoreSlice(..)) => {
436-
let e1 = const_get_elt(cx, bv, [0]);
437-
(const_deref_ptr(cx, e1), const_get_elt(cx, bv, [1]))
438-
},
439435
ty::ty_vec(_, Some(u)) => (bv, C_uint(cx, u)),
440436
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
441-
ty::ty_vec(_, None) => {
437+
ty::ty_vec(_, None) | ty::ty_str => {
442438
let e1 = const_get_elt(cx, bv, [0]);
443439
(const_deref_ptr(cx, e1), const_get_elt(cx, bv, [1]))
444440
},
@@ -451,7 +447,13 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
451447

452448
let len = llvm::LLVMConstIntGetZExtValue(len) as u64;
453449
let len = match ty::get(bt).sty {
454-
ty::ty_str(..) => {assert!(len > 0); len - 1},
450+
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
451+
ty::ty_str => {
452+
assert!(len > 0);
453+
len - 1
454+
}
455+
_ => len
456+
},
455457
_ => len
456458
};
457459
if iv >= len {

0 commit comments

Comments
 (0)