Skip to content

Commit 05453af

Browse files
committed
---
yaml --- r: 7884 b: refs/heads/snap-stage3 c: fcb3814 h: refs/heads/master v: v3
1 parent 98f616b commit 05453af

34 files changed

+119
-274
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 0794195fbdb6efa34388dfdf3dfc968bbbf06215
4+
refs/heads/snap-stage3: fcb381410d59b89336a528103582a956334c9777
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/AUTHORS.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Graydon Hoare <[email protected]>
55
Other authors:
66

77
Adam Bozanich <[email protected]>
8-
Aleksander Balicki <[email protected]>
98
Andreas Gal <[email protected]>
109
Austin Seipp <[email protected]>
1110
Ben Striegel <[email protected]>

branches/snap-stage3/mk/install.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
# Installation macro. Call with source directory as arg 1,
66
# destination directory as arg 2, and filename/libname-glob as arg 3
77
ifdef VERBOSE
8-
INSTALL = install -m755 -T $(1)/$(3) $(2)/$(3)
9-
INSTALL_LIB = install -m644 `ls -rt1 $(1)/$(3) | tail -1` $(2)/
8+
INSTALL = cp $(1)/$(3) $(2)/$(3)
9+
INSTALL_LIB = cp `ls -rt1 $(1)/$(3) | tail -1` $(2)/
1010
else
11-
INSTALL = $(Q)$(call E, install: $(2)/$(3)) && install -m755 -T $(1)/$(3) $(2)/$(3)
11+
INSTALL = $(Q)$(call E, install: $(2)/$(3)) && cp $(1)/$(3) $(2)/$(3)
1212
INSTALL_LIB = $(Q)$(call E, install_lib: $(2)/$(3)) && \
13-
install -m644 `ls -rt1 $(1)/$(3) | tail -1` $(2)/
13+
cp `ls -rt1 $(1)/$(3) | tail -1` $(2)/
1414
endif
1515

1616
# The stage we install from

