Skip to content

Commit 8213cb0

Browse files
committed
---
yaml --- r: 112631 b: refs/heads/snap-stage3 c: cbe6bd0 h: refs/heads/master i: 112629: 010664b 112627: be7ccb5 112623: 4c922ee v: v3
1 parent 1ed7f0c commit 8213cb0

Some content is hidden

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

77 files changed

+791
-621
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 30e373390f1a2f74e78bf9ca9c8ca68451f3511a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: edd8bb0aa191abcb5f8a3d6a6b03740907c6c54e
4+
refs/heads/snap-stage3: cbe6bd0a9d8228a8a857223b9b9d69f75242f58f
55
refs/heads/try: fa3000fae833e0869b11da51cabb2a2598ba86d1
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/etc/maketest.py

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,53 @@
1212
import os
1313
import sys
1414

15-
# FIXME #12303 these tests are broken on windows
16-
if os.name == 'nt':
17-
print 'ignoring make tests on windows'
18-
sys.exit(0)
15+
# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
16+
# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
17+
# the value is list of paths.
18+
# this causes great confusion and error: shell and Makefile doesn't like
19+
# windows paths so it is really error-prone. revert it for peace.
20+
def normalize_path(v):
21+
# c:\path -> /c/path
22+
if ':\\' in v:
23+
v = '/' + v.replace(':\\', '/')
24+
v = v.replace('\\', '/')
25+
return v
26+
27+
28+
def putenv(name, value):
29+
if os.name == 'nt':
30+
value = normalize_path(value)
31+
os.putenv(name, value)
32+
1933

2034
make = sys.argv[2]
21-
os.putenv('RUSTC', os.path.abspath(sys.argv[3]))
22-
os.putenv('TMPDIR', os.path.abspath(sys.argv[4]))
23-
os.putenv('CC', sys.argv[5])
24-
os.putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
35+
putenv('RUSTC', os.path.abspath(sys.argv[3]))
36+
putenv('TMPDIR', os.path.abspath(sys.argv[4]))
37+
putenv('CC', sys.argv[5])
38+
putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
2539
filt = sys.argv[7]
2640
ldpath = sys.argv[8]
2741
if ldpath != '':
28-
os.putenv(ldpath.split('=')[0], ldpath.split('=')[1])
42+
name = ldpath.split('=')[0]
43+
value = ldpath.split('=')[1]
44+
if os.name == 'nt' and name != 'PATH':
45+
value = ":".join(normalize_path(v) for v in value.split(";"))
46+
os.putenv(name, value)
2947

3048
if not filt in sys.argv[1]:
3149
sys.exit(0)
3250
print('maketest: ' + os.path.basename(os.path.dirname(sys.argv[1])))
3351

34-
proc = subprocess.Popen([make, '-C', sys.argv[1]],
52+
path = sys.argv[1]
53+
if path[-1] == '/':
54+
# msys1 has a bug that `make` fails to include `../tools.mk` (parent dir)
55+
# if `-C path` option is given and `path` is absolute directory with
56+
# trailing slash (`c:/path/to/test/`).
57+
# the easist workaround is to remove the slash (`c:/path/to/test`).
58+
# msys2 seems to fix this problem.
59+
path = path[:-1]
60+
61+
proc = subprocess.Popen([make, '-C', path],
3562
stdout = subprocess.PIPE,
3663
stderr = subprocess.PIPE)
3764
out, err = proc.communicate()

branches/snap-stage3/src/librustc/front/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ fn fold_mod(cx: &mut Context, m: &ast::Mod) -> ast::Mod {
7070
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
7171
}).collect();
7272
ast::Mod {
73+
inner: m.inner,
7374
view_items: filtered_view_items,
7475
items: flattened_items
7576
}

branches/snap-stage3/src/librustc/front/test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
143143
}
144144

145145
let mod_nomain = ast::Mod {
146+
inner: m.inner,
146147
view_items: m.view_items.clone(),
147148
items: m.items.iter().map(|i| nomain(&self.cx, *i)).collect(),
148149
};
@@ -335,6 +336,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::Item {
335336
)).unwrap();
336337

337338
let testmod = ast::Mod {
339+
inner: DUMMY_SP,
338340
view_items: view_items,
339341
items: vec!(mainfn, tests),
340342
};

branches/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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/snap-stage3/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

0 commit comments

Comments
 (0)