branches/snap-stage3/src/comp/metadata/decoder.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn item_family(item: ebml::doc) -> u8 {
8383

8484
fn item_symbol(item: ebml::doc) -> str {
8585
let sym = ebml::get_doc(item, tag_items_data_item_symbol);
86-
ret str::from_bytes(ebml::doc_data(sym));
86+
ret str::unsafe_from_bytes(ebml::doc_data(sym));
8787
}
8888

8989
fn variant_enum_id(d: ebml::doc) -> ast::def_id {
@@ -162,7 +162,7 @@ fn enum_variant_ids(item: ebml::doc, cdata: cmd) -> [ast::def_id] {
162162
// definition the path refers to.
163163
fn resolve_path(path: [ast::ident], data: @[u8]) -> [ast::def_id] {
164164
fn eq_item(data: [u8], s: str) -> bool {
165-
ret str::eq(str::from_bytes(data), s);
165+
ret str::eq(str::unsafe_from_bytes(data), s);
166166
}
167167
let s = str::connect(path, "::");
168168
let md = ebml::new_doc(data);
@@ -178,7 +178,7 @@ fn resolve_path(path: [ast::ident], data: @[u8]) -> [ast::def_id] {
178178

179179
fn item_name(item: ebml::doc) -> ast::ident {
180180
let name = ebml::get_doc(item, tag_paths_data_name);
181-
str::from_bytes(ebml::doc_data(name))
181+
str::unsafe_from_bytes(ebml::doc_data(name))
182182
}
183183

184184
fn lookup_item_name(data: @[u8], id: ast::node_id) -> ast::ident {
@@ -325,7 +325,7 @@ fn read_path(d: ebml::doc) -> {path: str, pos: uint} {
325325
let desc = ebml::doc_data(d);
326326
let pos = ebml::be_uint_from_bytes(@desc, 0u, 4u);
327327
let pathbytes = vec::slice::<u8>(desc, 4u, vec::len::<u8>(desc));
328-
let path = str::from_bytes(pathbytes);
328+
let path = str::unsafe_from_bytes(pathbytes);
329329
ret {path: path, pos: pos};
330330
}
331331

@@ -358,21 +358,21 @@ fn get_meta_items(md: ebml::doc) -> [@ast::meta_item] {
358358
let items: [@ast::meta_item] = [];
359359
ebml::tagged_docs(md, tag_meta_item_word) {|meta_item_doc|
360360
let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name);
361-
let n = str::from_bytes(ebml::doc_data(nd));
361+
let n = str::unsafe_from_bytes(ebml::doc_data(nd));
362362
items += [attr::mk_word_item(n)];
363363
};
364364
ebml::tagged_docs(md, tag_meta_item_name_value) {|meta_item_doc|
365365
let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name);
366366
let vd = ebml::get_doc(meta_item_doc, tag_meta_item_value);
367-
let n = str::from_bytes(ebml::doc_data(nd));
368-
let v = str::from_bytes(ebml::doc_data(vd));
367+
let n = str::unsafe_from_bytes(ebml::doc_data(nd));
368+
let v = str::unsafe_from_bytes(ebml::doc_data(vd));
369369
// FIXME (#611): Should be able to decode meta_name_value variants,
370370
// but currently they can't be encoded
371371
items += [attr::mk_name_value_item_str(n, v)];
372372
};
373373
ebml::tagged_docs(md, tag_meta_item_list) {|meta_item_doc|
374374
let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name);
375-
let n = str::from_bytes(ebml::doc_data(nd));
375+
let n = str::unsafe_from_bytes(ebml::doc_data(nd));
376376
let subitems = get_meta_items(meta_item_doc);
377377
items += [attr::mk_list_item(n, subitems)];
378378
};
@@ -427,7 +427,7 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] {
427427
let depsdoc = ebml::get_doc(cratedoc, tag_crate_deps);
428428
let crate_num = 1;
429429
ebml::tagged_docs(depsdoc, tag_crate_dep) {|depdoc|
430-
let depname = str::from_bytes(ebml::doc_data(depdoc));
430+
let depname = str::unsafe_from_bytes(ebml::doc_data(depdoc));
431431
deps += [{cnum: crate_num, ident: depname}];
432432
crate_num += 1;
433433
};
@@ -447,7 +447,7 @@ fn list_crate_deps(data: @[u8], out: io::writer) {
447447
fn get_crate_hash(data: @[u8]) -> str {
448448
let cratedoc = ebml::new_doc(data);
449449
let hashdoc = ebml::get_doc(cratedoc, tag_crate_hash);
450-
ret str::from_bytes(ebml::doc_data(hashdoc));
450+
ret str::unsafe_from_bytes(ebml::doc_data(hashdoc));
451451
}
452452

453453
fn list_crate_items(bytes: @[u8], md: ebml::doc, out: io::writer) {

branches/snap-stage3/src/comp/metadata/encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ fn encode_hash(ebml_w: ebml::writer, hash: str) {
661661
ebml::end_tag(ebml_w);
662662
}
663663

664-
fn encode_metadata(cx: @crate_ctxt, crate: @crate) -> [u8] {
664+
fn encode_metadata(cx: @crate_ctxt, crate: @crate) -> str {
665665

666666
let abbrevs = ty::new_ty_hash();
667667
let ecx = @{ccx: cx, type_abbrevs: abbrevs};
@@ -694,7 +694,7 @@ fn encode_metadata(cx: @crate_ctxt, crate: @crate) -> [u8] {
694694
// Pad this, since something (LLVM, presumably) is cutting off the
695695
// remaining % 4 bytes.
696696
buf_w.write([0u8, 0u8, 0u8, 0u8]);
697-
io::mem_buffer_buf(buf)
697+
io::mem_buffer_str(buf)
698698
}
699699

700700
// Get the encoded string for a type

branches/snap-stage3/src/comp/metadata/tydecode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn parse_ident_(st: @pstate, is_last: fn@(char) -> bool) ->
3939
ast::ident {
4040
let rslt = "";
4141
while !is_last(peek(st) as char) {
42-
rslt += str::from_byte(next(st));
42+
rslt += str::unsafe_from_byte(next(st));
4343
}
4444
ret rslt;
4545
}
@@ -226,7 +226,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
226226
while peek(st) as char != ']' {
227227
let name = "";
228228
while peek(st) as char != '=' {
229-
name += str::from_byte(next(st));
229+
name += str::unsafe_from_byte(next(st));
230230
}
231231
st.pos = st.pos + 1u;
232232
fields += [{ident: name, mt: parse_mt(st, conv)}];

branches/snap-stage3/src/comp/middle/debuginfo.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ type metadata<T> = {node: ValueRef, data: T};
101101

102102
type file_md = {path: str};
103103
type compile_unit_md = {path: str};
104-
type subprogram_md = {path: str};
104+
type subprogram_md = {id: ast::node_id};
105105
type local_var_md = {id: ast::node_id};
106106
type tydesc_md = {hash: uint};
107107
type block_md = {start: codemap::loc, end: codemap::loc};
@@ -225,39 +225,39 @@ fn line_from_span(cm: codemap::codemap, sp: span) -> uint {
225225
}
226226

227227
fn create_block(cx: @block_ctxt, sp: span) -> @metadata<block_md> {
228-
let cache = get_cache(bcx_ccx(cx));
228+
//let cache = get_cache(bcx_ccx(cx));
229229
let start = codemap::lookup_char_pos(bcx_ccx(cx).sess.codemap,
230230
sp.lo);
231231
let fname = start.filename;
232232
let end = codemap::lookup_char_pos(bcx_ccx(cx).sess.codemap,
233233
sp.hi);
234234
let tg = LexicalBlockTag;
235-
alt cached_metadata::<@metadata<block_md>>(
235+
/*alt cached_metadata::<@metadata<block_md>>(
236236
cache, tg,
237237
{|md| start == md.data.start && end == md.data.end}) {
238238
option::some(md) { ret md; }
239239
option::none {}
240-
}
240+
}*/
241241

242242
let parent = alt cx.parent {
243243
parent_none { create_function(cx.fcx, sp).node }
244-
parent_some(bcx) { create_block(cx, sp).node }
244+
parent_some(bcx) { create_block(bcx, sp).node }
245245
};
246246
let file_node = create_file(bcx_ccx(cx), fname);
247-
let unique_id = alt cache.find(LexicalBlockTag) {
247+
/*let unique_id = alt cache.find(LexicalBlockTag) {
248248
option::some(v) { vec::len(v) as int }
249249
option::none { 0 }
250-
};
250+
};*/
251251
let lldata = [lltag(tg),
252252
parent,
253253
lli32(start.line as int),
254254
lli32(start.col as int),
255-
file_node.node,
256-
lli32(unique_id)
255+
file_node.node/*,
256+
lli32(unique_id)*/
257257
];
258258
let val = llmdnode(lldata);
259259
let mdval = @{node: val, data: {start: start, end: end}};
260-
update_cache(cache, tg, block_metadata(mdval));
260+
//update_cache(cache, tg, block_metadata(mdval));
261261
ret mdval;
262262
}
263263

@@ -721,7 +721,7 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
721721
#debug("~~");
722722
log(debug, fcx.id);
723723

724-
log(debug, codemap::span_to_str(sp, cx.sess.codemap));
724+
//log(debug, codemap::span_to_str(sp, cx.sess.codemap));
725725

726726
let (ident, ret_ty, id) = alt cx.ast_map.get(fcx.id) {
727727
ast_map::node_item(item) {
@@ -754,15 +754,14 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
754754
log(debug, ident);
755755
log(debug, id);
756756

757-
let path = str::connect(fcx.lcx.path + [ident], "::");
758-
759-
let cache = get_cache(cx);
757+
/*let cache = get_cache(cx);
760758
alt cached_metadata::<@metadata<subprogram_md>>(
761-
cache, SubprogramTag, {|md| md.data.path == path &&
762-
/*md.data.path == ??*/ true}) {
759+
cache, SubprogramTag, {|md| md.data.id == id}) {
763760
option::some(md) { ret md; }
764761
option::none {}
765-
}
762+
}*/
763+
764+
let path = str::connect(fcx.lcx.path + [ident], "::");
766765

767766
let loc = codemap::lookup_char_pos(cx.sess.codemap,
768767
sp.lo);
@@ -805,7 +804,7 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
805804
];
806805
let val = llmdnode(fn_metadata);
807806
add_named_metadata(cx, "llvm.dbg.sp", val);
808-
let mdval = @{node: val, data: {path: path}};
809-
update_cache(cache, SubprogramTag, subprogram_metadata(mdval));
807+
let mdval = @{node: val, data: {id: id}};
808+
//update_cache(cache, SubprogramTag, subprogram_metadata(mdval));
810809
ret mdval;
811810
}

branches/snap-stage3/src/comp/middle/mut.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import syntax::visit;
55
import syntax::ast_util;
66
import driver::session::session;
77

8-
enum deref_t { unbox(bool), field, index, }
8+
enum deref_t { unbox, field, index, }
99

1010
type deref = @{mut: bool, kind: deref_t, outer_t: ty::t};
1111

@@ -20,15 +20,15 @@ fn expr_root(tcx: ty::ctxt, ex: @expr, autoderef: bool) ->
2020
while true {
2121
alt ty::struct(tcx, t) {
2222
ty::ty_box(mt) {
23-
ds += [@{mut: mt.mut == mut, kind: unbox(false), outer_t: t}];
23+
ds += [@{mut: mt.mut == mut, kind: unbox, outer_t: t}];
2424
t = mt.ty;
2525
}
2626
ty::ty_uniq(mt) {
27-
ds += [@{mut: mt.mut == mut, kind: unbox(false), outer_t: t}];
27+
ds += [@{mut: mt.mut == mut, kind: unbox, outer_t: t}];
2828
t = mt.ty;
2929
}
3030
ty::ty_res(_, inner, tps) {
31-
ds += [@{mut: false, kind: unbox(false), outer_t: t}];
31+
ds += [@{mut: false, kind: unbox, outer_t: t}];
3232
t = ty::substitute_type_params(tcx, tps, inner);
3333
}
3434
ty::ty_enum(did, tps) {
@@ -37,7 +37,7 @@ fn expr_root(tcx: ty::ctxt, ex: @expr, autoderef: bool) ->
3737
vec::len(variants[0].args) != 1u {
3838
break;
3939
}
40-
ds += [@{mut: false, kind: unbox(false), outer_t: t}];
40+
ds += [@{mut: false, kind: unbox, outer_t: t}];
4141
t = ty::substitute_type_params(tcx, tps, variants[0].args[0]);
4242
}
4343
_ { break; }
@@ -85,16 +85,15 @@ fn expr_root(tcx: ty::ctxt, ex: @expr, autoderef: bool) ->
8585
expr_unary(op, base) {
8686
if op == deref {
8787
let base_t = ty::expr_ty(tcx, base);
88-
let is_mut = false, ptr = false;
88+
let is_mut = false;
8989
alt ty::struct(tcx, base_t) {
9090
ty::ty_box(mt) { is_mut = mt.mut == mut; }
9191
ty::ty_uniq(mt) { is_mut = mt.mut == mut; }
9292
ty::ty_res(_, _, _) { }
9393
ty::ty_enum(_, _) { }
94-
ty::ty_ptr(mt) { is_mut = mt.mut == mut; ptr = true; }
94+
ty::ty_ptr(mt) { is_mut = mt.mut == mut; }
9595
}
96-
ds += [@{mut: is_mut, kind: unbox(ptr && is_mut),
97-
outer_t: base_t}];
96+
ds += [@{mut: is_mut, kind: unbox, outer_t: base_t}];
9897
ex = base;
9998
} else { break; }
10099
}
@@ -188,7 +187,7 @@ fn check_lval(cx: @ctx, dest: @expr, msg: msg) {
188187
} else if !root.ds[0].mut {
189188
let name =
190189
alt root.ds[0].kind {
191-
mut::unbox(_) { "immutable box" }
190+
mut::unbox { "immutable box" }
192191
mut::field { "immutable field" }
193192
mut::index { "immutable vec content" }
194193
};
@@ -213,8 +212,7 @@ fn check_move_rhs(cx: @ctx, src: @expr) {
213212
let root = expr_root(cx.tcx, src, false);
214213

215214
// Not a path and no-derefs means this is a temporary.
216-
if vec::len(*root.ds) != 0u &&
217-
root.ds[vec::len(*root.ds) - 1u].kind != unbox(true) {
215+
if vec::len(*root.ds) != 0u {
218216
cx.tcx.sess.span_err(src.span, "moving out of a data structure");
219217
}
220218
}

branches/snap-stage3/src/comp/middle/trans/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ fn sanitize(s: str) -> str {
268268
c != ' ' as u8 && c != '\t' as u8 && c != ';' as u8
269269
{
270270
let v = [c];
271-
result += str::from_bytes(v);
271+
result += str::unsafe_from_bytes(v);
272272
}
273273
}
274274
}
@@ -5412,7 +5412,7 @@ fn fill_crate_map(ccx: @crate_ctxt, map: ValueRef) {
54125412

54135413
fn write_metadata(cx: @crate_ctxt, crate: @ast::crate) {
54145414
if !cx.sess.building_library { ret; }
5415-
let llmeta = C_bytes(metadata::encoder::encode_metadata(cx, crate));
5415+
let llmeta = C_postr(metadata::encoder::encode_metadata(cx, crate));
54165416
let llconst = C_struct([llmeta]);
54175417
let llglobal = str::as_buf("rust_metadata", {|buf|
54185418
llvm::LLVMAddGlobal(cx.llmod, val_ty(llconst), buf)

branches/snap-stage3/src/comp/middle/ty.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ export type_is_str;
172172
export type_is_unique;
173173
export type_is_enum;
174174
export type_is_c_like_enum;
175-
export type_structurally_contains;
176175
export type_structurally_contains_uniques;
177176
export type_autoderef;
178177
export type_param;
@@ -2421,8 +2420,7 @@ mod unify {
24212420
fn fixup_vars(tcx: ty_ctxt, sp: option::t<span>, vb: @var_bindings,
24222421
typ: t) -> fixup_result {
24232422
fn subst_vars(tcx: ty_ctxt, sp: option::t<span>, vb: @var_bindings,
2424-
unresolved: @mutable option::t<int>,
2425-
vars_seen: std::list::list<int>, vid: int) -> t {
2423+
unresolved: @mutable option::t<int>, vid: int) -> t {
24262424
// Should really return a fixup_result instead of a t, but fold_ty
24272425
// doesn't allow returning anything but a t.
24282426
if vid as uint >= ufind::set_count(vb.sets) {
@@ -2433,28 +2431,21 @@ mod unify {
24332431
alt smallintmap::find::<t>(vb.types, root_id) {
24342432
none { *unresolved = some(vid); ret ty::mk_var(tcx, vid); }
24352433
some(rt) {
2436-
let give_up = false;
2437-
std::list::iter(vars_seen) {|v|
2438-
if v == vid {
2439-
give_up = true;
2440-
option::may(sp) {|sp|
2441-
tcx.sess.span_fatal(
2442-
sp, "can not instantiate infinite type");
2443-
}
2444-
}
2434+
if occurs_check_fails(tcx, sp, vid, rt) {
2435+
// Return the type unchanged, so we can error out
2436+
// downstream
2437+
ret rt;
24452438
}
2446-
// Return the type unchanged, so we can error out
2447-
// downstream
2448-
if give_up { ret rt; }
2449-
ret fold_ty(tcx, fm_var(bind subst_vars(
2450-
tcx, sp, vb, unresolved, std::list::cons(vid, @vars_seen),
2451-
_)), rt);
2439+
ret fold_ty(tcx,
2440+
fm_var(bind subst_vars(tcx, sp, vb, unresolved,
2441+
_)), rt);
24522442
}
24532443
}
24542444
}
24552445
let unresolved = @mutable none::<int>;
2456-
let rty = fold_ty(tcx, fm_var(bind subst_vars(
2457-
tcx, sp, vb, unresolved, std::list::nil, _)), typ);
2446+
let rty =
2447+
fold_ty(tcx, fm_var(bind subst_vars(tcx, sp, vb, unresolved, _)),
2448+
typ);
24582449
let ur = *unresolved;
24592450
alt ur {
24602451
none { ret fix_ok(rty); }

0 commit comments

Comments
 (0)