From 920ea63f53bbbe46cdcbaead12720871b5fb00b9 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 13 Jun 2012 10:46:17 -0700 Subject: [PATCH 1/9] Register snapshots --- src/snapshots.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/snapshots.txt b/src/snapshots.txt index 8021f18726db3..b8cd3843d7d63 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,11 @@ +S 2012-06-12 11e30b2 + macos-x86_64 b6e031112f4619dcd5aa708cf9ea9871a7b11595 + macos-i386 497875c1fb6289c704485b8bf2e3c40c7918bf4e + freebsd-x86_64 8b7efe161706066f3711fcb28a0edc969870851d + linux-x86_64 b12a342144309e0053a7654ce95b19666a0a3521 + linux-i386 75e0916903362fcfd3a306d53d932c7ad3f43f28 + winnt-i386 470d7ededd8e5dc9ded9317d5cfbc8794fe9c594 + S 2012-06-07 3cbd1e2 macos-x86_64 e899c985a4c7b73e3d597b7139bae9a68f0be3ed macos-i386 f002bd36e38dbd6455887da915b449fc22fa3df7 From bdd20000665a35e14b4ec2c54f893fc80fe451ef Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Wed, 13 Jun 2012 10:46:33 -0700 Subject: [PATCH 2/9] Some cleanup in tvec. --- src/rustc/middle/trans/tvec.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/rustc/middle/trans/tvec.rs b/src/rustc/middle/trans/tvec.rs index b220ec7cd42fe..0760bdaf24e2b 100644 --- a/src/rustc/middle/trans/tvec.rs +++ b/src/rustc/middle/trans/tvec.rs @@ -69,18 +69,15 @@ fn alloc_uniq(bcx: block, unit_ty: ty::t, elts: uint) -> result { fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> result { let _icx = bcx.insn_ctxt("tvec::duplicate_uniq"); - let ccx = bcx.ccx(); - let body_ptr = get_bodyptr(bcx, vptr); - let fill = get_fill(bcx, body_ptr); - let size = Add(bcx, fill, llsize_of(ccx, ccx.opaque_vec_type)); + let fill = get_fill(bcx, get_bodyptr(bcx, vptr)); let unit_ty = ty::sequence_element_type(bcx.tcx(), vec_ty); - let vecbodyty = ty::mk_mut_unboxed_vec(bcx.tcx(), unit_ty); - let {box: newptr, body: new_body_ptr} = - base::malloc_unique_dyn(bcx, vecbodyty, size); - call_memmove(bcx, new_body_ptr, body_ptr, size); + let {bcx, val: newptr} = alloc_uniq_raw(bcx, unit_ty, fill, fill); + + let data_ptr = get_dataptr(bcx, get_bodyptr(bcx, vptr)); + let new_data_ptr = get_dataptr(bcx, get_bodyptr(bcx, newptr)); + call_memmove(bcx, new_data_ptr, data_ptr, fill); - Store(bcx, fill, GEPi(bcx, new_body_ptr, [0u, abi::vec_elt_alloc])); let bcx = if ty::type_needs_drop(bcx.tcx(), unit_ty) { iter_vec(bcx, newptr, vec_ty, base::take_ty) } else { bcx }; From ce750a7dbcd2dc68db6de89956b1de3ecf9f2d0a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 10 Jun 2012 00:49:59 -0700 Subject: [PATCH 3/9] Box AST idents --- src/cargo/cargo.rs | 32 +++---- src/fuzzer/fuzzer.rs | 2 +- src/libstd/map.rs | 6 ++ src/libsyntax/ast.rs | 6 +- src/libsyntax/ast_map.rs | 26 +++--- src/libsyntax/ast_util.rs | 7 +- src/libsyntax/attr.rs | 50 +++++------ src/libsyntax/ext/auto_serialize.rs | 75 ++++++++-------- src/libsyntax/ext/base.rs | 4 +- src/libsyntax/ext/build.rs | 2 +- src/libsyntax/ext/concat_idents.rs | 6 +- src/libsyntax/ext/env.rs | 4 +- src/libsyntax/ext/expand.rs | 12 +-- src/libsyntax/ext/fmt.rs | 23 ++--- src/libsyntax/ext/qquote.rs | 34 ++++---- src/libsyntax/ext/simplext.rs | 14 +-- src/libsyntax/ext/source_util.rs | 9 +- src/libsyntax/parse/common.rs | 6 +- src/libsyntax/parse/eval.rs | 16 ++-- src/libsyntax/parse/parser.rs | 28 +++--- src/libsyntax/print/pprust.rs | 72 +++++++-------- src/libsyntax/visit.rs | 4 +- src/rustc/back/link.rs | 55 ++++++------ src/rustc/driver/driver.rs | 18 ++-- src/rustc/driver/session.rs | 6 +- src/rustc/front/core_inject.rs | 4 +- src/rustc/front/test.rs | 36 ++++---- src/rustc/metadata/common.rs | 2 +- src/rustc/metadata/creader.rs | 36 ++++---- src/rustc/metadata/csearch.rs | 10 ++- src/rustc/metadata/cstore.rs | 26 +++--- src/rustc/metadata/decoder.rs | 46 +++++----- src/rustc/metadata/encoder.rs | 77 ++++++++-------- src/rustc/metadata/loader.rs | 10 +-- src/rustc/metadata/tydecode.rs | 6 +- src/rustc/metadata/tyencode.rs | 4 +- src/rustc/middle/astencode.rs | 8 +- src/rustc/middle/borrowck.rs | 4 +- src/rustc/middle/borrowck/categorization.rs | 7 +- src/rustc/middle/capture.rs | 6 +- src/rustc/middle/check_alt.rs | 6 +- src/rustc/middle/const_eval.rs | 4 +- src/rustc/middle/lint.rs | 4 +- src/rustc/middle/liveness.rs | 43 ++++----- src/rustc/middle/pat_util.rs | 4 +- src/rustc/middle/resolve.rs | 97 +++++++++++---------- src/rustc/middle/trans/alt.rs | 10 +-- src/rustc/middle/trans/base.rs | 44 +++++----- src/rustc/middle/trans/closure.rs | 4 +- src/rustc/middle/trans/common.rs | 4 +- src/rustc/middle/trans/debuginfo.rs | 14 +-- src/rustc/middle/trans/native.rs | 10 +-- src/rustc/middle/trans/reflect.rs | 8 +- src/rustc/middle/trans/shape.rs | 2 +- src/rustc/middle/trans/tvec.rs | 18 ++-- src/rustc/middle/trans/type_use.rs | 2 +- src/rustc/middle/tstate/auxiliary.rs | 12 +-- src/rustc/middle/tstate/collect_locals.rs | 2 +- src/rustc/middle/tstate/states.rs | 2 +- src/rustc/middle/ty.rs | 24 ++--- src/rustc/middle/typeck/check.rs | 30 +++---- src/rustc/middle/typeck/check/alt.rs | 6 +- src/rustc/middle/typeck/check/method.rs | 2 +- src/rustc/middle/typeck/check/regionck.rs | 2 +- src/rustc/middle/typeck/collect.rs | 14 +-- src/rustc/middle/typeck/rscope.rs | 14 +-- src/rustc/util/common.rs | 2 +- src/rustc/util/ppaux.rs | 6 +- src/rustdoc/attr_parser.rs | 5 +- src/rustdoc/attr_pass.rs | 6 +- src/rustdoc/extract.rs | 10 +-- src/rustdoc/prune_unexported_pass.rs | 4 +- src/rustdoc/reexport_pass.rs | 8 +- src/rustdoc/tystr_pass.rs | 10 +-- 74 files changed, 629 insertions(+), 603 deletions(-) diff --git a/src/cargo/cargo.rs b/src/cargo/cargo.rs index 2bfde838bce43..0174af3f500d8 100644 --- a/src/cargo/cargo.rs +++ b/src/cargo/cargo.rs @@ -224,10 +224,10 @@ fn load_link(mis: [@ast::meta_item]) -> (option, for mis.each {|a| alt a.node { ast::meta_name_value(v, {node: ast::lit_str(s), span: _}) { - alt v { - "name" { name = some(s); } - "vers" { vers = some(s); } - "uuid" { uuid = some(s); } + alt *v { + "name" { name = some(*s); } + "vers" { vers = some(*s); } + "uuid" { uuid = some(*s); } _ { } } } @@ -259,15 +259,15 @@ fn load_crate(filename: str) -> option { for c.node.attrs.each {|a| alt a.node.value.node { ast::meta_name_value(v, {node: ast::lit_str(s), span: _}) { - alt v { - "desc" { desc = some(v); } - "sigs" { sigs = some(v); } - "crate_type" { crate_type = some(v); } + alt *v { + "desc" { desc = some(*v); } + "sigs" { sigs = some(*v); } + "crate_type" { crate_type = some(*v); } _ { } } } ast::meta_list(v, mis) { - if v == "link" { + if *v == "link" { let (n, v, u) = load_link(mis); name = n; vers = v; @@ -290,7 +290,7 @@ fn load_crate(filename: str) -> option { ast::view_item_use(ident, metas, id) { let name_items = attr::find_meta_items_by_name(metas, "name"); let m = if name_items.is_empty() { - metas + [attr::mk_name_value_item_str("name", ident)] + metas + [attr::mk_name_value_item_str(@"name", *ident)] } else { metas }; @@ -303,9 +303,9 @@ fn load_crate(filename: str) -> option { some(value) { let name = attr::get_meta_item_name(item); - alt name { - "vers" { attr_vers = value; } - "from" { attr_from = value; } + alt *name { + "vers" { attr_vers = *value; } + "from" { attr_from = *value; } _ {} } } @@ -317,11 +317,11 @@ fn load_crate(filename: str) -> option { attr_from } else { if !str::is_empty(attr_vers) { - attr_name + "@" + attr_vers - } else { attr_name } + *attr_name + "@" + attr_vers + } else { *attr_name } }; - alt attr_name { + alt *attr_name { "std" | "core" { } _ { e.deps += [query]; } } diff --git a/src/fuzzer/fuzzer.rs b/src/fuzzer/fuzzer.rs index 7e30d81709eeb..efef3233685a5 100644 --- a/src/fuzzer/fuzzer.rs +++ b/src/fuzzer/fuzzer.rs @@ -45,7 +45,7 @@ fn common_exprs() -> [ast::expr] { dse(ast::expr_cont), dse(ast::expr_fail(option::none)), dse(ast::expr_fail(option::some( - @dse(ast::expr_lit(@dsl(ast::lit_str("boo"))))))), + @dse(ast::expr_lit(@dsl(ast::lit_str(@"boo"))))))), dse(ast::expr_ret(option::none)), dse(ast::expr_lit(@dsl(ast::lit_nil))), dse(ast::expr_lit(@dsl(ast::lit_bool(false)))), diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 140349089a81d..bfa1fb4a7b6dd 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -2,6 +2,7 @@ import chained::hashmap; export hashmap, hashfn, eqfn, set, map, chained, hashmap, str_hash; +export box_str_hash; export bytes_hash, int_hash, uint_hash, set_add; export hash_from_vec, hash_from_strs, hash_from_bytes; export hash_from_ints, hash_from_uints; @@ -292,6 +293,11 @@ fn str_hash() -> hashmap { ret hashmap(str::hash, str::eq); } +#[doc = "Construct a hashmap for boxed string keys"] +fn box_str_hash() -> hashmap<@str, V> { + ret hashmap({|x: @str|str::hash(*x)}, {|x,y|str::eq(*x,*y)}); +} + #[doc = "Construct a hashmap for byte string keys"] fn bytes_hash() -> hashmap<[u8], V> { ret hashmap(vec::u8::hash, vec::u8::eq); diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index ad1501dd8b0d1..5381a9f345d23 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -30,7 +30,7 @@ fn deserialize_span(_d: D) -> span { type spanned = {node: T, span: span}; #[auto_serialize] -type ident = str; +type ident = @str; // Functions may or may not have names. #[auto_serialize] @@ -399,11 +399,11 @@ type lit = spanned; #[auto_serialize] enum lit_ { - lit_str(str), + lit_str(@str), lit_int(i64, int_ty), lit_uint(u64, uint_ty), lit_int_unsuffixed(i64, int_ty), - lit_float(str, float_ty), + lit_float(@str, float_ty), lit_nil, lit_bool(bool), } diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 10397e795ab7b..98a3a8e7bccab 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -6,14 +6,14 @@ import ast_util::path_to_ident; import ast_util::inlined_item_methods; import diagnostic::span_handler; -enum path_elt { path_mod(str), path_name(str) } +enum path_elt { path_mod(ident), path_name(ident) } type path = [path_elt]; fn path_to_str_with_sep(p: path, sep: str) -> str { let strs = vec::map(p) {|e| alt e { - path_mod(s) { /* FIXME: bad */ copy s } - path_name(s) { /* FIXME: bad */ copy s } + path_mod(s) { /* FIXME: bad */ copy *s } + path_name(s) { /* FIXME: bad */ copy *s } } }; str::connect(strs, sep) @@ -21,9 +21,9 @@ fn path_to_str_with_sep(p: path, sep: str) -> str { fn path_ident_to_str(p: path, i: ident) -> str { if vec::is_empty(p) { - /* FIXME: bad */ copy i + /* FIXME: bad */ copy *i } else { - #fmt["%s::%s", path_to_str(p), i] + #fmt["%s::%s", path_to_str(p), *i] } } @@ -59,7 +59,7 @@ type ctx = {map: map, mut path: path, mut local_id: uint, diag: span_handler}; type vt = visit::vt; -fn extend(cx: ctx, +elt: str) -> @path { +fn extend(cx: ctx, +elt: ident) -> @path { @(cx.path + [path_name(elt)]) } @@ -192,7 +192,7 @@ fn map_item(i: @item, cx: ctx, v: vt) { item_impl(_, _, _, _, ms) { let impl_did = ast_util::local_def(i.id); for ms.each {|m| - map_method(impl_did, extend(cx, /* FIXME: bad */ copy i.ident), m, + map_method(impl_did, extend(cx, i.ident), m, cx); } } @@ -208,7 +208,7 @@ fn map_item(i: @item, cx: ctx, v: vt) { for vs.each {|v| cx.map.insert(v.node.id, node_variant( /* FIXME: bad */ copy v, i, - extend(cx, /* FIXME: bad */ copy i.ident))); + extend(cx, i.ident))); } } item_native_mod(nm) { @@ -229,7 +229,7 @@ fn map_item(i: @item, cx: ctx, v: vt) { vec::iter(ifces) {|p| cx.map.insert(p.id, node_item(i, item_path)); }; let d_id = ast_util::local_def(i.id); - let p = extend(cx, /* FIXME: bad */ copy i.ident); + let p = extend(cx, i.ident); // only need to handle methods vec::iter(ms) {|m| map_method(d_id, p, m, cx); } } @@ -237,9 +237,9 @@ fn map_item(i: @item, cx: ctx, v: vt) { } alt i.node { item_mod(_) | item_native_mod(_) { - cx.path += [path_mod(/* FIXME: bad */ copy i.ident)]; + cx.path += [path_mod(i.ident)]; } - _ { cx.path += [path_name(/* FIXME: bad */ copy i.ident)]; } + _ { cx.path += [path_name(i.ident)]; } } visit::visit_item(i, cx, v); vec::pop(cx.path); @@ -281,11 +281,11 @@ fn node_id_to_str(map: map, id: node_id) -> str { } some(node_method(m, impl_did, path)) { #fmt["method %s in %s (id=%?)", - m.ident, path_to_str(*path), id] + *m.ident, path_to_str(*path), id] } some(node_variant(variant, def_id, path)) { #fmt["variant %s in %s (id=%?)", - variant.node.name, path_to_str(*path), id] + *variant.node.name, path_to_str(*path), id] } some(node_expr(expr)) { #fmt["expr %s (id=%?)", diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 9eee9a33af8f9..d4efdb4bb0d01 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -23,7 +23,10 @@ pure fn dummy_sp() -> span { ret mk_sp(0u, 0u); } pure fn path_name(p: @path) -> str { path_name_i(p.idents) } -pure fn path_name_i(idents: [ident]) -> str { str::connect(idents, "::") } +pure fn path_name_i(idents: [ident]) -> str { + // FIXME: Bad copies + str::connect(idents.map({|i|*i}), "::") +} pure fn path_to_ident(p: @path) -> ident { vec::last(p.idents) } @@ -380,7 +383,7 @@ fn dtor_dec() -> fn_decl { let nil_t = @{id: 0, node: ty_nil, span: dummy_sp()}; // dtor has one argument, of type () {inputs: [{mode: ast::expl(ast::by_ref), - ty: nil_t, ident: "_", id: 0}], + ty: nil_t, ident: @"_", id: 0}], output: nil_t, purity: impure_fn, cf: return_val, constraints: []} } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index af780bc5e3836..9138fed69c8b0 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -47,7 +47,7 @@ export require_unique_names; /* Constructors */ fn mk_name_value_item_str(+name: ast::ident, +value: str) -> @ast::meta_item { - let value_lit = dummy_spanned(ast::lit_str(value)); + let value_lit = dummy_spanned(ast::lit_str(@value)); ret mk_name_value_item(name, value_lit); } @@ -100,12 +100,12 @@ fn get_meta_item_name(meta: @ast::meta_item) -> ast::ident { Gets the string value if the meta_item is a meta_name_value variant containing a string, otherwise none "] -fn get_meta_item_value_str(meta: @ast::meta_item) -> option { +fn get_meta_item_value_str(meta: @ast::meta_item) -> option<@str> { alt meta.node { ast::meta_name_value(_, v) { alt v.node { ast::lit_str(s) { - option::some(/* FIXME bad */ copy s) + option::some(s) } _ { option::none @@ -130,11 +130,11 @@ a tuple containing the name and string value, otherwise `none` "] fn get_name_value_str_pair( item: @ast::meta_item -) -> option<(str, str)> { +) -> option<(ast::ident, @str)> { alt attr::get_meta_item_value_str(item) { some(value) { let name = attr::get_meta_item_name(item); - some((name, /* FIXME bad */ copy value)) + some((name, value)) } none { none } } @@ -146,11 +146,11 @@ fn get_name_value_str_pair( #[doc = " Search a list of attributes and return only those with a specific name "] -fn find_attrs_by_name(attrs: [ast::attribute], +name: ast::ident) -> +fn find_attrs_by_name(attrs: [ast::attribute], +name: str) -> [ast::attribute] { let filter = ( fn@(a: ast::attribute) -> option { - if get_attr_name(a) == name { + if *get_attr_name(a) == name { option::some(a) } else { option::none } } @@ -161,10 +161,10 @@ fn find_attrs_by_name(attrs: [ast::attribute], +name: ast::ident) -> #[doc = " Searcha list of meta items and return only those with a specific name "] -fn find_meta_items_by_name(metas: [@ast::meta_item], +name: ast::ident) -> +fn find_meta_items_by_name(metas: [@ast::meta_item], +name: str) -> [@ast::meta_item] { let filter = fn@(&&m: @ast::meta_item) -> option<@ast::meta_item> { - if get_meta_item_name(m) == name { + if *get_meta_item_name(m) == name { option::some(m) } else { option::none } }; @@ -209,17 +209,17 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool { } } -fn contains_name(metas: [@ast::meta_item], +name: ast::ident) -> bool { +fn contains_name(metas: [@ast::meta_item], +name: str) -> bool { let matches = find_meta_items_by_name(metas, name); ret vec::len(matches) > 0u; } -fn attrs_contains_name(attrs: [ast::attribute], +name: ast::ident) -> bool { +fn attrs_contains_name(attrs: [ast::attribute], +name: str) -> bool { vec::is_not_empty(find_attrs_by_name(attrs, name)) } -fn first_attr_value_str_by_name(attrs: [ast::attribute], +name: ast::ident) - -> option { +fn first_attr_value_str_by_name(attrs: [ast::attribute], +name: str) + -> option<@str> { let mattrs = find_attrs_by_name(attrs, name); if vec::len(mattrs) > 0u { ret get_meta_item_value_str(attr_meta(mattrs[0])); @@ -238,11 +238,11 @@ fn last_meta_item_by_name( fn last_meta_item_value_str_by_name( items: [@ast::meta_item], +name: str -) -> option { +) -> option<@str> { alt last_meta_item_by_name(items, name) { some(item) { alt attr::get_meta_item_value_str(item) { - some(value) { some(/* FIXME bad */ copy value) } + some(value) { some(value) } none { none } } } @@ -285,7 +285,7 @@ fn sort_meta_items(+items: [@ast::meta_item]) -> [@ast::meta_item] { ret vec::from_mut(v); } -fn remove_meta_items_by_name(items: [@ast::meta_item], name: str) -> +fn remove_meta_items_by_name(items: [@ast::meta_item], name: ast::ident) -> [@ast::meta_item] { ret vec::filter_map(items, { @@ -326,17 +326,17 @@ fn native_abi(attrs: [ast::attribute]) -> either { option::none { either::right(ast::native_abi_cdecl) } - option::some("rust-intrinsic") { + option::some(@"rust-intrinsic") { either::right(ast::native_abi_rust_intrinsic) } - option::some("cdecl") { + option::some(@"cdecl") { either::right(ast::native_abi_cdecl) } - option::some("stdcall") { + option::some(@"stdcall") { either::right(ast::native_abi_stdcall) } option::some(t) { - either::left("unsupported abi: " + t) + either::left("unsupported abi: " + *t) } }; } @@ -352,8 +352,8 @@ fn find_inline_attr(attrs: [ast::attribute]) -> inline_attr { // TODO---validate the usage of #[inline] and #[inline(always)] vec::foldl(ia_none, attrs) {|ia,attr| alt attr.node.value.node { - ast::meta_word("inline") { ia_hint } - ast::meta_list("inline", items) { + ast::meta_word(@"inline") { ia_hint } + ast::meta_list(@"inline", items) { if !vec::is_empty(find_meta_items_by_name(items, "always")) { ia_always } else { @@ -373,11 +373,11 @@ fn require_unique_names(diagnostic: span_handler, let name = get_meta_item_name(meta); // FIXME: How do I silence the warnings? --pcw - if map.contains_key(name) { + if map.contains_key(*name) { diagnostic.span_fatal(meta.span, - #fmt["duplicate meta item `%s`", name]); + #fmt["duplicate meta item `%s`", *name]); } - map.insert(name, ()); + map.insert(*name, ()); } } diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs index dc632d6b6ac57..888ff7d4ef294 100644 --- a/src/libsyntax/ext/auto_serialize.rs +++ b/src/libsyntax/ext/auto_serialize.rs @@ -92,7 +92,7 @@ fn expand(cx: ext_ctxt, _mitem: ast::meta_item, in_items: [@ast::item]) -> [@ast::item] { fn not_auto_serialize(a: ast::attribute) -> bool { - attr::get_attr_name(a) != "auto_serialize" + attr::get_attr_name(a) != @"auto_serialize" } fn filter_attrs(item: @ast::item) -> @ast::item { @@ -126,18 +126,19 @@ impl helpers for ext_ctxt { helper_name: str) -> @ast::path { let head = vec::init(base_path.idents); let tail = vec::last(base_path.idents); - self.path(base_path.span, head + [helper_name + "_" + tail]) + self.path(base_path.span, head + [@(helper_name + "_" + *tail)]) } - fn path(span: span, strs: [str]) -> @ast::path { + fn path(span: span, strs: [ast::ident]) -> @ast::path { @{span: span, global: false, idents: strs, rp: none, types: []} } - fn path_tps(span: span, strs: [str], tps: [@ast::ty]) -> @ast::path { + fn path_tps(span: span, strs: [ast::ident], + tps: [@ast::ty]) -> @ast::path { @{span: span, global: false, idents: strs, rp: none, types: tps} } - fn ty_path(span: span, strs: [str], tps: [@ast::ty]) -> @ast::ty { + fn ty_path(span: span, strs: [ast::ident], tps: [@ast::ty]) -> @ast::ty { @{id: self.next_id(), node: ast::ty_path(self.path_tps(span, strs, tps), self.next_id()), span: span} @@ -149,7 +150,7 @@ impl helpers for ext_ctxt { let args = vec::map(input_tys) {|ty| {mode: ast::expl(ast::by_ref), ty: ty, - ident: "", + ident: @"", id: self.next_id()} }; @@ -170,7 +171,7 @@ impl helpers for ext_ctxt { @{id: self.next_id(), node: node, span: span} } - fn var_ref(span: span, name: str) -> @ast::expr { + fn var_ref(span: span, name: ast::ident) -> @ast::expr { self.expr(span, ast::expr_path(self.path(span, [name]))) } @@ -192,7 +193,7 @@ impl helpers for ext_ctxt { span: expr.span} } - fn binder_pat(span: span, nm: str) -> @ast::pat { + fn binder_pat(span: span, nm: ast::ident) -> @ast::pat { let path = @{span: span, global: false, idents: [nm], rp: none, types: []}; @{id: self.next_id(), @@ -212,7 +213,7 @@ impl helpers for ext_ctxt { ast::expr_alt(v, arms, ast::alt_exhaustive))) } - fn lit_str(span: span, s: str) -> @ast::expr { + fn lit_str(span: span, s: @str) -> @ast::expr { self.expr( span, ast::expr_lit( @@ -310,7 +311,7 @@ fn ser_variant(cx: ext_ctxt, bodyfn: fn(-@ast::expr, ast::blk) -> @ast::expr, argfn: fn(-@ast::expr, uint, ast::blk) -> @ast::expr) -> ast::arm { - let vnames = vec::from_fn(vec::len(tys)) {|i| #fmt["__v%u", i]}; + let vnames = vec::from_fn(vec::len(tys)) {|i| @#fmt["__v%u", i]}; let pats = vec::from_fn(vec::len(tys)) {|i| cx.binder_pat(tys[i].span, vnames[i]) }; @@ -428,7 +429,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map, vec::is_empty(path.types) { let ident = path.idents[0]; - alt tps.find(ident) { + alt tps.find(*ident) { some(f) { f(v) } none { ser_path(cx, tps, path, s, v) } } @@ -474,7 +475,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map, } } -fn mk_ser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], +fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident, tps: [ast::ty_param], f: fn(ext_ctxt, ser_tps_map, -@ast::expr, -@ast::expr) -> [@ast::stmt]) -> @ast::item { @@ -489,7 +490,7 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], ty: cx.ty_fn(span, [cx.ty_path(span, [tp.ident], [])], cx.ty_nil(span)), - ident: "__s" + tp.ident, + ident: @("__s" + *tp.ident), id: cx.next_id()}}); #debug["tp_inputs = %?", tp_inputs]; @@ -497,12 +498,12 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], let ser_inputs: [ast::arg] = [{mode: ast::expl(ast::by_ref), - ty: cx.ty_path(span, ["__S"], []), - ident: "__s", + ty: cx.ty_path(span, [@"__S"], []), + ident: @"__s", id: cx.next_id()}, {mode: ast::expl(ast::by_ref), ty: v_ty, - ident: "__v", + ident: @"__v", id: cx.next_id()}] + tp_inputs; @@ -510,21 +511,21 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], vec::iter2(tps, tp_inputs) {|tp, arg| let arg_ident = arg.ident; tps_map.insert( - tp.ident, + *tp.ident, fn@(v: @ast::expr) -> [@ast::stmt] { let f = cx.var_ref(span, arg_ident); - #debug["serializing type arg %s", arg_ident]; + #debug["serializing type arg %s", *arg_ident]; [#ast(stmt){$(f)($(v));}] }); } let ser_bnds = @[ ast::bound_iface(cx.ty_path(span, - ["std", "serialization", "serializer"], + [@"std", @"serialization", @"serializer"], []))]; let ser_tps: [ast::ty_param] = - [{ident: "__S", + [{ident: @"__S", id: cx.next_id(), bounds: ser_bnds}] + vec::map(tps) {|tp| cx.clone_ty_param(tp) }; @@ -536,7 +537,7 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], let ser_blk = cx.blk(span, f(cx, tps_map, #ast{ __s }, #ast{ __v })); - @{ident: "serialize_" + name, + @{ident: @("serialize_" + *name), attrs: [], id: cx.next_id(), node: ast::item_fn({inputs: ser_inputs, @@ -651,7 +652,7 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map, vec::is_empty(path.types) { let ident = path.idents[0]; - alt tps.find(ident) { + alt tps.find(*ident) { some(f) { f() } none { deser_path(cx, tps, path, d) } } @@ -683,7 +684,8 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map, } } -fn mk_deser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], +fn mk_deser_fn(cx: ext_ctxt, span: span, + name: ast::ident, tps: [ast::ty_param], f: fn(ext_ctxt, deser_tps_map, -@ast::expr) -> @ast::expr) -> @ast::item { let ext_cx = cx; // required for #ast @@ -697,15 +699,15 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], ty: cx.ty_fn(span, [], cx.ty_path(span, [tp.ident], [])), - ident: "__d" + tp.ident, + ident: @("__d" + *tp.ident), id: cx.next_id()}}); #debug["tp_inputs = %?", tp_inputs]; let deser_inputs: [ast::arg] = [{mode: ast::expl(ast::by_ref), - ty: cx.ty_path(span, ["__D"], []), - ident: "__d", + ty: cx.ty_path(span, [@"__D"], []), + ident: @"__d", id: cx.next_id()}] + tp_inputs; @@ -713,7 +715,7 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], vec::iter2(tps, tp_inputs) {|tp, arg| let arg_ident = arg.ident; tps_map.insert( - tp.ident, + *tp.ident, fn@() -> @ast::expr { let f = cx.var_ref(span, arg_ident); #ast{ $(f)() } @@ -721,12 +723,13 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], } let deser_bnds = @[ - ast::bound_iface(cx.ty_path(span, - ["std", "serialization", "deserializer"], - []))]; + ast::bound_iface(cx.ty_path( + span, + [@"std", @"serialization", @"deserializer"], + []))]; let deser_tps: [ast::ty_param] = - [{ident: "__D", + [{ident: @"__D", id: cx.next_id(), bounds: deser_bnds}] + vec::map(tps) {|tp| let cloned = cx.clone_ty_param(tp); @@ -735,7 +738,7 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], let deser_blk = cx.expr_blk(f(cx, tps_map, #ast(expr){__d})); - @{ident: "deserialize_" + name, + @{ident: @("deserialize_" + *name), attrs: [], id: cx.next_id(), node: ast::item_fn({inputs: deser_inputs, @@ -749,7 +752,7 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], span: span} } -fn ty_fns(cx: ext_ctxt, name: str, ty: @ast::ty, tps: [ast::ty_param]) +fn ty_fns(cx: ext_ctxt, name: ast::ident, ty: @ast::ty, tps: [ast::ty_param]) -> [@ast::item] { let span = ty.span; @@ -759,7 +762,7 @@ fn ty_fns(cx: ext_ctxt, name: str, ty: @ast::ty, tps: [ast::ty_param]) ] } -fn ser_enum(cx: ext_ctxt, tps: ser_tps_map, e_name: str, +fn ser_enum(cx: ext_ctxt, tps: ser_tps_map, e_name: ast::ident, e_span: span, variants: [ast::variant], -s: @ast::expr, -v: @ast::expr) -> [@ast::stmt] { let ext_cx = cx; @@ -808,7 +811,7 @@ fn ser_enum(cx: ext_ctxt, tps: ser_tps_map, e_name: str, [#ast(stmt){ $(s).emit_enum($(e_name), $(lam)) }] } -fn deser_enum(cx: ext_ctxt, tps: deser_tps_map, e_name: str, +fn deser_enum(cx: ext_ctxt, tps: deser_tps_map, e_name: ast::ident, e_span: span, variants: [ast::variant], -d: @ast::expr) -> @ast::expr { let ext_cx = cx; @@ -852,7 +855,7 @@ fn deser_enum(cx: ext_ctxt, tps: deser_tps_map, e_name: str, #ast{ $(d).read_enum($(e_name), $(read_lambda)) } } -fn enum_fns(cx: ext_ctxt, e_name: str, e_span: span, +fn enum_fns(cx: ext_ctxt, e_name: ast::ident, e_span: span, variants: [ast::variant], tps: [ast::ty_param]) -> [@ast::item] { [ diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 29e20212d663a..e39f97452490a 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -9,7 +9,7 @@ type syntax_expander_ = type syntax_expander = { expander: syntax_expander_, span: option}; -type macro_def = {ident: str, ext: syntax_extension}; +type macro_def = {ident: ast::ident, ext: syntax_extension}; type macro_definer = fn@(ext_ctxt, span, ast::mac_arg, ast::mac_body) -> macro_def; type item_decorator = @@ -150,7 +150,7 @@ fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, error: str) -> str { alt expr.node { ast::expr_lit(l) { alt l.node { - ast::lit_str(s) { ret s; } + ast::lit_str(s) { ret *s; } _ { cx.span_fatal(l.span, error); } } } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 516deb1e7938e..69f7f2b69cda2 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -6,7 +6,7 @@ fn mk_lit(cx: ext_ctxt, sp: span, lit: ast::lit_) -> @ast::expr { ret @{id: cx.next_id(), node: ast::expr_lit(sp_lit), span: sp}; } fn mk_str(cx: ext_ctxt, sp: span, s: str) -> @ast::expr { - let lit = ast::lit_str(s); + let lit = ast::lit_str(@s); ret mk_lit(cx, sp, lit); } fn mk_int(cx: ext_ctxt, sp: span, i: int) -> @ast::expr { diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs index 278321ec8bcaa..faf8e1a08683f 100644 --- a/src/libsyntax/ext/concat_idents.rs +++ b/src/libsyntax/ext/concat_idents.rs @@ -3,13 +3,13 @@ import base::*; fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, _body: ast::mac_body) -> @ast::expr { let args = get_mac_args_no_max(cx,sp,arg,1u,"concat_idents"); - let mut res: ast::ident = ""; + let mut res = ""; for args.each {|e| - res += expr_to_ident(cx, e, "expected an ident"); + res += *expr_to_ident(cx, e, "expected an ident"); } ret @{id: cx.next_id(), - node: ast::expr_path(@{span: sp, global: false, idents: [res], + node: ast::expr_path(@{span: sp, global: false, idents: [@res], rp: none, types: []}), span: sp}; } diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index 6a4d937f08375..ebb56fa3b5856 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -21,8 +21,8 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, } } -fn make_new_str(cx: ext_ctxt, sp: codemap::span, s: str) -> @ast::expr { - ret make_new_lit(cx, sp, ast::lit_str(s)); +fn make_new_str(cx: ext_ctxt, sp: codemap::span, +s: str) -> @ast::expr { + ret make_new_lit(cx, sp, ast::lit_str(@s)); } // // Local Variables: diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 90487e279565c..8bc1f7a3433df 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -21,21 +21,21 @@ fn expand_expr(exts: hashmap, cx: ext_ctxt, mac_invoc(pth, args, body) { assert (vec::len(pth.idents) > 0u); let extname = pth.idents[0]; - alt exts.find(extname) { + alt exts.find(*extname) { none { cx.span_fatal(pth.span, - #fmt["macro undefined: '%s'", extname]) + #fmt["macro undefined: '%s'", *extname]) } some(item_decorator(_)) { cx.span_fatal( pth.span, - #fmt["%s can only be used as a decorator", extname]); + #fmt["%s can only be used as a decorator", *extname]); } some(normal({expander: exp, span: exp_sp})) { let expanded = exp(cx, pth.span, args, body); cx.bt_push(expanded_from({call_site: s, - callie: {name: extname, span: exp_sp}})); + callie: {name: *extname, span: exp_sp}})); //keep going, outside-in let fully_expanded = fld.fold_expr(expanded).node; cx.bt_pop(); @@ -44,7 +44,7 @@ fn expand_expr(exts: hashmap, cx: ext_ctxt, } some(macro_defining(ext)) { let named_extension = ext(cx, pth.span, args, body); - exts.insert(named_extension.ident, named_extension.ext); + exts.insert(*named_extension.ident, named_extension.ext); (ast::expr_rec([], none), s) } } @@ -74,7 +74,7 @@ fn expand_mod_items(exts: hashmap, cx: ext_ctxt, ast::meta_name_value(n, _) { n } ast::meta_list(n, _) { n } }; - alt exts.find(mname) { + alt exts.find(*mname) { none | some(normal(_)) | some(macro_defining(_)) { items } diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs index aceeed4b9e844..4725f5a1977f3 100644 --- a/src/libsyntax/ext/fmt.rs +++ b/src/libsyntax/ext/fmt.rs @@ -36,9 +36,10 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: ast::mac_arg, fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr]) -> @ast::expr { fn make_path_vec(_cx: ext_ctxt, ident: ast::ident) -> [ast::ident] { - ret ["extfmt", "rt", ident]; + ret [@"extfmt", @"rt", ident]; } - fn make_rt_path_expr(cx: ext_ctxt, sp: span, ident: str) -> @ast::expr { + fn make_rt_path_expr(cx: ext_ctxt, sp: span, + ident: ast::ident) -> @ast::expr { let path = make_path_vec(cx, ident); ret mk_path(cx, sp, path); } @@ -57,18 +58,18 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr]) flag_sign_always { fstr = "flag_sign_always"; } flag_alternate { fstr = "flag_alternate"; } } - flagexprs += [make_rt_path_expr(cx, sp, fstr)]; + flagexprs += [make_rt_path_expr(cx, sp, @fstr)]; } ret mk_vec_e(cx, sp, flagexprs); } fn make_count(cx: ext_ctxt, sp: span, cnt: count) -> @ast::expr { alt cnt { count_implied { - ret make_rt_path_expr(cx, sp, "count_implied"); + ret make_rt_path_expr(cx, sp, @"count_implied"); } count_is(c) { let count_lit = mk_int(cx, sp, c); - let count_is_path = make_path_vec(cx, "count_is"); + let count_is_path = make_path_vec(cx, @"count_is"); let count_is_args = [count_lit]; ret mk_call(cx, sp, count_is_path, count_is_args); } @@ -88,16 +89,16 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr]) ty_octal { rt_type = "ty_octal"; } _ { rt_type = "ty_default"; } } - ret make_rt_path_expr(cx, sp, rt_type); + ret make_rt_path_expr(cx, sp, @rt_type); } fn make_conv_rec(cx: ext_ctxt, sp: span, flags_expr: @ast::expr, width_expr: @ast::expr, precision_expr: @ast::expr, ty_expr: @ast::expr) -> @ast::expr { ret mk_rec_e(cx, sp, - [{ident: "flags", ex: flags_expr}, - {ident: "width", ex: width_expr}, - {ident: "precision", ex: precision_expr}, - {ident: "ty", ex: ty_expr}]); + [{ident: @"flags", ex: flags_expr}, + {ident: @"width", ex: width_expr}, + {ident: @"precision", ex: precision_expr}, + {ident: @"ty", ex: ty_expr}]); } let rt_conv_flags = make_flags(cx, sp, cnv.flags); let rt_conv_width = make_count(cx, sp, cnv.width); @@ -109,7 +110,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr]) fn make_conv_call(cx: ext_ctxt, sp: span, conv_type: str, cnv: conv, arg: @ast::expr) -> @ast::expr { let fname = "conv_" + conv_type; - let path = make_path_vec(cx, fname); + let path = make_path_vec(cx, @fname); let cnv_expr = make_rt_conv_expr(cx, sp, cnv); let args = [cnv_expr, arg]; ret mk_call(cx, arg.span, path, args); diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index 1a7ae69e79df4..316ac7603fb0f 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -35,7 +35,7 @@ impl of qq_helper for @ast::crate { fn visit(cx: aq_ctxt, v: vt) {visit_crate(*self, cx, v);} fn extract_mac() -> option {fail} fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_crate"]) + mk_path(cx, sp, [@"syntax", @"ext", @"qquote", @"parse_crate"]) } fn get_fold_fn() -> str {"fold_crate"} } @@ -49,7 +49,7 @@ impl of qq_helper for @ast::expr { } } fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_expr"]) + mk_path(cx, sp, [@"syntax", @"ext", @"qquote", @"parse_expr"]) } fn get_fold_fn() -> str {"fold_expr"} } @@ -63,7 +63,7 @@ impl of qq_helper for @ast::ty { } } fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_ty"]) + mk_path(cx, sp, [@"syntax", @"ext", @"qquote", @"parse_ty"]) } fn get_fold_fn() -> str {"fold_ty"} } @@ -72,7 +72,7 @@ impl of qq_helper for @ast::item { fn visit(cx: aq_ctxt, v: vt) {visit_item(self, cx, v);} fn extract_mac() -> option {fail} fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_item"]) + mk_path(cx, sp, [@"syntax", @"ext", @"qquote", @"parse_item"]) } fn get_fold_fn() -> str {"fold_item"} } @@ -81,7 +81,7 @@ impl of qq_helper for @ast::stmt { fn visit(cx: aq_ctxt, v: vt) {visit_stmt(self, cx, v);} fn extract_mac() -> option {fail} fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_stmt"]) + mk_path(cx, sp, [@"syntax", @"ext", @"qquote", @"parse_stmt"]) } fn get_fold_fn() -> str {"fold_stmt"} } @@ -90,7 +90,7 @@ impl of qq_helper for @ast::pat { fn visit(cx: aq_ctxt, v: vt) {visit_pat(self, cx, v);} fn extract_mac() -> option {fail} fn mk_parse_fn(cx: ext_ctxt, sp: span) -> @ast::expr { - mk_path(cx, sp, ["syntax", "ext", "qquote", "parse_pat"]) + mk_path(cx, sp, [@"syntax", @"ext", @"qquote", @"parse_pat"]) } fn get_fold_fn() -> str {"fold_pat"} } @@ -146,7 +146,7 @@ fn expand_ast(ecx: ext_ctxt, _sp: span, } alt (args[0].node) { ast::expr_path(@{idents: id, _}) if vec::len(id) == 1u - {what = id[0]} + {what = *id[0]} _ {ecx.span_fatal(args[0].span, "expected an identifier");} } } @@ -230,20 +230,21 @@ fn finish let cx = ecx; let cfg_call = {|| - mk_call_(cx, sp, mk_access(cx, sp, ["ext_cx"], "cfg"), []) + mk_call_(cx, sp, mk_access(cx, sp, [@"ext_cx"], @"cfg"), []) }; let parse_sess_call = {|| - mk_call_(cx, sp, mk_access(cx, sp, ["ext_cx"], "parse_sess"), []) + mk_call_(cx, sp, mk_access(cx, sp, [@"ext_cx"], @"parse_sess"), []) }; let pcall = mk_call(cx,sp, - ["syntax", "parse", "parser", - "parse_from_source_str"], + [@"syntax", @"parse", @"parser", + @"parse_from_source_str"], [node.mk_parse_fn(cx,sp), mk_str(cx,sp, fname), mk_call(cx,sp, - ["syntax","ext","qquote", "mk_file_substr"], + [@"syntax",@"ext", + @"qquote", @"mk_file_substr"], [mk_str(cx,sp, loc.file.name), mk_uint(cx,sp, loc.line), mk_uint(cx,sp, loc.col)]), @@ -255,15 +256,16 @@ fn finish let mut rcall = pcall; if (g_len > 0u) { rcall = mk_call(cx,sp, - ["syntax", "ext", "qquote", "replace"], + [@"syntax", @"ext", @"qquote", @"replace"], [pcall, mk_vec_e(cx,sp, qcx.gather.map_to_vec {|g| mk_call(cx,sp, - ["syntax", "ext", "qquote", g.constr], + [@"syntax", @"ext", + @"qquote", @g.constr], [g.e])}), mk_path(cx,sp, - ["syntax", "ext", "qquote", - node.get_fold_fn()])]); + [@"syntax", @"ext", @"qquote", + @node.get_fold_fn()])]); } ret rcall; } diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index 764c484c8e39b..e2d16299b22e9 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -1,5 +1,5 @@ import codemap::span; -import std::map::{hashmap, str_hash}; +import std::map::{hashmap, str_hash, box_str_hash}; import dvec::{dvec, extensions}; import base::*; @@ -146,7 +146,7 @@ fn acumm_bindings(_cx: ext_ctxt, _b_dest: bindings, _b_src: bindings) { } fn pattern_to_selectors(cx: ext_ctxt, e: @expr) -> binders { let res: binders = - {real_binders: str_hash::(), + {real_binders: box_str_hash::(), literal_ast_matchers: dvec()}; //this oughta return binders instead, but macro args are a sequence of //expressions, rather than a single expression @@ -162,7 +162,7 @@ bindings. Most of the work is done in p_t_s, which generates the selectors. */ fn use_selectors_to_bind(b: binders, e: @expr) -> option { - let res = str_hash::>(); + let res = box_str_hash::>(); //need to do this first, to check vec lengths. for b.literal_ast_matchers.each {|sel| alt sel(match_expr(e)) { none { ret none; } _ { } } @@ -240,7 +240,7 @@ fn follow_for_trans(cx: ext_ctxt, mmaybe: option>, /* helper for transcribe_exprs: what vars from `b` occur in `e`? */ fn free_vars(b: bindings, e: @expr, it: fn(ident)) { - let idents: hashmap = str_hash::<()>(); + let idents: hashmap = box_str_hash::<()>(); fn mark_ident(&&i: ident, _fld: ast_fold, b: bindings, idents: hashmap) -> ident { if b.contains_key(i) { idents.insert(i, ()); } @@ -282,8 +282,8 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut [uint], let len = vec::len(*ms); if old_len != len { let msg = - #fmt["'%s' occurs %u times, but ", fv, len] + - #fmt["'%s' occurs %u times", old_name, + #fmt["'%s' occurs %u times, but ", *fv, len] + + #fmt["'%s' occurs %u times", *old_name, old_len]; cx.span_fatal(repeat_me.span, msg); } @@ -672,7 +672,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg, _body: ast::mac_body) -> base::macro_def { let args = get_mac_args_no_max(cx, sp, arg, 0u, "macro"); - let mut macro_name: option = none; + let mut macro_name: option<@str> = none; let mut clauses: [@clause] = []; for args.each {|arg| alt arg.node { diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 0680194ea6b4b..23c6a3714c37e 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -36,19 +36,20 @@ fn expand_file(cx: ext_ctxt, sp: span, arg: ast::mac_arg, get_mac_args(cx, sp, arg, 0u, option::some(0u), "file"); let { file: @{ name: filename, _ }, _ } = codemap::lookup_char_pos(cx.codemap(), sp.lo); - ret make_new_lit(cx, sp, ast::lit_str(filename)); + ret make_new_lit(cx, sp, ast::lit_str(@filename)); } fn expand_stringify(cx: ext_ctxt, sp: span, arg: ast::mac_arg, _body: ast::mac_body) -> @ast::expr { let args = get_mac_args(cx, sp, arg, 1u, option::some(1u), "stringify"); - ret make_new_lit(cx, sp, ast::lit_str(pprust::expr_to_str(args[0]))); + ret make_new_lit(cx, sp, ast::lit_str(@pprust::expr_to_str(args[0]))); } fn expand_mod(cx: ext_ctxt, sp: span, arg: ast::mac_arg, _body: ast::mac_body) -> @ast::expr { get_mac_args(cx, sp, arg, 0u, option::some(0u), "file"); - ret make_new_lit(cx, sp, ast::lit_str(str::connect(cx.mod_path(), "::"))); + ret make_new_lit(cx, sp, ast::lit_str( + @str::connect(cx.mod_path().map({|x|*x}), "::"))); } fn expand_include(cx: ext_ctxt, sp: span, arg: ast::mac_arg, @@ -75,7 +76,7 @@ fn expand_include_str(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, } } - ret make_new_lit(cx, sp, ast::lit_str(result::unwrap(res))); + ret make_new_lit(cx, sp, ast::lit_str(@result::unwrap(res))); } fn expand_include_bin(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 0520993de745b..c8e62a2245dfb 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -81,7 +81,7 @@ impl parser_common for parser { fn token_is_keyword(word: str, ++tok: token::token) -> bool { self.require_keyword(word); alt tok { - token::IDENT(sid, false) { str::eq(word, self.get_str(sid)) } + token::IDENT(sid, false) { str::eq(word, *self.get_str(sid)) } _ { false } } } @@ -97,7 +97,7 @@ impl parser_common for parser { // workaround LLVM bug #13042 alt @self.token { @token::IDENT(sid, false) { - if str::eq(word, self.get_str(sid)) { + if str::eq(word, *self.get_str(sid)) { self.bump(); ret true; } else { ret false; } @@ -128,7 +128,7 @@ impl parser_common for parser { } } - fn check_restricted_keywords_(w: ast::ident) { + fn check_restricted_keywords_(w: str) { if self.is_restricted_keyword(w) { self.fatal("found `" + w + "` in restricted position"); } diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index 254d5cc5d5d09..4b5632124d858 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -75,7 +75,7 @@ fn parse_companion_mod(cx: ctx, prefix: str, suffix: option) } } -fn cdir_path_opt(id: str, attrs: [ast::attribute]) -> str { +fn cdir_path_opt(id: ast::ident, attrs: [ast::attribute]) -> @str { alt ::attr::first_attr_value_str_by_name(attrs, "path") { some(d) { ret d; @@ -89,11 +89,11 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, &items: [@ast::item]) { alt cdir.node { ast::cdir_src_mod(id, attrs) { - let file_path = cdir_path_opt(id + ".rs", attrs); + let file_path = cdir_path_opt(@(*id + ".rs"), attrs); let full_path = - if path::path_is_absolute(file_path) { - file_path - } else { prefix + path::path_sep() + file_path }; + if path::path_is_absolute(*file_path) { + *file_path + } else { prefix + path::path_sep() + *file_path }; let p0 = new_parser_from_file(cx.sess, cx.cfg, full_path, SOURCE_FILE); let inner_attrs = p0.parse_inner_attrs_and_next(); @@ -112,9 +112,9 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, ast::cdir_dir_mod(id, cdirs, attrs) { let path = cdir_path_opt(id, attrs); let full_path = - if path::path_is_absolute(path) { - path - } else { prefix + path::path_sep() + path }; + if path::path_is_absolute(*path) { + *path + } else { prefix + path::path_sep() + *path }; let (m0, a0) = eval_crate_directives_to_mod( cx, cdirs, full_path, none); let i = diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 828cd5ce7d435..975e90318770a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -151,8 +151,8 @@ class parser { fn warn(m: str) { self.sess.span_diagnostic.span_warn(copy self.span, m) } - fn get_str(i: token::str_num) -> str { - *interner::get(*self.reader.interner, i) + fn get_str(i: token::str_num) -> @str { + interner::get(*self.reader.interner, i) } fn get_id() -> node_id { next_node_id(self.sess) } @@ -178,7 +178,7 @@ class parser { let name = self.parse_value_ident(); p.bump(); name - } else { "" }; + } else { @"" }; {mode: mode, ty: p.parse_ty(false), ident: name, id: p.get_id()} @@ -229,7 +229,7 @@ class parser { fn ident_index(args: [arg], i: ident) -> uint { let mut j = 0u; for args.each {|a| if a.ident == i { ret j; } j += 1u; } - self.fatal("unbound variable `" + i + "` in constraint arg"); + self.fatal("unbound variable `" + *i + "` in constraint arg"); } fn parse_type_constr_arg() -> @ty_constr_arg { @@ -315,7 +315,7 @@ class parser { } } - fn region_from_name(s: option) -> @region { + fn region_from_name(s: option<@str>) -> @region { let r = alt s { some (string) { re_named(string) } none { re_anon } @@ -1858,13 +1858,13 @@ class parser { fn parse_method_name() -> ident { alt copy self.token { - token::BINOP(op) { self.bump(); token::binop_to_str(op) } - token::NOT { self.bump(); "!" } - token::LBRACKET { self.bump(); self.expect(token::RBRACKET); "[]" } + token::BINOP(op) { self.bump(); @token::binop_to_str(op) } + token::NOT { self.bump(); @"!" } + token::LBRACKET { self.bump(); self.expect(token::RBRACKET); @"[]" } _ { let id = self.parse_value_ident(); - if id == "unary" && self.eat(token::BINOP(token::MINUS)) { - "unary-" + if id == @"unary" && self.eat(token::BINOP(token::MINUS)) { + @"unary-" } else { id } } @@ -1969,7 +1969,7 @@ class parser { // Hack. But then, this whole function is in service of a hack. let a_r = alt rp { rp_none { none } - rp_self { some(self.region_from_name(some("self"))) } + rp_self { some(self.region_from_name(some(@"self"))) } }; @{span: s, global: false, idents: [i], @@ -2243,7 +2243,7 @@ class parser { let mut variants: [variant] = []; // Newtype syntax if self.token == token::EQ { - self.check_restricted_keywords_(id); + self.check_restricted_keywords_(*id); self.bump(); let ty = self.parse_ty(false); self.expect(token::SEMI); @@ -2381,7 +2381,7 @@ class parser { let lo = self.span.lo; let first_ident = self.parse_ident(); let mut path = [first_ident]; - #debug("parsed view_path: %s", first_ident); + #debug("parsed view_path: %s", *first_ident); alt self.token { token::EQ { // x = foo::bar @@ -2504,7 +2504,7 @@ class parser { config: self.cfg}); } - fn parse_str() -> str { + fn parse_str() -> @str { alt copy self.token { token::LIT_STR(s) { self.bump(); self.get_str(s) } _ { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 97135a7bb752f..a63e3139b5bbe 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -342,7 +342,7 @@ fn print_region(s: ps, region: @ast::region) { ast::re_anon { word_space(s, "&"); } ast::re_named(name) { word(s.s, "&"); - word_space(s, name); + word_space(s, *name); } } } @@ -382,7 +382,7 @@ fn print_type_ex(s: ps, &&ty: @ast::ty, print_colons: bool) { fn print_field(s: ps, f: ast::ty_field) { cbox(s, indent_unit); print_mutability(s, f.node.mt.mutbl); - word(s.s, f.node.ident); + word(s.s, *f.node.ident); word_space(s, ":"); print_type(s, f.node.mt.ty); end(s); @@ -443,7 +443,7 @@ fn print_item(s: ps, &&item: @ast::item) { alt item.node { ast::item_const(ty, expr) { head(s, "const"); - word_space(s, item.ident + ":"); + word_space(s, *item.ident + ":"); print_type(s, ty); space(s.s); end(s); // end the head-ibox @@ -461,7 +461,7 @@ fn print_item(s: ps, &&item: @ast::item) { } ast::item_mod(_mod) { head(s, "mod"); - word_nbsp(s, item.ident); + word_nbsp(s, *item.ident); bopen(s); print_mod(s, _mod, item.attrs); bclose(s, item.span); @@ -469,7 +469,7 @@ fn print_item(s: ps, &&item: @ast::item) { ast::item_native_mod(nmod) { head(s, "native"); word_nbsp(s, "mod"); - word_nbsp(s, item.ident); + word_nbsp(s, *item.ident); bopen(s); print_native_mod(s, nmod, item.attrs); bclose(s, item.span); @@ -478,7 +478,7 @@ fn print_item(s: ps, &&item: @ast::item) { ibox(s, indent_unit); ibox(s, 0u); word_nbsp(s, "type"); - word(s.s, item.ident); + word(s.s, *item.ident); print_region_param(s, rp); print_type_params(s, params); end(s); // end the inner ibox @@ -492,13 +492,13 @@ fn print_item(s: ps, &&item: @ast::item) { ast::item_enum(variants, params, rp) { let newtype = vec::len(variants) == 1u && - str::eq(item.ident, variants[0].node.name) && + str::eq(*item.ident, *variants[0].node.name) && vec::len(variants[0].node.args) == 1u; if newtype { ibox(s, indent_unit); word_space(s, "enum"); } else { head(s, "enum"); } - word(s.s, item.ident); + word(s.s, *item.ident); print_region_param(s, rp); print_type_params(s, params); space(s.s); @@ -524,7 +524,7 @@ fn print_item(s: ps, &&item: @ast::item) { } ast::item_class(tps, ifaces, items, ctor, m_dtor, rp) { head(s, "class"); - word_nbsp(s, item.ident); + word_nbsp(s, *item.ident); print_region_param(s, rp); print_type_params(s, tps); word_space(s, "implements"); @@ -570,7 +570,7 @@ fn print_item(s: ps, &&item: @ast::item) { ast::class_mutable { word_nbsp(s, "mut"); } _ {} } - word(s.s, nm); + word(s.s, *nm); word_nbsp(s, ":"); print_type(s, t); word(s.s, ";"); @@ -588,7 +588,7 @@ fn print_item(s: ps, &&item: @ast::item) { } ast::item_impl(tps, rp, ifce, ty, methods) { head(s, "impl"); - word(s.s, item.ident); + word(s.s, *item.ident); print_region_param(s, rp); print_type_params(s, tps); space(s.s); @@ -608,7 +608,7 @@ fn print_item(s: ps, &&item: @ast::item) { } ast::item_iface(tps, rp, methods) { head(s, "iface"); - word(s.s, item.ident); + word(s.s, *item.ident); print_region_param(s, rp); print_type_params(s, tps); word(s.s, " "); @@ -627,18 +627,18 @@ fn print_item(s: ps, &&item: @ast::item) { fn print_res(s: ps, decl: ast::fn_decl, name: ast::ident, typarams: [ast::ty_param], rp: ast::region_param) { head(s, "resource"); - word(s.s, name); + word(s.s, *name); print_region_param(s, rp); print_type_params(s, typarams); popen(s); - word_space(s, decl.inputs[0].ident + ":"); + word_space(s, *decl.inputs[0].ident + ":"); print_type(s, decl.inputs[0].ty); pclose(s); space(s.s); } fn print_variant(s: ps, v: ast::variant) { - word(s.s, v.node.name); + word(s.s, *v.node.name); if vec::len(v.node.args) > 0u { popen(s); fn print_variant_arg(s: ps, arg: ast::variant_arg) { @@ -892,7 +892,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) { fn print_field(s: ps, field: ast::field) { ibox(s, indent_unit); if field.node.mutbl == ast::m_mutbl { word_nbsp(s, "mut"); } - word(s.s, field.node.ident); + word(s.s, *field.node.ident); word_space(s, ":"); print_expr(s, field.node.expr); end(s); @@ -1089,7 +1089,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) { print_expr_parens_if_not_bot(s, expr); } word(s.s, "."); - word(s.s, id); + word(s.s, *id); if vec::len(tys) > 0u { word(s.s, "::<"); commasep(s, inconsistent, tys, print_type); @@ -1222,7 +1222,7 @@ fn print_decl(s: ps, decl: @ast::decl) { } } -fn print_ident(s: ps, ident: ast::ident) { word(s.s, ident); } +fn print_ident(s: ps, ident: ast::ident) { word(s.s, *ident); } fn print_for_decl(s: ps, loc: @ast::local, coll: @ast::expr) { print_local_decl(s, loc); @@ -1237,7 +1237,7 @@ fn print_path(s: ps, &&path: @ast::path, colons_before_params: bool) { let mut first = true; for path.idents.each {|id| if first { first = false; } else { word(s.s, "::"); } - word(s.s, id); + word(s.s, *id); } if path.rp.is_some() || !path.types.is_empty() { if colons_before_params { word(s.s, "::"); } @@ -1290,7 +1290,7 @@ fn print_pat(s: ps, &&pat: @ast::pat) { word(s.s, "{"); fn print_field(s: ps, f: ast::field_pat) { cbox(s, indent_unit); - word(s.s, f.ident); + word(s.s, *f.ident); word_space(s, ":"); print_pat(s, f.pat); end(s); @@ -1327,7 +1327,7 @@ fn print_fn(s: ps, decl: ast::fn_decl, name: ast::ident, ast::impure_fn { head(s, "fn") } _ { head(s, purity_to_str(decl.purity) + " fn") } } - word(s.s, name); + word(s.s, *name); print_type_params(s, typarams); print_fn_args_and_ret(s, decl, []); } @@ -1341,7 +1341,7 @@ fn print_fn_args(s: ps, decl: ast::fn_decl, if first { first = false; } else { word_space(s, ","); } if cap_item.is_move { word_nbsp(s, "move") } else { word_nbsp(s, "copy") } - word(s.s, cap_item.name); + word(s.s, *cap_item.name); } } } @@ -1418,7 +1418,7 @@ fn print_type_params(s: ps, &¶ms: [ast::ty_param]) { if vec::len(params) > 0u { word(s.s, "<"); fn printParam(s: ps, param: ast::ty_param) { - word(s.s, param.ident); + word(s.s, *param.ident); print_bounds(s, param.bounds); } commasep(s, inconsistent, params, printParam); @@ -1429,14 +1429,14 @@ fn print_type_params(s: ps, &¶ms: [ast::ty_param]) { fn print_meta_item(s: ps, &&item: @ast::meta_item) { ibox(s, indent_unit); alt item.node { - ast::meta_word(name) { word(s.s, name); } + ast::meta_word(name) { word(s.s, *name); } ast::meta_name_value(name, value) { - word_space(s, name); + word_space(s, *name); word_space(s, "="); print_literal(s, @value); } ast::meta_list(name, items) { - word(s.s, name); + word(s.s, *name); popen(s); commasep(s, consistent, items, print_meta_item); pclose(s); @@ -1449,7 +1449,7 @@ fn print_view_path(s: ps, &&vp: @ast::view_path) { alt vp.node { ast::view_path_simple(ident, path, _) { if path.idents[vec::len(path.idents)-1u] != ident { - word_space(s, ident); + word_space(s, *ident); word_space(s, "="); } print_path(s, path, false); @@ -1464,7 +1464,7 @@ fn print_view_path(s: ps, &&vp: @ast::view_path) { print_path(s, path, false); word(s.s, "::{"); commasep(s, inconsistent, idents) {|s, w| - word(s.s, w.node.name) + word(s.s, *w.node.name) } word(s.s, "}"); } @@ -1481,7 +1481,7 @@ fn print_view_item(s: ps, item: @ast::view_item) { alt item.node { ast::view_item_use(id, mta, _) { head(s, "use"); - word(s.s, id); + word(s.s, *id); if vec::len(mta) > 0u { popen(s); commasep(s, consistent, mta, print_meta_item); @@ -1529,11 +1529,11 @@ fn print_arg(s: ps, input: ast::arg) { print_arg_mode(s, input.mode); alt input.ty.node { ast::ty_infer { - word(s.s, input.ident); + word(s.s, *input.ident); } _ { - if str::len(input.ident) > 0u { - word_space(s, input.ident + ":"); + if str::len(*input.ident) > 0u { + word_space(s, *input.ident + ":"); } print_type(s, input.ty); } @@ -1546,7 +1546,7 @@ fn print_ty_fn(s: ps, opt_proto: option, tps: option<[ast::ty_param]>) { ibox(s, indent_unit); word(s.s, opt_proto_to_str(opt_proto)); - alt id { some(id) { word(s.s, " "); word(s.s, id); } _ { } } + alt id { some(id) { word(s.s, " "); word(s.s, *id); } _ { } } alt tps { some(tps) { print_type_params(s, tps); } _ { } } zerobreak(s.s); popen(s); @@ -1608,7 +1608,7 @@ fn print_literal(s: ps, &&lit: @ast::lit) { _ {} } alt lit.node { - ast::lit_str(st) { print_string(s, st); } + ast::lit_str(st) { print_string(s, *st); } ast::lit_int(ch, ast::ty_char) { word(s.s, "'" + char::escape_default(ch as char) + "'"); } @@ -1640,7 +1640,7 @@ fn print_literal(s: ps, &&lit: @ast::lit) { } } ast::lit_float(f, t) { - word(s.s, f + ast_util::float_ty_to_str(t)); + word(s.s, *f + ast_util::float_ty_to_str(t)); } ast::lit_nil { word(s.s, "()"); } ast::lit_bool(val) { @@ -1804,7 +1804,7 @@ fn constrs_str(constrs: [T], elt: fn(T) -> str) -> str { } fn fn_arg_idx_to_str(decl: ast::fn_decl, &&idx: uint) -> str { - decl.inputs[idx].ident + *decl.inputs[idx].ident } fn opt_proto_to_str(opt_p: option) -> str { diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index fa0286ded812c..8b70848b248b4 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -29,8 +29,8 @@ fn name_of_fn(fk: fn_kind) -> ident { alt fk { fk_item_fn(name, _) | fk_method(name, _, _) | fk_res(name, _, _) | fk_ctor(name, _, _, _) { /* FIXME: bad */ copy name } - fk_anon(*) | fk_fn_block(*) { "anon" } - fk_dtor(*) { "drop" } + fk_anon(*) | fk_fn_block(*) { @"anon" } + fk_dtor(*) { @"drop" } } } diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs index c9f1b706893df..4eccfa80247a7 100644 --- a/src/rustc/back/link.rs +++ b/src/rustc/back/link.rs @@ -291,24 +291,24 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, sha: sha1) -> link_meta { type provided_metas = - {name: option, - vers: option, + {name: option<@str>, + vers: option<@str>, cmh_items: [@ast::meta_item]}; fn provided_link_metas(sess: session, c: ast::crate) -> provided_metas { - let mut name: option = none; - let mut vers: option = none; + let mut name: option<@str> = none; + let mut vers: option<@str> = none; let mut cmh_items: [@ast::meta_item] = []; let linkage_metas = attr::find_linkage_metas(c.node.attrs); attr::require_unique_names(sess.diagnostic(), linkage_metas); for linkage_metas.each {|meta| - if attr::get_meta_item_name(meta) == "name" { + if *attr::get_meta_item_name(meta) == "name" { alt attr::get_meta_item_value_str(meta) { some(v) { name = some(v); } none { cmh_items += [meta]; } } - } else if attr::get_meta_item_name(meta) == "vers" { + } else if *attr::get_meta_item_name(meta) == "vers" { alt attr::get_meta_item_value_str(meta) { some(v) { vers = some(v); } none { cmh_items += [meta]; } @@ -321,7 +321,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, // This calculates CMH as defined above fn crate_meta_extras_hash(sha: sha1, _crate: ast::crate, metas: provided_metas, - dep_hashes: [str]) -> str { + dep_hashes: [@str]) -> str { fn len_and_str(s: str) -> str { ret #fmt["%u_%s", str::len(s), s]; } @@ -337,10 +337,10 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, let m = m_; alt m.node { ast::meta_name_value(key, value) { - sha.input_str(len_and_str(key)); + sha.input_str(len_and_str(*key)); sha.input_str(len_and_str_lit(value)); } - ast::meta_word(name) { sha.input_str(len_and_str(name)); } + ast::meta_word(name) { sha.input_str(len_and_str(*name)); } ast::meta_list(_, _) { // FIXME (#607): Implement this fail "unimplemented meta_item variant"; @@ -349,7 +349,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, } for dep_hashes.each {|dh| - sha.input_str(len_and_str(dh)); + sha.input_str(len_and_str(*dh)); } ret truncated_sha1_result(sha); @@ -362,7 +362,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, } fn crate_meta_name(sess: session, _crate: ast::crate, - output: str, metas: provided_metas) -> str { + output: str, metas: provided_metas) -> @str { ret alt metas.name { some(v) { v } none { @@ -378,19 +378,19 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, str::connect(os, ".") }; warn_missing(sess, "name", name); - name + @name } }; } fn crate_meta_vers(sess: session, _crate: ast::crate, - metas: provided_metas) -> str { + metas: provided_metas) -> @str { ret alt metas.vers { some(v) { v } none { let vers = "0.0"; warn_missing(sess, "vers", vers); - vers + @vers } }; } @@ -417,7 +417,7 @@ fn symbol_hash(tcx: ty::ctxt, sha: sha1, t: ty::t, // to be independent of one another in the crate. sha.reset(); - sha.input_str(link_meta.name); + sha.input_str(*link_meta.name); sha.input_str("-"); sha.input_str(link_meta.extras_hash); sha.input_str("-"); @@ -482,7 +482,7 @@ fn mangle(ss: path) -> str { for ss.each {|s| alt s { path_name(s) | path_mod(s) { - let sani = sanitize(s); + let sani = sanitize(*s); n += #fmt["%u%s", str::len(sani), sani]; } } } @@ -490,33 +490,34 @@ fn mangle(ss: path) -> str { n } -fn exported_name(path: path, hash: str, vers: str) -> str { +fn exported_name(path: path, hash: @str, vers: @str) -> str { ret mangle(path + [path_name(hash)] + [path_name(vers)]); } fn mangle_exported_name(ccx: @crate_ctxt, path: path, t: ty::t) -> str { let hash = get_symbol_hash(ccx, t); - ret exported_name(path, hash, ccx.link_meta.vers); + ret exported_name(path, @hash, ccx.link_meta.vers); } -fn mangle_internal_name_by_type_only(ccx: @crate_ctxt, t: ty::t, name: str) -> +fn mangle_internal_name_by_type_only(ccx: @crate_ctxt, + t: ty::t, name: @str) -> str { - let s = util::ppaux::ty_to_short_str(ccx.tcx, t); + let s = @util::ppaux::ty_to_short_str(ccx.tcx, t); let hash = get_symbol_hash(ccx, t); - ret mangle([path_name(name), path_name(s), path_name(hash)]); + ret mangle([path_name(name), path_name(s), path_name(@hash)]); } fn mangle_internal_name_by_path_and_seq(ccx: @crate_ctxt, path: path, - flav: str) -> str { - ret mangle(path + [path_name(ccx.names(flav))]); + flav: @str) -> str { + ret mangle(path + [path_name(@ccx.names(*flav))]); } fn mangle_internal_name_by_path(_ccx: @crate_ctxt, path: path) -> str { ret mangle(path); } -fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str { - ret ccx.names(flav); +fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: @str) -> str { + ret ccx.names(*flav); } // If the user wants an exe generated we need to invoke @@ -552,8 +553,8 @@ fn link_binary(sess: session, let output = if sess.building_library { let long_libname = os::dll_filename(#fmt("%s-%s-%s", - lm.name, lm.extras_hash, lm.vers)); - #debug("link_meta.name: %s", lm.name); + *lm.name, lm.extras_hash, *lm.vers)); + #debug("link_meta.name: %s", *lm.name); #debug("long_libname: %s", long_libname); #debug("out_filename: %s", out_filename); #debug("dirname(out_filename): %s", path::dirname(out_filename)); diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs index 769f3c40e259e..550e2290bfae8 100644 --- a/src/rustc/driver/driver.rs +++ b/src/rustc/driver/driver.rs @@ -49,14 +49,14 @@ fn default_configuration(sess: session, argv0: str, input: input) -> }; ret [ // Target bindings. - attr::mk_word_item(os::family()), - mk("target_os", os::sysname()), - mk("target_family", os::family()), - mk("target_arch", arch), - mk("target_libc", libc), + attr::mk_word_item(@os::family()), + mk(@"target_os", os::sysname()), + mk(@"target_family", os::family()), + mk(@"target_arch", arch), + mk(@"target_libc", libc), // Build bindings. - mk("build_compiler", argv0), - mk("build_input", source_name(input))]; + mk(@"build_compiler", argv0), + mk(@"build_input", source_name(input))]; } fn build_configuration(sess: session, argv0: str, input: input) -> @@ -70,7 +70,7 @@ fn build_configuration(sess: session, argv0: str, input: input) -> { if sess.opts.test && !attr::contains_name(user_cfg, "test") { - [attr::mk_word_item("test")] + [attr::mk_word_item(@"test")] } else { [] } }; ret user_cfg + gen_cfg + default_cfg; @@ -82,7 +82,7 @@ fn parse_cfgspecs(cfgspecs: [str]) -> ast::crate_cfg { // meta_item here. At the moment we just support the meta_word variant. // #2399 let mut words = []; - for cfgspecs.each {|s| words += [attr::mk_word_item(s)]; } + for cfgspecs.each {|s| words += [attr::mk_word_item(@s)]; } ret words; } diff --git a/src/rustc/driver/session.rs b/src/rustc/driver/session.rs index 07f42a0d26945..ef37c2bea51be 100644 --- a/src/rustc/driver/session.rs +++ b/src/rustc/driver/session.rs @@ -199,7 +199,7 @@ fn building_library(req_crate_type: crate_type, crate: @ast::crate, alt syntax::attr::first_attr_value_str_by_name( crate.node.attrs, "crate_type") { - option::some("lib") { true } + option::some(@"lib") { true } _ { false } } } @@ -227,9 +227,9 @@ mod test { style: ast::attr_outer, value: ast_util::respan(ast_util::dummy_sp(), ast::meta_name_value( - "crate_type", + @"crate_type", ast_util::respan(ast_util::dummy_sp(), - ast::lit_str(t)))) + ast::lit_str(@t)))) }) } diff --git a/src/rustc/front/core_inject.rs b/src/rustc/front/core_inject.rs index 590a371da07e1..bc7048f8f0976 100644 --- a/src/rustc/front/core_inject.rs +++ b/src/rustc/front/core_inject.rs @@ -30,11 +30,11 @@ fn inject_libcore_ref(sess: session, let n1 = sess.next_node_id(); let n2 = sess.next_node_id(); - let vi1 = @{node: ast::view_item_use("core", [], n1), + let vi1 = @{node: ast::view_item_use(@"core", [], n1), attrs: [], vis: ast::public, span: dummy_sp()}; - let vp = spanned(ast::view_path_glob(ident_to_path(dummy_sp(), "core"), + let vp = spanned(ast::view_path_glob(ident_to_path(dummy_sp(), @"core"), n2)); let vi2 = @{node: ast::view_item_import([vp]), attrs: [], diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index 2cb144a60b5cd..44b9356896beb 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -70,7 +70,7 @@ fn fold_mod(_cx: test_ctxt, m: ast::_mod, fld: fold::ast_fold) -> ast::_mod { fn nomain(&&item: @ast::item) -> option<@ast::item> { alt item.node { ast::item_fn(_, _, _) { - if item.ident == "main" { + if *item.ident == "main" { option::none } else { option::some(item) } } @@ -190,9 +190,9 @@ fn mk_test_module(cx: test_ctxt) -> @ast::item { let item_ = ast::item_mod(testmod); // This attribute tells resolve to let us call unexported functions let resolve_unexported_attr = - attr::mk_attr(attr::mk_word_item("!resolve_unexported")); + attr::mk_attr(attr::mk_word_item(@"!resolve_unexported")); let item: ast::item = - {ident: "__test", + {ident: @"__test", attrs: [resolve_unexported_attr], id: cx.sess.next_node_id(), node: item_, @@ -231,7 +231,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item { let item_ = ast::item_fn(decl, [], body); let item: ast::item = - {ident: "tests", + {ident: @"tests", attrs: [], id: cx.sess.next_node_id(), node: item_, @@ -246,16 +246,16 @@ fn mk_path(cx: test_ctxt, path: [ast::ident]) -> [ast::ident] { let is_std = { let items = attr::find_linkage_metas(cx.crate.node.attrs); alt attr::last_meta_item_value_str_by_name(items, "name") { - some("std") { true } + some(@"std") { true } _ { false } } }; - (if is_std { [] } else { ["std"] }) + path + (if is_std { [] } else { [@"std"] }) + path } // The ast::ty of [std::test::test_desc] fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty { - let test_desc_ty_path = path_node(mk_path(cx, ["test", "test_desc"])); + let test_desc_ty_path = path_node(mk_path(cx, [@"test", @"test_desc"])); let test_desc_ty: ast::ty = {id: cx.sess.next_node_id(), @@ -288,14 +288,14 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { #debug("encoding %s", ast_util::path_name_i(path)); let name_lit: ast::lit = - nospan(ast::lit_str(ast_util::path_name_i(path))); + nospan(ast::lit_str(@ast_util::path_name_i(path))); let name_expr: ast::expr = {id: cx.sess.next_node_id(), node: ast::expr_lit(@name_lit), span: span}; let name_field: ast::field = - nospan({mutbl: ast::m_imm, ident: "name", expr: @name_expr}); + nospan({mutbl: ast::m_imm, ident: @"name", expr: @name_expr}); let fn_path = path_node(path); @@ -307,7 +307,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { let fn_wrapper_expr = mk_test_wrapper(cx, fn_expr, span); let fn_field: ast::field = - nospan({mutbl: ast::m_imm, ident: "fn", expr: fn_wrapper_expr}); + nospan({mutbl: ast::m_imm, ident: @"fn", expr: fn_wrapper_expr}); let ignore_lit: ast::lit = nospan(ast::lit_bool(test.ignore)); @@ -317,7 +317,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { span: span}; let ignore_field: ast::field = - nospan({mutbl: ast::m_imm, ident: "ignore", expr: @ignore_expr}); + nospan({mutbl: ast::m_imm, ident: @"ignore", expr: @ignore_expr}); let fail_lit: ast::lit = nospan(ast::lit_bool(test.should_fail)); @@ -327,7 +327,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { span: span}; let fail_field: ast::field = - nospan({mutbl: ast::m_imm, ident: "should_fail", expr: @fail_expr}); + nospan({mutbl: ast::m_imm, ident: @"should_fail", expr: @fail_expr}); let desc_rec_: ast::expr_ = ast::expr_rec([name_field, fn_field, ignore_field, fail_field], @@ -379,7 +379,7 @@ fn mk_test_wrapper(cx: test_ctxt, } fn mk_main(cx: test_ctxt) -> @ast::item { - let str_pt = path_node(["str"]); + let str_pt = path_node([@"str"]); let str_ty = @{id: cx.sess.next_node_id(), node: ast::ty_path(str_pt, cx.sess.next_node_id()), span: dummy_sp()}; @@ -391,7 +391,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { let args_arg: ast::arg = {mode: ast::expl(ast::by_val), ty: @args_ty, - ident: "args", + ident: @"args", id: cx.sess.next_node_id()}; let ret_ty = {id: cx.sess.next_node_id(), @@ -414,7 +414,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { let item_ = ast::item_fn(decl, [], body); let item: ast::item = - {ident: "main", + {ident: @"main", attrs: [], id: cx.sess.next_node_id(), node: item_, @@ -426,7 +426,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { // Get the args passed to main so we can pass the to test_main - let args_path = path_node(["args"]); + let args_path = path_node([@"args"]); let args_path_expr_: ast::expr_ = ast::expr_path(args_path); @@ -434,7 +434,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { {id: cx.sess.next_node_id(), node: args_path_expr_, span: dummy_sp()}; // Call __test::test to generate the vector of test_descs - let test_path = path_node(["tests"]); + let test_path = path_node([@"tests"]); let test_path_expr_: ast::expr_ = ast::expr_path(test_path); @@ -447,7 +447,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { {id: cx.sess.next_node_id(), node: test_call_expr_, span: dummy_sp()}; // Call std::test::test_main - let test_main_path = path_node(mk_path(cx, ["test", "test_main"])); + let test_main_path = path_node(mk_path(cx, [@"test", @"test_main"])); let test_main_path_expr_: ast::expr_ = ast::expr_path(test_main_path); diff --git a/src/rustc/metadata/common.rs b/src/rustc/metadata/common.rs index ba23dd24baa1b..9aa7748c5a4c0 100644 --- a/src/rustc/metadata/common.rs +++ b/src/rustc/metadata/common.rs @@ -132,5 +132,5 @@ fn hash_path(&&s: str) -> uint { ret h; } -type link_meta = {name: str, vers: str, extras_hash: str}; +type link_meta = {name: @str, vers: @str, extras_hash: str}; diff --git a/src/rustc/metadata/creader.rs b/src/rustc/metadata/creader.rs index 3356e8cdd6524..fbb6a18edcde2 100644 --- a/src/rustc/metadata/creader.rs +++ b/src/rustc/metadata/creader.rs @@ -42,7 +42,7 @@ fn read_crates(diag: span_handler, crate: ast::crate, type cache_entry = { cnum: int, span: span, - hash: str, + hash: @str, metas: @[@ast::meta_item] }; @@ -53,7 +53,7 @@ fn dump_crates(crate_cache: dvec) { #debug("span: %?", entry.span); #debug("hash: %?", entry.hash); let attrs = [ - attr::mk_attr(attr::mk_list_item("link", *entry.metas)) + attr::mk_attr(attr::mk_list_item(@"link", *entry.metas)) ]; for attr::find_linkage_attrs(attrs).each {|attr| #debug("meta: %s", pprust::attr_to_str(attr)); @@ -81,11 +81,11 @@ fn warn_if_multiple_versions(diag: span_handler, if matches.len() != 1u { diag.handler().warn( - #fmt("using multiple versions of crate `%s`", name)); + #fmt("using multiple versions of crate `%s`", *name)); for matches.each {|match| diag.span_note(match.span, "used here"); let attrs = [ - attr::mk_attr(attr::mk_list_item("link", *match.metas)) + attr::mk_attr(attr::mk_list_item(@"link", *match.metas)) ]; loader::note_linkage_attrs(diag, attrs); } @@ -129,7 +129,7 @@ fn visit_item(e: env, i: @ast::item) { let native_name = alt attr::first_attr_value_str_by_name(i.attrs, "link_name") { some(nn) { - if nn == "" { + if *nn == "" { e.diag.span_fatal( i.span, "empty #[link_name] not allowed; use #[nolink]."); @@ -140,17 +140,17 @@ fn visit_item(e: env, i: @ast::item) { }; let mut already_added = false; if vec::len(attr::find_attrs_by_name(i.attrs, "nolink")) == 0u { - already_added = !cstore::add_used_library(cstore, native_name); + already_added = !cstore::add_used_library(cstore, *native_name); } let link_args = attr::find_attrs_by_name(i.attrs, "link_args"); if vec::len(link_args) > 0u && already_added { - e.diag.span_fatal(i.span, "library '" + native_name + + e.diag.span_fatal(i.span, "library '" + *native_name + "' already added: can't specify link_args."); } for link_args.each {|a| alt attr::get_meta_item_value_str(attr::attr_meta(a)) { some(linkarg) { - cstore::add_used_link_args(cstore, linkarg); + cstore::add_used_link_args(cstore, *linkarg); } none {/* fallthrough */ } } @@ -160,11 +160,11 @@ fn visit_item(e: env, i: @ast::item) { } } -fn metas_with(ident: ast::ident, key: str, +fn metas_with(ident: ast::ident, key: ast::ident, metas: [@ast::meta_item]) -> [@ast::meta_item] { - let name_items = attr::find_meta_items_by_name(metas, key); + let name_items = attr::find_meta_items_by_name(metas, *key); if name_items.is_empty() { - metas + [attr::mk_name_value_item_str(key, ident)] + metas + [attr::mk_name_value_item_str(key, *ident)] } else { metas } @@ -172,7 +172,7 @@ fn metas_with(ident: ast::ident, key: str, fn metas_with_ident(ident: ast::ident, metas: [@ast::meta_item]) -> [@ast::meta_item] { - metas_with(ident, "name", metas) + metas_with(ident, @"name", metas) } fn existing_match(e: env, metas: [@ast::meta_item], hash: str) -> @@ -180,7 +180,7 @@ fn existing_match(e: env, metas: [@ast::meta_item], hash: str) -> for e.crate_cache.each {|c| if loader::metadata_matches(*c.metas, metas) - && (hash.is_empty() || c.hash == hash) { + && (hash.is_empty() || *c.hash == hash) { ret some(c.cnum); } } @@ -226,7 +226,7 @@ fn resolve_crate(e: env, ident: ast::ident, metas: [@ast::meta_item], option::some(v) { v } option::none { ident } }; - let cmeta = @{name: cname, data: cdata, + let cmeta = @{name: *cname, data: cdata, cnum_map: cnum_map, cnum: cnum}; let cstore = e.cstore; @@ -249,10 +249,10 @@ fn resolve_crate_deps(e: env, cdata: @[u8]) -> cstore::cnum_map { for decoder::get_crate_deps(cdata).each {|dep| let extrn_cnum = dep.cnum; let cname = dep.name; - let cmetas = metas_with(dep.vers, "vers", []); + let cmetas = metas_with(dep.vers, @"vers", []); #debug("resolving dep crate %s ver: %s hash: %s", - dep.name, dep.vers, dep.hash); - alt existing_match(e, metas_with_ident(cname, cmetas), dep.hash) { + *dep.name, *dep.vers, *dep.hash); + alt existing_match(e, metas_with_ident(cname, cmetas), *dep.hash) { some(local_cnum) { #debug("already have it"); // We've already seen this crate @@ -265,7 +265,7 @@ fn resolve_crate_deps(e: env, cdata: @[u8]) -> cstore::cnum_map { // #2404 let fake_span = ast_util::dummy_sp(); let local_cnum = - resolve_crate(e, cname, cmetas, dep.hash, fake_span); + resolve_crate(e, cname, cmetas, *dep.hash, fake_span); cnum_map.insert(extrn_cnum, local_cnum); } } diff --git a/src/rustc/metadata/csearch.rs b/src/rustc/metadata/csearch.rs index 3994d9fa722a5..f65f6110388fa 100644 --- a/src/rustc/metadata/csearch.rs +++ b/src/rustc/metadata/csearch.rs @@ -64,7 +64,7 @@ fn resolve_path(cstore: cstore::cstore, cnum: ast::crate_num, [(ast::crate_num, @[u8], ast::def_id)] { let cm = cstore::get_crate_data(cstore, cnum); #debug("resolve_path %s in crates[%d]:%s", - str::connect(path, "::"), cnum, cm.name); + ast_util::path_name_i(path), cnum, cm.name); let mut result = []; for decoder::resolve_path(path, cm.data).each {|def| if def.crate == ast::local_crate { @@ -88,7 +88,7 @@ fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path { // FIXME #1920: This path is not always correct if the crate is not linked // into the root namespace. - [ast_map::path_mod(cdata.name)] + path + [ast_map::path_mod(@cdata.name)] + path } enum found_ast { @@ -170,7 +170,8 @@ fn get_impl_iface(tcx: ty::ctxt, def: ast::def_id) -> option { decoder::get_impl_iface(cdata, def.node, tcx) } -fn get_impl_method(cstore: cstore::cstore, def: ast::def_id, mname: str) +fn get_impl_method(cstore: cstore::cstore, + def: ast::def_id, mname: ast::ident) -> ast::def_id { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_impl_method(cdata, def.node, mname) @@ -180,7 +181,8 @@ fn get_impl_method(cstore: cstore::cstore, def: ast::def_id, mname: str) for their methods (so that get_iface_methods can be reused to get class methods), classes require a slightly different version of get_impl_method. Sigh. */ -fn get_class_method(cstore: cstore::cstore, def: ast::def_id, mname: str) +fn get_class_method(cstore: cstore::cstore, + def: ast::def_id, mname: ast::ident) -> ast::def_id { let cdata = cstore::get_crate_data(cstore, def.crate); decoder::get_class_method(cdata, def.node, mname) diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index 0bbbeafdb54a0..ebfa8df3b109d 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -37,7 +37,7 @@ type cnum_map = map::hashmap; // Multiple items may have the same def_id in crate metadata. They may be // renamed imports or reexports. This map keeps the "real" module path // and def_id. -type mod_path_map = map::hashmap; +type mod_path_map = map::hashmap; type crate_metadata = @{name: str, data: @[u8], @@ -83,12 +83,12 @@ fn get_crate_data(cstore: cstore, cnum: ast::crate_num) -> crate_metadata { ret p(cstore).metas.get(cnum); } -fn get_crate_hash(cstore: cstore, cnum: ast::crate_num) -> str { +fn get_crate_hash(cstore: cstore, cnum: ast::crate_num) -> @str { let cdata = get_crate_data(cstore, cnum); ret decoder::get_crate_hash(cdata.data); } -fn get_crate_vers(cstore: cstore, cnum: ast::crate_num) -> str { +fn get_crate_vers(cstore: cstore, cnum: ast::crate_num) -> @str { let cdata = get_crate_data(cstore, cnum); ret decoder::get_crate_vers(cdata.data); } @@ -99,7 +99,7 @@ fn set_crate_data(cstore: cstore, cnum: ast::crate_num, vec::iter(decoder::get_crate_module_paths(data.data)) {|dp| let (did, path) = dp; let d = {crate: cnum, node: did.node}; - p(cstore).mod_path_map.insert(d, path); + p(cstore).mod_path_map.insert(d, @path); } } @@ -153,32 +153,32 @@ fn find_use_stmt_cnum(cstore: cstore, // returns hashes of crates directly used by this crate. Hashes are // sorted by crate name. -fn get_dep_hashes(cstore: cstore) -> [str] { - type crate_hash = {name: str, hash: str}; +fn get_dep_hashes(cstore: cstore) -> [@str] { + type crate_hash = {name: @str, hash: @str}; let mut result = []; for p(cstore).use_crate_map.each_value {|cnum| let cdata = cstore::get_crate_data(cstore, cnum); let hash = decoder::get_crate_hash(cdata.data); - #debug("Add hash[%s]: %s", cdata.name, hash); - result += [{name: cdata.name, hash: hash}]; + #debug("Add hash[%s]: %s", cdata.name, *hash); + result += [{name: @cdata.name, hash: hash}]; }; fn lteq(a: crate_hash, b: crate_hash) -> bool { - ret a.name <= b.name; + ret *a.name <= *b.name; } let sorted = std::sort::merge_sort(lteq, result); #debug("sorted:"); for sorted.each {|x| - #debug(" hash[%s]: %s", x.name, x.hash); + #debug(" hash[%s]: %s", *x.name, *x.hash); } - fn mapper(ch: crate_hash) -> str { ret ch.hash; } + fn mapper(ch: crate_hash) -> @str { ret ch.hash; } ret vec::map(sorted, mapper); } -fn get_path(cstore: cstore, d: ast::def_id) -> [str] { +fn get_path(cstore: cstore, d: ast::def_id) -> [ast::ident] { // let f = bind str::split_str(_, "::"); option::map_default(p(cstore).mod_path_map.find(d), [], - {|ds| str::split_str(ds, "::")}) + {|ds| str::split_str(*ds, "::").map({|x|@x})}) } // Local Variables: // mode: rust diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index dcb71c6718ae2..9ae0fa9842f95 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -210,7 +210,7 @@ fn resolve_path(path: [ast::ident], data: @[u8]) -> [ast::def_id] { fn eq_item(data: [u8], s: str) -> bool { ret str::eq(str::from_bytes(data), s); } - let s = str::connect(path, "::"); + let s = ast_util::path_name_i(path); let md = ebml::doc(data); let paths = ebml::get_doc(md, tag_paths); let eqer = bind eq_item(_, s); @@ -235,10 +235,10 @@ fn item_path(item_doc: ebml::doc) -> ast_map::path { ebml::docs(path_doc) {|tag, elt_doc| if tag == tag_path_elt_mod { let str = ebml::doc_as_str(elt_doc); - result += [ast_map::path_mod(str)]; + result += [ast_map::path_mod(@str)]; } else if tag == tag_path_elt_name { let str = ebml::doc_as_str(elt_doc); - result += [ast_map::path_name(str)]; + result += [ast_map::path_name(@str)]; } else { // ignore tag_path_len element } @@ -249,7 +249,7 @@ fn item_path(item_doc: ebml::doc) -> ast_map::path { fn item_name(item: ebml::doc) -> ast::ident { let name = ebml::get_doc(item, tag_paths_data_name); - str::from_bytes(ebml::doc_data(name)) + @str::from_bytes(ebml::doc_data(name)) } fn lookup_item_name(data: @[u8], id: ast::node_id) -> ast::ident { @@ -302,7 +302,8 @@ fn get_impl_iface(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) item_impl_iface(lookup_item(id, cdata.data), tcx, cdata) } -fn get_impl_method(cdata: cmd, id: ast::node_id, name: str) -> ast::def_id { +fn get_impl_method(cdata: cmd, id: ast::node_id, + name: ast::ident) -> ast::def_id { let items = ebml::get_doc(ebml::doc(cdata.data), tag_items); let mut found = none; ebml::tagged_docs(find_item(id, items), tag_item_impl_method) {|mid| @@ -314,13 +315,14 @@ fn get_impl_method(cdata: cmd, id: ast::node_id, name: str) -> ast::def_id { option::get(found) } -fn get_class_method(cdata: cmd, id: ast::node_id, name: str) -> ast::def_id { +fn get_class_method(cdata: cmd, id: ast::node_id, + name: ast::ident) -> ast::def_id { let items = ebml::get_doc(ebml::doc(cdata.data), tag_items); let mut found = none; let cls_items = alt maybe_find_item(id, items) { some(it) { it } none { fail (#fmt("get_class_method: class id not found \ - when looking up method %s", name)) }}; + when looking up method %s", *name)) }}; ebml::tagged_docs(cls_items, tag_item_iface_method) {|mid| let m_did = class_member_id(mid, cdata); if item_name(mid) == name { @@ -329,7 +331,7 @@ fn get_class_method(cdata: cmd, id: ast::node_id, name: str) -> ast::def_id { } alt found { some(found) { found } - none { fail (#fmt("get_class_method: no method named %s", name)) } + none { fail (#fmt("get_class_method: no method named %s", *name)) } } } @@ -574,7 +576,7 @@ fn get_meta_items(md: ebml::doc) -> [@ast::meta_item] { ebml::tagged_docs(md, tag_meta_item_word) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let n = str::from_bytes(ebml::doc_data(nd)); - items += [attr::mk_word_item(n)]; + items += [attr::mk_word_item(@n)]; }; ebml::tagged_docs(md, tag_meta_item_name_value) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); @@ -583,13 +585,13 @@ fn get_meta_items(md: ebml::doc) -> [@ast::meta_item] { let v = str::from_bytes(ebml::doc_data(vd)); // FIXME (#623): Should be able to decode meta_name_value variants, // but currently the encoder just drops them - items += [attr::mk_name_value_item_str(n, v)]; + items += [attr::mk_name_value_item_str(@n, v)]; }; ebml::tagged_docs(md, tag_meta_item_list) {|meta_item_doc| let nd = ebml::get_doc(meta_item_doc, tag_meta_item_name); let n = str::from_bytes(ebml::doc_data(nd)); let subitems = get_meta_items(meta_item_doc); - items += [attr::mk_list_item(n, subitems)]; + items += [attr::mk_list_item(@n, subitems)]; }; ret items; } @@ -620,8 +622,8 @@ fn list_meta_items(meta_items: ebml::doc, out: io::writer) { } } -fn list_crate_attributes(md: ebml::doc, hash: str, out: io::writer) { - out.write_str(#fmt("=Crate Attributes (%s)=\n", hash)); +fn list_crate_attributes(md: ebml::doc, hash: @str, out: io::writer) { + out.write_str(#fmt("=Crate Attributes (%s)=\n", *hash)); for get_attributes(md).each {|attr| out.write_str(#fmt["%s\n", pprust::attribute_to_str(attr)]); @@ -635,7 +637,7 @@ fn get_crate_attributes(data: @[u8]) -> [ast::attribute] { } type crate_dep = {cnum: ast::crate_num, name: ast::ident, - vers: str, hash: str}; + vers: @str, hash: @str}; fn get_crate_deps(data: @[u8]) -> [crate_dep] { let mut deps: [crate_dep] = []; @@ -647,9 +649,9 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] { } ebml::tagged_docs(depsdoc, tag_crate_dep) {|depdoc| deps += [{cnum: crate_num, - name: docstr(depdoc, tag_crate_dep_name), - vers: docstr(depdoc, tag_crate_dep_vers), - hash: docstr(depdoc, tag_crate_dep_hash)}]; + name: @docstr(depdoc, tag_crate_dep_name), + vers: @docstr(depdoc, tag_crate_dep_vers), + hash: @docstr(depdoc, tag_crate_dep_hash)}]; crate_num += 1; }; ret deps; @@ -660,24 +662,24 @@ fn list_crate_deps(data: @[u8], out: io::writer) { for get_crate_deps(data).each {|dep| out.write_str(#fmt["%d %s-%s-%s\n", - dep.cnum, dep.name, dep.hash, dep.vers]); + dep.cnum, *dep.name, *dep.hash, *dep.vers]); } out.write_str("\n"); } -fn get_crate_hash(data: @[u8]) -> str { +fn get_crate_hash(data: @[u8]) -> @str { let cratedoc = ebml::doc(data); let hashdoc = ebml::get_doc(cratedoc, tag_crate_hash); - ret str::from_bytes(ebml::doc_data(hashdoc)); + ret @str::from_bytes(ebml::doc_data(hashdoc)); } -fn get_crate_vers(data: @[u8]) -> str { +fn get_crate_vers(data: @[u8]) -> @str { let attrs = decoder::get_crate_attributes(data); ret alt attr::last_meta_item_value_str_by_name( attr::find_linkage_metas(attrs), "vers") { some(ver) { ver } - none { "0.0" } + none { @"0.0" } }; } diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 215f73a6d4f46..e10554c79edf0 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -71,8 +71,8 @@ fn reachable(ecx: @encode_ctxt, id: node_id) -> bool { } // Path table encoding -fn encode_name(ebml_w: ebml::writer, name: str) { - ebml_w.wr_tagged_str(tag_paths_data_name, name); +fn encode_name(ebml_w: ebml::writer, name: ident) { + ebml_w.wr_tagged_str(tag_paths_data_name, *name); } fn encode_def_id(ebml_w: ebml::writer, id: def_id) { @@ -92,7 +92,7 @@ fn encode_region_param(ebml_w: ebml::writer, rp: region_param) { } } -fn encode_named_def_id(ebml_w: ebml::writer, name: str, id: def_id) { +fn encode_named_def_id(ebml_w: ebml::writer, name: ident, id: def_id) { ebml_w.wr_tag(tag_paths_data_item) {|| encode_name(ebml_w, name); encode_def_id(ebml_w, id); @@ -109,7 +109,7 @@ fn encode_mutability(ebml_w: ebml::writer, mt: class_mutability) { type entry = {val: T, pos: uint}; fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant], - path: [str], &index: [entry]) { + path: [ident], &index: [entry]) { for variants.each {|variant| add_to_index(ebml_w, path, index, variant.node.name); ebml_w.wr_tag(tag_paths_data_item) {|| @@ -119,15 +119,15 @@ fn encode_enum_variant_paths(ebml_w: ebml::writer, variants: [variant], } } -fn add_to_index(ebml_w: ebml::writer, path: [str], &index: [entry], - name: str) { +fn add_to_index(ebml_w: ebml::writer, path: [ident], &index: [entry], + name: ident) { let full_path = path + [name]; index += - [{val: str::connect(full_path, "::"), pos: ebml_w.writer.tell()}]; + [{val: ast_util::path_name_i(full_path), pos: ebml_w.writer.tell()}]; } fn encode_native_module_item_paths(ebml_w: ebml::writer, nmod: native_mod, - path: [str], &index: [entry]) { + path: [ident], &index: [entry]) { for nmod.items.each {|nitem| add_to_index(ebml_w, path, index, nitem.ident); encode_named_def_id(ebml_w, nitem.ident, local_def(nitem.id)); @@ -135,7 +135,7 @@ fn encode_native_module_item_paths(ebml_w: ebml::writer, nmod: native_mod, } fn encode_class_item_paths(ebml_w: ebml::writer, - items: [@class_member], path: [str], &index: [entry]) { + items: [@class_member], path: [ident], &index: [entry]) { for items.each {|it| alt ast_util::class_member_visibility(it) { private { cont; } @@ -152,7 +152,8 @@ fn encode_class_item_paths(ebml_w: ebml::writer, } fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, - module: _mod, path: [str], &index: [entry]) { + module: _mod, path: [ident], + &index: [entry]) { for module.items.each {|it| if !reachable(ecx, it.id) || !ast_util::is_exported(it.ident, module) { cont; } @@ -235,7 +236,7 @@ fn encode_iface_ref(ebml_w: ebml::writer, ecx: @encode_ctxt, t: @iface_ref) { fn encode_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, crate: @crate) -> [entry] { let mut index: [entry] = []; - let mut path: [str] = []; + let mut path: [ident] = []; ebml_w.start_tag(tag_paths); encode_module_item_paths(ebml_w, ecx, crate.node.module, path, index); encode_reexport_paths(ebml_w, ecx, index); @@ -249,7 +250,7 @@ fn encode_reexport_paths(ebml_w: ebml::writer, let (path, def_id) = reexport; index += [{val: path, pos: ebml_w.writer.tell()}]; ebml_w.start_tag(tag_paths_data_item); - encode_name(ebml_w, path); + encode_name(ebml_w, @path); encode_def_id(ebml_w, def_id); ebml_w.end_tag(); } @@ -374,7 +375,7 @@ fn encode_path(ebml_w: ebml::writer, ast_map::path_name(name) { (tag_path_elt_name, name) } }; - ebml_w.wr_tagged_str(tag, name); + ebml_w.wr_tagged_str(tag, *name); } ebml_w.wr_tag(tag_path) {|| @@ -439,7 +440,7 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer, instance_var(nm, _, mt, id, vis) { *index += [{val: id, pos: ebml_w.writer.tell()}]; ebml_w.start_tag(tag_items_data_item); - #debug("encode_info_for_class: doing %s %d", nm, id); + #debug("encode_info_for_class: doing %s %d", *nm, id); encode_visibility(ebml_w, vis); encode_name(ebml_w, nm); encode_path(ebml_w, path, ast_map::path_name(nm)); @@ -456,7 +457,7 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer, but it works for now -- tjc */ *global_index += [{val: m.id, pos: ebml_w.writer.tell()}]; let impl_path = path + [ast_map::path_name(m.ident)]; - #debug("encode_info_for_class: doing %s %d", m.ident, m.id); + #debug("encode_info_for_class: doing %s %d", *m.ident, m.id); encode_info_for_method(ecx, ebml_w, impl_path, should_inline(m.attrs), id, m, class_tps + m.tps); @@ -479,7 +480,7 @@ fn encode_info_for_fn(ecx: @encode_ctxt, ebml_w: ebml::writer, encode_family(ebml_w, purity_fn_family(decl.purity)); encode_type_param_bounds(ebml_w, ecx, tps); let its_ty = node_id_to_type(ecx.tcx, id); - #debug("fn name = %s ty = %s its node id = %d", ident, + #debug("fn name = %s ty = %s its node id = %d", *ident, util::ppaux::ty_to_str(ecx.tcx, its_ty), id); encode_type(ecx, ebml_w, its_ty); encode_path(ebml_w, path, ast_map::path_name(ident)); @@ -498,7 +499,7 @@ fn encode_info_for_method(ecx: @encode_ctxt, ebml_w: ebml::writer, impl_path: ast_map::path, should_inline: bool, parent_id: node_id, m: @method, all_tps: [ty_param]) { - #debug("encode_info_for_method: %d %s %u", m.id, m.ident, all_tps.len()); + #debug("encode_info_for_method: %d %s %u", m.id, *m.ident, all_tps.len()); ebml_w.start_tag(tag_items_data_item); encode_def_id(ebml_w, local_def(m.id)); encode_family(ebml_w, purity_fn_family(m.decl.purity)); @@ -627,8 +628,8 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item, /* Encode the dtor */ option::iter(m_dtor) {|dtor| *index += [{val: dtor.node.id, pos: ebml_w.writer.tell()}]; - encode_info_for_fn(ecx, ebml_w, dtor.node.id, item.ident - + "_dtor", path, if tps.len() > 0u { + encode_info_for_fn(ecx, ebml_w, dtor.node.id, @(*item.ident + + "_dtor"), path, if tps.len() > 0u { some(ii_dtor(dtor, item.ident, tps, local_def(item.id))) } else { none }, tps, ast_util::dtor_dec()); @@ -805,7 +806,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer, ebml_w.start_tag(tag_items_data); *index += [{val: crate_node_id, pos: ebml_w.writer.tell()}]; encode_info_for_mod(ecx, ebml_w, crate.node.module, - crate_node_id, [], ""); + crate_node_id, [], @""); visit::visit_crate(*crate, (), visit::mk_vt(@{ visit_expr: {|_e, _cx, _v|}, visit_item: {|i, cx, v, copy ebml_w| @@ -816,7 +817,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer, /* encode ctor, then encode items */ alt i.node { item_class(tps, _, _, ctor, m_dtor, _) { - #debug("encoding info for ctor %s %d", i.ident, + #debug("encoding info for ctor %s %d", *i.ident, ctor.node.id); *index += [{val: ctor.node.id, pos: ebml_w.writer.tell()}]; encode_info_for_fn(ecx, ebml_w, ctor.node.id, i.ident, @@ -898,7 +899,7 @@ fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) { meta_word(name) { ebml_w.start_tag(tag_meta_item_word); ebml_w.start_tag(tag_meta_item_name); - ebml_w.writer.write(str::bytes(name)); + ebml_w.writer.write(str::bytes(*name)); ebml_w.end_tag(); ebml_w.end_tag(); } @@ -907,10 +908,10 @@ fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) { lit_str(value) { ebml_w.start_tag(tag_meta_item_name_value); ebml_w.start_tag(tag_meta_item_name); - ebml_w.writer.write(str::bytes(name)); + ebml_w.writer.write(str::bytes(*name)); ebml_w.end_tag(); ebml_w.start_tag(tag_meta_item_value); - ebml_w.writer.write(str::bytes(value)); + ebml_w.writer.write(str::bytes(*value)); ebml_w.end_tag(); ebml_w.end_tag(); } @@ -920,7 +921,7 @@ fn encode_meta_item(ebml_w: ebml::writer, mi: meta_item) { meta_list(name, items) { ebml_w.start_tag(tag_meta_item_list); ebml_w.start_tag(tag_meta_item_name); - ebml_w.writer.write(str::bytes(name)); + ebml_w.writer.write(str::bytes(*name)); ebml_w.end_tag(); for items.each {|inner_item| encode_meta_item(ebml_w, *inner_item); @@ -949,22 +950,22 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute] { fn synthesize_link_attr(ecx: @encode_ctxt, items: [@meta_item]) -> attribute { - assert (ecx.link_meta.name != ""); - assert (ecx.link_meta.vers != ""); + assert (*ecx.link_meta.name != ""); + assert (*ecx.link_meta.vers != ""); let name_item = - attr::mk_name_value_item_str("name", ecx.link_meta.name); + attr::mk_name_value_item_str(@"name", *ecx.link_meta.name); let vers_item = - attr::mk_name_value_item_str("vers", ecx.link_meta.vers); + attr::mk_name_value_item_str(@"vers", *ecx.link_meta.vers); let other_items = { - let tmp = attr::remove_meta_items_by_name(items, "name"); - attr::remove_meta_items_by_name(tmp, "vers") + let tmp = attr::remove_meta_items_by_name(items, @"name"); + attr::remove_meta_items_by_name(tmp, @"vers") }; let meta_items = [name_item, vers_item] + other_items; - let link_item = attr::mk_list_item("link", meta_items); + let link_item = attr::mk_list_item(@"link", meta_items); ret attr::mk_attr(link_item); } @@ -973,7 +974,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: @crate) -> [attribute] { let mut found_link_attr = false; for crate.node.attrs.each {|attr| attrs += - if attr::get_attr_name(attr) != "link" { + if *attr::get_attr_name(attr) != "link" { [attr] } else { alt attr.node.value.node { @@ -1000,9 +1001,9 @@ fn encode_crate_deps(ebml_w: ebml::writer, cstore: cstore::cstore) { // Pull the cnums and name,vers,hash out of cstore let mut deps: [mut numdep] = [mut]; cstore::iter_crate_data(cstore) {|key, val| - let dep = {cnum: key, name: val.name, + let dep = {cnum: key, name: @val.name, vers: decoder::get_crate_vers(val.data), - hash: decoder::get_crate_hash(val.data)}; + hash: decoder::get_crate_hash(val.data)}; deps += [mut dep]; }; @@ -1036,13 +1037,13 @@ fn encode_crate_deps(ebml_w: ebml::writer, cstore: cstore::cstore) { fn encode_crate_dep(ebml_w: ebml::writer, dep: decoder::crate_dep) { ebml_w.start_tag(tag_crate_dep); ebml_w.start_tag(tag_crate_dep_name); - ebml_w.writer.write(str::bytes(dep.name)); + ebml_w.writer.write(str::bytes(*dep.name)); ebml_w.end_tag(); ebml_w.start_tag(tag_crate_dep_vers); - ebml_w.writer.write(str::bytes(dep.vers)); + ebml_w.writer.write(str::bytes(*dep.vers)); ebml_w.end_tag(); ebml_w.start_tag(tag_crate_dep_hash); - ebml_w.writer.write(str::bytes(dep.hash)); + ebml_w.writer.write(str::bytes(*dep.hash)); ebml_w.end_tag(); ebml_w.end_tag(); } diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs index 2123a6179f099..2cbf529ecf045 100644 --- a/src/rustc/metadata/loader.rs +++ b/src/rustc/metadata/loader.rs @@ -44,7 +44,7 @@ fn load_library_crate(cx: ctxt) -> {ident: str, data: @[u8]} { some(t) { ret t; } none { cx.diag.span_fatal( - cx.span, #fmt["can't find crate for '%s'", cx.ident]); + cx.span, #fmt["can't find crate for '%s'", *cx.ident]); } } } @@ -69,7 +69,7 @@ fn find_library_crate_aux(cx: ctxt, filesearch: filesearch::filesearch) -> option<{ident: str, data: @[u8]}> { let crate_name = crate_name_from_metas(cx.metas); - let prefix: str = nn.prefix + crate_name + "-"; + let prefix: str = nn.prefix + *crate_name + "-"; let suffix: str = nn.suffix; let mut matches = []; @@ -107,7 +107,7 @@ fn find_library_crate_aux(cx: ctxt, some(matches[0]) } else { cx.diag.span_err( - cx.span, #fmt("multiple matching crates for `%s`", crate_name)); + cx.span, #fmt("multiple matching crates for `%s`", *crate_name)); cx.diag.handler().note("candidates:"); for matches.each {|match| cx.diag.handler().note(#fmt("path: %s", match.ident)); @@ -119,7 +119,7 @@ fn find_library_crate_aux(cx: ctxt, } } -fn crate_name_from_metas(metas: [@ast::meta_item]) -> str { +fn crate_name_from_metas(metas: [@ast::meta_item]) -> @str { let name_items = attr::find_meta_items_by_name(metas, "name"); alt vec::last_opt(name_items) { some(i) { @@ -146,7 +146,7 @@ fn crate_matches(crate_data: @[u8], metas: [@ast::meta_item], hash: str) -> let linkage_metas = attr::find_linkage_metas(attrs); if hash.is_not_empty() { let chash = decoder::get_crate_hash(crate_data); - if chash != hash { ret false; } + if *chash != hash { ret false; } } metadata_matches(linkage_metas, metas) } diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs index 02ba2597d7673..c6e70c6db07b1 100644 --- a/src/rustc/metadata/tydecode.rs +++ b/src/rustc/metadata/tydecode.rs @@ -46,7 +46,7 @@ fn parse_ident_(st: @pstate, is_last: fn@(char) -> bool) -> while !is_last(peek(st)) { rslt += str::from_byte(next_byte(st)); } - ret rslt; + ret @rslt; } @@ -210,7 +210,7 @@ fn parse_bound_region(st: @pstate) -> ty::bound_region { alt check next(st) { 's' { ty::br_self } 'a' { ty::br_anon } - '[' { ty::br_named(parse_str(st, ']')) } + '[' { ty::br_named(@parse_str(st, ']')) } } } @@ -322,7 +322,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { assert (next(st) == '['); let mut fields: [ty::field] = []; while peek(st) != ']' { - let name = parse_str(st, '='); + let name = @parse_str(st, '='); fields += [{ident: name, mt: parse_mt(st, conv)}]; } st.pos = st.pos + 1u; diff --git a/src/rustc/metadata/tyencode.rs b/src/rustc/metadata/tyencode.rs index 051ea9e444ecd..a158b0b01fdfa 100644 --- a/src/rustc/metadata/tyencode.rs +++ b/src/rustc/metadata/tyencode.rs @@ -157,7 +157,7 @@ fn enc_bound_region(w: io::writer, br: ty::bound_region) { ty::br_anon { w.write_char('a') } ty::br_named(s) { w.write_char('['); - w.write_str(s); + w.write_str(*s); w.write_char(']') } } @@ -256,7 +256,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) { ty::ty_rec(fields) { w.write_str("R["/&); for fields.each {|field| - w.write_str(field.ident); + w.write_str(*field.ident); w.write_char('='); enc_mt(w, cx, field.mt); } diff --git a/src/rustc/middle/astencode.rs b/src/rustc/middle/astencode.rs index 0d6b158a9ae5f..ca84dafb535f8 100644 --- a/src/rustc/middle/astencode.rs +++ b/src/rustc/middle/astencode.rs @@ -83,7 +83,7 @@ fn encode_inlined_item(ecx: @e::encode_ctxt, ii: ast::inlined_item, maps: maps) { #debug["> Encoding inlined item: %s::%s (%u)", - ast_map::path_to_str(path), ii.ident(), + ast_map::path_to_str(path), *ii.ident(), ebml_w.writer.tell()]; let id_range = compute_id_range(ii); @@ -94,7 +94,7 @@ fn encode_inlined_item(ecx: @e::encode_ctxt, } #debug["< Encoded inlined fn: %s::%s (%u)", - ast_map::path_to_str(path), ii.ident(), + ast_map::path_to_str(path), *ii.ident(), ebml_w.writer.tell()]; } @@ -117,10 +117,10 @@ fn decode_inlined_item(cdata: cstore::crate_metadata, let ii = renumber_ast(xcx, raw_ii); ast_map::map_decoded_item(tcx.sess.diagnostic(), dcx.tcx.items, path, ii); - #debug["Fn named: %s", ii.ident()]; + #debug["Fn named: %s", *ii.ident()]; decode_side_tables(xcx, ast_doc); #debug["< Decoded inlined fn: %s::%s", - ast_map::path_to_str(path), ii.ident()]; + ast_map::path_to_str(path), *ii.ident()]; alt ii { ast::ii_item(i) { #debug(">>> DECODED ITEM >>>\n%s\n<<< DECODED ITEM <<<", diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs index 66118dbc38c3a..f9a985da25daf 100644 --- a/src/rustc/middle/borrowck.rs +++ b/src/rustc/middle/borrowck.rs @@ -241,7 +241,7 @@ enum comp_kind { comp_tuple, // elt in a tuple comp_res, // data for a resource comp_variant(ast::def_id), // internals to a variant of given enum - comp_field(str, // name of field + comp_field(ast::ident, // name of field ast::mutability), // declared mutability of field comp_index(ty::t, // type of vec/str/etc being deref'd ast::mutability) // mutability of vec content @@ -409,7 +409,7 @@ impl to_str_methods for borrowck_ctxt { fn comp_to_repr(comp: comp_kind) -> str { alt comp { - comp_field(fld, _) { fld } + comp_field(fld, _) { *fld } comp_index(*) { "[]" } comp_tuple { "()" } comp_res { "" } diff --git a/src/rustc/middle/borrowck/categorization.rs b/src/rustc/middle/borrowck/categorization.rs index db22f880941b6..4a6f8c15147cb 100644 --- a/src/rustc/middle/borrowck/categorization.rs +++ b/src/rustc/middle/borrowck/categorization.rs @@ -295,14 +295,15 @@ impl public_methods for borrowck_ctxt { ret @{cat:cat_discr(cmt, alt_id) with *cmt}; } - fn cat_field(node: N, base_cmt: cmt, f_name: str) -> cmt { + fn cat_field(node: N, base_cmt: cmt, + f_name: ast::ident) -> cmt { let f_mutbl = alt field_mutbl(self.tcx, base_cmt.ty, f_name) { some(f_mutbl) { f_mutbl } none { self.tcx.sess.span_bug( node.span(), #fmt["Cannot find field `%s` in type `%s`", - f_name, ty_to_str(self.tcx, base_cmt.ty)]); + *f_name, ty_to_str(self.tcx, base_cmt.ty)]); } }; let m = alt f_mutbl { @@ -427,7 +428,7 @@ impl private_methods for borrowck_ctxt { fn field_mutbl(tcx: ty::ctxt, base_ty: ty::t, - f_name: str) -> option { + f_name: ast::ident) -> option { // Need to refactor so that records/class fields can be treated uniformly. alt ty::get(base_ty).struct { ty::ty_rec(fields) { diff --git a/src/rustc/middle/capture.rs b/src/rustc/middle/capture.rs index 64dafc09a7c54..fe7aeb8e5f059 100644 --- a/src/rustc/middle/capture.rs +++ b/src/rustc/middle/capture.rs @@ -44,7 +44,7 @@ fn check_capture_clause(tcx: ty::ctxt, tcx.sess.span_warn( cap_item.span, #fmt("captured variable '%s' not used in closure", - cap_item.name)); + *cap_item.name)); } let cap_def_id = ast_util::def_id_of_def(cap_def).node; @@ -52,7 +52,7 @@ fn check_capture_clause(tcx: ty::ctxt, tcx.sess.span_err( cap_item.span, #fmt("variable '%s' captured more than once", - cap_item.name)); + *cap_item.name)); } } } @@ -68,7 +68,7 @@ fn compute_capture_vars(tcx: ty::ctxt, for (*cap_clause).each { |cap_item| #debug("Doing capture var: %s (%?)", - cap_item.name, cap_item.id); + *cap_item.name, cap_item.id); let cap_def = tcx.def_map.get(cap_item.id); let cap_def_id = ast_util::def_id_of_def(cap_def).node; diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs index 3eb0d1e92236d..ee95a8571ff7a 100644 --- a/src/rustc/middle/check_alt.rs +++ b/src/rustc/middle/check_alt.rs @@ -67,8 +67,8 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: [@pat]) { alt ty::get(ty).struct { ty::ty_bool { alt check ctor { - val(const_int(1i64)) { some("true") } - val(const_int(0i64)) { some("false") } + val(const_int(1i64)) { some(@"true") } + val(const_int(0i64)) { some(@"false") } } } ty::ty_enum(id, _) { @@ -83,7 +83,7 @@ fn check_exhaustive(tcx: ty::ctxt, sp: span, pats: [@pat]) { } }; let msg = "non-exhaustive patterns" + alt ext { - some(s) { ": " + s + " not covered" } + some(s) { ": " + *s + " not covered" } none { "" } }; tcx.sess.span_err(sp, msg); diff --git a/src/rustc/middle/const_eval.rs b/src/rustc/middle/const_eval.rs index d0e4b715988fe..a72e7fb020858 100644 --- a/src/rustc/middle/const_eval.rs +++ b/src/rustc/middle/const_eval.rs @@ -108,11 +108,11 @@ fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val { fn lit_to_const(lit: @lit) -> const_val { alt lit.node { - lit_str(s) { const_str(s) } + lit_str(s) { const_str(*s) } lit_int(n, _) { const_int(n) } lit_uint(n, _) { const_uint(n) } lit_int_unsuffixed(n, _) { const_int(n) } - lit_float(n, _) { const_float(option::get(float::from_str(n)) as f64) } + lit_float(n, _) { const_float(option::get(float::from_str(*n)) as f64) } lit_nil { const_int(0i64) } lit_bool(b) { const_int(b as i64) } } diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs index d8a88819b36ac..a11ea4c9a629d 100644 --- a/src/rustc/middle/lint.rs +++ b/src/rustc/middle/lint.rs @@ -210,7 +210,7 @@ impl methods for ctxt { for metas.each {|meta| alt meta.node { ast::meta_word(lintname) { - alt lookup_lint(self.dict, lintname) { + alt lookup_lint(self.dict, *lintname) { (name, none) { self.span_lint( self.get_level(unrecognized_warning), @@ -444,7 +444,7 @@ fn check_item_old_vecs(cx: ty::ctxt, it: @ast::item) { ast::ty_path(@{span: _, global: _, idents: ids, rp: none, types: _}, _) - if ids == ["str"] && (! uses_vstore.contains_key(t.id)) { + if ids == [@"str"] && (! uses_vstore.contains_key(t.id)) { cx.sess.span_lint( old_vecs, it.id, t.id, t.span, "deprecated str type"); diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index 0f1edb0c4158a..38571680ec6bb 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -45,7 +45,7 @@ of `f`. */ import dvec::{dvec, extensions}; -import std::map::{hashmap, int_hash, str_hash}; +import std::map::{hashmap, int_hash, str_hash, box_str_hash}; import syntax::{visit, ast_util}; import syntax::print::pprust::{expr_to_str}; import visit::vt; @@ -134,9 +134,9 @@ enum relevant_def { rdef_var(node_id), rdef_self } type capture_info = {ln: live_node, is_move: bool, rv: relevant_def}; enum var_kind { - vk_arg(node_id, str, rmode), - vk_local(node_id, str), - vk_field(str), + vk_arg(node_id, ident, rmode), + vk_local(node_id, ident), + vk_field(ident), vk_self, vk_implicit_ret } @@ -158,7 +158,7 @@ class ir_maps { let mut num_vars: uint; let live_node_map: hashmap; let variable_map: hashmap; - let field_map: hashmap; + let field_map: hashmap; let capture_map: hashmap; let mut var_kinds: [var_kind]; let mut lnks: [live_node_kind]; @@ -174,7 +174,7 @@ class ir_maps { self.live_node_map = int_hash(); self.variable_map = int_hash(); self.capture_map = int_hash(); - self.field_map = str_hash(); + self.field_map = box_str_hash(); self.var_kinds = []; self.lnks = []; } @@ -227,12 +227,12 @@ class ir_maps { } } - fn variable_name(var: variable) -> str { + fn variable_name(var: variable) -> ident { alt self.var_kinds[*var] { vk_local(_, name) | vk_arg(_, name, _) {name} - vk_field(name) {"self." + name} - vk_self {"self"} - vk_implicit_ret {""} + vk_field(name) {@("self." + *name)} + vk_self {@"self"} + vk_implicit_ret {@""} } } @@ -1208,7 +1208,8 @@ class liveness { } } - fn as_self_field(expr: @expr, fld: str) -> option<(live_node,variable)> { + fn as_self_field(expr: @expr, + fld: ident) -> option<(live_node,variable)> { // If we checking a constructor, then we treat self.f as a // variable. we use the live_node id that will be assigned to // the reference to self but the variable id for `f`. @@ -1429,7 +1430,7 @@ impl check_methods for @liveness { none { /* ok */ } some(lnk_exit) { self.tcx.sess.span_err( - sp, #fmt["field `self.%s` is never initialized", nm]); + sp, #fmt["field `self.%s` is never initialized", *nm]); } some(lnk) { self.report_illegal_read( @@ -1605,13 +1606,13 @@ impl check_methods for @liveness { self.tcx.sess.span_err( move_span, #fmt["illegal move from argument `%s`, which is not \ - copy or move mode", name]); + copy or move mode", *name]); ret; } vk_field(name) { self.tcx.sess.span_err( move_span, - #fmt["illegal move from field `%s`", name]); + #fmt["illegal move from field `%s`", *name]); ret; } vk_local(*) | vk_self | vk_implicit_ret { @@ -1643,12 +1644,12 @@ impl check_methods for @liveness { lnk_freevar(span) { self.tcx.sess.span_err( span, - #fmt["capture of %s: `%s`", msg, name]); + #fmt["capture of %s: `%s`", msg, *name]); } lnk_expr(span) { self.tcx.sess.span_err( span, - #fmt["use of %s: `%s`", msg, name]); + #fmt["use of %s: `%s`", msg, *name]); } lnk_exit | lnk_vdef(_) { @@ -1659,9 +1660,9 @@ impl check_methods for @liveness { } } - fn should_warn(var: variable) -> option { + fn should_warn(var: variable) -> option { let name = (*self.ir).variable_name(var); - if name[0] == ('_' as u8) {none} else {some(name)} + if (*name)[0] == ('_' as u8) {none} else {some(name)} } fn warn_about_unused_args(sp: span, decl: fn_decl, entry_ln: live_node) { @@ -1712,10 +1713,10 @@ impl check_methods for @liveness { if is_assigned { self.tcx.sess.span_warn( sp, #fmt["variable `%s` is assigned to, \ - but never used", name]); + but never used", *name]); } else { self.tcx.sess.span_warn( - sp, #fmt["unused variable: `%s`", name]); + sp, #fmt["unused variable: `%s`", *name]); } } ret true; @@ -1728,7 +1729,7 @@ impl check_methods for @liveness { for self.should_warn(var).each { |name| self.tcx.sess.span_warn( sp, - #fmt["value assigned to `%s` is never read", name]); + #fmt["value assigned to `%s` is never read", *name]); } } } diff --git a/src/rustc/middle/pat_util.rs b/src/rustc/middle/pat_util.rs index 29cacf370928e..706a6fb2264e7 100644 --- a/src/rustc/middle/pat_util.rs +++ b/src/rustc/middle/pat_util.rs @@ -9,12 +9,12 @@ import std::map::hashmap; export pat_binding_ids, pat_bindings, pat_id_map; export pat_is_variant; -type pat_id_map = std::map::hashmap; +type pat_id_map = std::map::hashmap; // This is used because same-named variables in alternative patterns need to // use the node_id of their namesake in the first pattern. fn pat_id_map(dm: resolve::def_map, pat: @pat) -> pat_id_map { - let map = std::map::str_hash(); + let map = std::map::box_str_hash(); pat_bindings(dm, pat) {|p_id, _s, n| map.insert(path_to_ident(n), p_id); }; diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index 1eeb0b0821ec2..fb9ae118a4aad 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -9,7 +9,7 @@ import syntax::attr; import metadata::{csearch, cstore}; import driver::session::session; import util::common::is_main_name; -import std::map::{int_hash, str_hash, hashmap}; +import std::map::{int_hash, str_hash, box_str_hash, hashmap}; import vec::each; import syntax::codemap::span; import syntax::visit; @@ -68,16 +68,16 @@ enum glob_import_state { option), /* module */ } -type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>; +type ext_hash = hashmap<{did: def_id, ident: ast::ident, ns: namespace}, def>; fn new_ext_hash() -> ext_hash { - type key = {did: def_id, ident: str, ns: namespace}; + type key = {did: def_id, ident: ast::ident, ns: namespace}; fn hash(v: key) -> uint { - str::hash(v.ident) + ast_util::hash_def(v.did) + v.ns as uint + str::hash(*v.ident) + ast_util::hash_def(v.did) + v.ns as uint } fn eq(v1: key, v2: key) -> bool { ret ast_util::def_eq(v1.did, v2.did) && - str::eq(v1.ident, v2.ident) && v1.ns == v2.ns; + str::eq(*v1.ident, *v2.ident) && v1.ns == v2.ns; } std::map::hashmap(hash, {|a, b| a == b}) } @@ -102,7 +102,7 @@ type indexed_mod = { index: mod_index, glob_imports: dvec, mut globbed_exports: [ident], - glob_imported_names: hashmap, + glob_imported_names: hashmap, path: str }; @@ -132,7 +132,7 @@ type env = ext_cache: ext_hash, used_imports: {mut track: bool, mut data: [node_id]}, - reported: dvec<{ident: str, sc: scope}>, + reported: dvec<{ident: ast::ident, sc: scope}>, mut ignored_imports: [node_id], mut current_tp: option, mut resolve_unexported: bool, @@ -256,7 +256,7 @@ fn map_crate(e: @env, c: @ast::crate) { let mut path = n + "::"; list::iter(sc) {|s| alt s { - scope_item(i) { path = i.ident + "::" + path; } + scope_item(i) { path = *i.ident + "::" + path; } _ {} } } @@ -272,8 +272,8 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_mod(md), glob_imports: dvec(), mut globbed_exports: [], - glob_imported_names: str_hash(), - path: path_from_scope(sc, i.ident)}); + glob_imported_names: box_str_hash(), + path: path_from_scope(sc, *i.ident)}); } ast::item_native_mod(nmd) { e.mod_map.insert(i.id, @@ -281,8 +281,8 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_nmod(nmd), glob_imports: dvec(), mut globbed_exports: [], - glob_imported_names: str_hash(), - path: path_from_scope(sc, i.ident)}); + glob_imported_names: box_str_hash(), + path: path_from_scope(sc, *i.ident)}); } _ { } } @@ -340,7 +340,7 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_mod(c.node.module), glob_imports: dvec(), mut globbed_exports: [], - glob_imported_names: str_hash(), + glob_imported_names: box_str_hash(), path: ""}); // Next, assemble the links for globbed imports and exports. @@ -377,10 +377,10 @@ fn check_unused_imports(e: @env, level: lint::level) { if !vec::contains(e.used_imports.data, k) { alt level { lint::warn { - e.sess.span_warn(sp, "unused import " + name); + e.sess.span_warn(sp, "unused import " + *name); } lint::error { - e.sess.span_err(sp, "unused import " + name); + e.sess.span_err(sp, "unused import " + *name); } lint::ignore { } @@ -518,7 +518,7 @@ fn resolve_names(e: @env, c: @ast::crate) { } some(fnd@ast::def_const(_)) { e.sess.span_err(p.span, "pattern variable conflicts \ - with constant '" + path_to_ident(p) + "'"); + with constant '" + *path_to_ident(p) + "'"); } // Binds a var -- nothing needs to be done _ {} @@ -701,7 +701,7 @@ fn visit_local_with_scope(e: @env, loc: @local, &&sc: scopes, v:vt) { e.sess.span_err(loc.span, #fmt("declaration of `%s` shadows an \ enum that's in scope", - path_to_ident(path))); + *path_to_ident(path))); } _ {} } @@ -734,7 +734,7 @@ fn follow_import(e: env, &&sc: scopes, path: [ident], sp: span) -> alt dcur { some(ast::def_mod(_)) | some(ast::def_native_mod(_)) { ret dcur; } _ { - e.sess.span_err(sp, str::connect(path, "::") + + e.sess.span_err(sp, str::connect(path.map({|x|*x}), "::") + " does not name a module."); ret none; } @@ -860,7 +860,7 @@ fn resolve_import(e: env, n_id: node_id, name: ast::ident, // import alt e.imports.find(n_id) { some(resolving(sp)) { - e.imports.insert(n_id, resolved(none, none, none, @[], "", sp)); + e.imports.insert(n_id, resolved(none, none, none, @[], @"", sp)); } _ { } } @@ -897,7 +897,7 @@ fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) { alt find_fn_or_mod_scope(sc) { some(err_scope) { for e.reported.each {|rs| - if str::eq(rs.ident, name) && err_scope == rs.sc { ret; } + if str::eq(*rs.ident, *name) && err_scope == rs.sc { ret; } } e.reported.push({ident: name, sc: err_scope}); } @@ -907,10 +907,10 @@ fn unresolved_err(e: env, cx: ctxt, sp: span, name: ident, kind: str) { in_mod(def) { let did = def_id_of_def(def); if did.crate == ast::local_crate { - path = e.mod_map.get(did.node).path + path; + path = @(e.mod_map.get(did.node).path + *path); } else if did.node != ast::crate_node_id { let paths = e.ext_map.get(did); - path = str::connect(paths + [path], "::"); + path = @str::connect((paths + [path]).map({|x|*x}), "::"); } } } @@ -922,7 +922,7 @@ fn unresolved_fatal(e: env, sp: span, id: ident, kind: str) -> ! { } fn mk_unresolved_msg(id: ident, kind: str) -> str { - ret #fmt["unresolved %s: %s", kind, id]; + ret #fmt["unresolved %s: %s", kind, *id]; } // Lookup helpers @@ -1010,7 +1010,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace, alt s { scope_toplevel { if ns == ns_type { - ret some(ast::def_prim_ty(alt name { + ret some(ast::def_prim_ty(alt *name { "bool" { ast::ty_bool } "int" { ast::ty_int(ast::ty_i) } "uint" { ast::ty_uint(ast::ty_u) } @@ -1045,7 +1045,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace, } ast::item_iface(tps, _, _) { if ns == ns_type { - if name == "self" { + if *name == "self" { ret some(def_self(it.id)); } ret lookup_in_ty_params(e, name, tps); @@ -1070,7 +1070,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace, } } scope_method(id, tps) { - if (name == "self" && ns == ns_val) { + if (*name == "self" && ns == ns_val) { ret some(ast::def_self(id)); } else if ns == ns_type { ret lookup_in_ty_params(e, name, tps); @@ -1135,7 +1135,7 @@ fn lookup_in_scope(e: env, &&sc: scopes, sp: span, name: ident, ns: namespace, let mut i = vec::len(closing); while i > 0u { i -= 1u; - #debug["name=%s df=%?", name, df]; + #debug["name=%s df=%?", *name, df]; assert def_is_local(df) || def_is_self(df); let df_id = def_id_of_def(df).node; df = ast::def_upvar(df_id, @df, closing[i]); @@ -1164,7 +1164,7 @@ fn lookup_in_ty_params(e: env, name: ident, ty_params: [ast::ty_param]) -> option { let mut n = 0u; for ty_params.each {|tp| - if str::eq(tp.ident, name) && alt e.current_tp { + if str::eq(*tp.ident, *name) && alt e.current_tp { some(cur) { n < cur } none { true } } { ret some(ast::def_ty_param(local_def(tp.id), n)); } n += 1u; @@ -1176,7 +1176,7 @@ fn lookup_in_pat(e: env, name: ident, pat: @ast::pat) -> option { let mut found = none; pat_util::pat_bindings(e.def_map, pat) {|p_id, _sp, n| - if str::eq(path_to_ident(n), name) + if str::eq(*path_to_ident(n), *name) { found = some(p_id); } }; ret found; @@ -1188,7 +1188,7 @@ fn lookup_in_fn(e: env, name: ident, decl: ast::fn_decl, alt ns { ns_val { for decl.inputs.each {|a| - if str::eq(a.ident, name) { + if str::eq(*a.ident, *name) { ret some(ast::def_arg(a.id, a.mode)); } } @@ -1231,14 +1231,14 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint, alt it.node { ast::item_enum(variants, _, _) { if ns == ns_type { - if str::eq(it.ident, name) { + if str::eq(*it.ident, *name) { ret some(ast::def_ty(local_def(it.id))); } } else { alt ns { ns_val { for variants.each {|v| - if str::eq(v.node.name, name) { + if str::eq(*v.node.name, *name) { let i = v.node.id; ret some(ast::def_variant (local_def(it.id), local_def(i))); @@ -1250,7 +1250,7 @@ fn lookup_in_block(e: env, name: ident, sp: span, b: ast::blk_, pos: uint, } } _ { - if str::eq(it.ident, name) { + if str::eq(*it.ident, *name) { let found = found_def_item(it, ns); if !is_none(found) { ret found; @@ -1521,9 +1521,9 @@ fn lookup_in_globs(e: env, globs: [glob_imp_def], sp: span, id: ident, } else { for matches.each {|match| let sp = match.path.span; - e.sess.span_note(sp, #fmt["'%s' is imported here", id]); + e.sess.span_note(sp, #fmt["'%s' is imported here", *id]); } - e.sess.span_fatal(sp, "'" + id + "' is glob-imported from" + + e.sess.span_fatal(sp, "'" + *id + "' is glob-imported from" + " multiple different modules."); } } @@ -1627,7 +1627,7 @@ fn index_view_items(view_items: [@ast::view_item], } fn index_mod(md: ast::_mod) -> mod_index { - let index = str_hash::<@list>(); + let index = box_str_hash::<@list>(); index_view_items(md.view_items, index); @@ -1667,7 +1667,7 @@ fn index_mod(md: ast::_mod) -> mod_index { fn index_nmod(md: ast::native_mod) -> mod_index { - let index = str_hash::<@list>(); + let index = box_str_hash::<@list>(); index_view_items(md.view_items, index); @@ -1727,7 +1727,7 @@ fn check_mod_name(e: env, name: ident, entries: @list) { let mut saw_value = false; let mut entries = entries; fn dup(e: env, sp: span, word: str, name: ident) { - e.sess.span_fatal(sp, "duplicate definition of " + word + name); + e.sess.span_fatal(sp, "duplicate definition of " + word + *name); } loop { alt *entries { @@ -1817,11 +1817,11 @@ fn check_arm(e: @env, a: ast::arm, &&x: (), v: vt<()>) { "inconsistent number of bindings"); } else { for ch.seen.each {|name| - if is_none(vec::find(seen0, bind str::eq(name, _))) { + if is_none(vec::find(seen0, {|x|str::eq(*name, *x)})) { // Fight the alias checker let name_ = name; e.sess.span_err(a.pats[i].span, - "binding " + name_ + + "binding " + *name_ + " does not occur in first pattern"); } } @@ -1915,8 +1915,9 @@ fn checker(e: env, kind: str) -> checker { fn check_name(ch: checker, sp: span, name: ident) { for ch.seen.each {|s| - if str::eq(s, name) { - ch.sess.span_fatal(sp, "duplicate " + ch.kind + " name: " + name); + if str::eq(*s, *name) { + ch.sess.span_fatal( + sp, "duplicate " + ch.kind + " name: " + *name); } } } @@ -2000,7 +2001,7 @@ fn check_exports(e: @env) { e.exp_map.insert(export_id, found + [{reexp: reexp, id: target_id}]); } - fn check_export(e: @env, ident: str, _mod: @indexed_mod, + fn check_export(e: @env, ident: ident, _mod: @indexed_mod, export_id: node_id, vi: @view_item) { let mut found_something = false; if _mod.index.contains_key(ident) { @@ -2036,7 +2037,7 @@ fn check_exports(e: @env) { lookup_glob_any(e, _mod, vi.span, ident, export_id); if !found_something { e.sess.span_warn(vi.span, - #fmt("exported item %s is not defined", ident)); + #fmt("exported item %s is not defined", *ident)); } } @@ -2044,7 +2045,7 @@ fn check_exports(e: @env) { -> node_id { alt _mod.index.find(id) { none { - e.sess.span_fatal(sp, #fmt("undefined id %s in an export", id)); + e.sess.span_fatal(sp, #fmt("undefined id %s in an export", *id)); } some(ms) { let maybe_id = list_search(ms) {|m| @@ -2056,7 +2057,7 @@ fn check_exports(e: @env) { alt maybe_id { some(an_id) { an_id } _ { e.sess.span_fatal(sp, #fmt("%s does not refer \ - to an enumeration", id)); } + to an enumeration", *id)); } } } } @@ -2079,7 +2080,7 @@ fn check_exports(e: @env) { e.sess.span_err( span, #fmt("variant %s doesn't belong to \ enum %s", - variant_id.node.name, id)); + *variant_id.node.name, *id)); } } _ {} @@ -2090,7 +2091,7 @@ fn check_exports(e: @env) { } if !found { e.sess.span_err(span, #fmt("%s is not a variant", - variant_id.node.name)); + *variant_id.node.name)); } } } diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs index 2fd4374dc093b..183f78ad2ac95 100644 --- a/src/rustc/middle/trans/alt.rs +++ b/src/rustc/middle/trans/alt.rs @@ -78,9 +78,9 @@ fn variant_opt(tcx: ty::ctxt, pat_id: ast::node_id) -> opt { } type bind_map = [{ident: ast::ident, val: ValueRef}]; -fn assoc(key: str, list: bind_map) -> option { +fn assoc(key: ast::ident, list: bind_map) -> option { for vec::each(list) {|elt| - if str::eq(elt.ident, key) { ret some(elt.val); } + if str::eq(*elt.ident, *key) { ret some(elt.val); } } ret none; } @@ -194,7 +194,7 @@ fn enter_rec(dm: def_map, m: match, col: uint, fields: [ast::ident], for vec::each(fields) {|fname| let mut pat = dummy; for vec::each(fpats) {|fpat| - if str::eq(fpat.ident, fname) { pat = fpat.pat; break; } + if str::eq(*fpat.ident, *fname) { pat = fpat.pat; break; } } pats += [pat]; } @@ -287,12 +287,12 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id, } fn collect_record_fields(m: match, col: uint) -> [ast::ident] { - let mut fields = []; + let mut fields: [ast::ident] = []; for vec::each(m) {|br| alt br.pats[col].node { ast::pat_rec(fs, _) { for vec::each(fs) {|f| - if !vec::any(fields, bind str::eq(f.ident, _)) { + if !vec::any(fields, {|x| str::eq(*f.ident, *x)}) { fields += [f.ident]; } } diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 2423f04d11fed..62128c4cf54f8 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -513,8 +513,8 @@ fn declare_tydesc(ccx: @crate_ctxt, t: ty::t) -> @tydesc_info { let mut name; //XXX this triggers duplicate LLVM symbols if false /*ccx.sess.opts.debuginfo*/ { - name = mangle_internal_name_by_type_only(ccx, t, "tydesc"); - } else { name = mangle_internal_name_by_seq(ccx, "tydesc"); } + name = mangle_internal_name_by_type_only(ccx, t, @"tydesc"); + } else { name = mangle_internal_name_by_seq(ccx, @"tydesc"); } note_unique_llvm_symbol(ccx, name); let gvar = str::as_c_str(name, {|buf| llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type, buf) @@ -541,9 +541,9 @@ fn declare_generic_glue(ccx: @crate_ctxt, t: ty::t, llfnty: TypeRef, let mut fn_nm; //XXX this triggers duplicate LLVM symbols if false /*ccx.sess.opts.debuginfo*/ { - fn_nm = mangle_internal_name_by_type_only(ccx, t, "glue_" + name); + fn_nm = mangle_internal_name_by_type_only(ccx, t, @("glue_" + name)); } else { - fn_nm = mangle_internal_name_by_seq(ccx, "glue_" + name); + fn_nm = mangle_internal_name_by_seq(ccx, @("glue_" + name)); } note_unique_llvm_symbol(ccx, fn_nm); let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty); @@ -697,8 +697,8 @@ fn incr_refcnt_of_boxed(cx: block, box_ptr: ValueRef) { fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) { let _icx = bcx.insn_ctxt("make_visit_glue"); let mut bcx = bcx; - assert bcx.ccx().tcx.intrinsic_ifaces.contains_key("ty_visitor"); - let (iid, ty) = bcx.ccx().tcx.intrinsic_ifaces.get("ty_visitor"); + assert bcx.ccx().tcx.intrinsic_ifaces.contains_key(@"ty_visitor"); + let (iid, ty) = bcx.ccx().tcx.intrinsic_ifaces.get(@"ty_visitor"); let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), ty))); bcx = reflect::emit_calls_to_iface_visit_ty(bcx, t, v, iid); build_return(bcx); @@ -1495,7 +1495,7 @@ fn trans_crate_lit(cx: @crate_ctxt, lit: ast::lit) -> ValueRef { // to actually generate from this? C_integral(T_int_ty(cx, t), i as u64, True) } - ast::lit_float(fs, t) { C_floating(fs, T_float_ty(cx, t)) } + ast::lit_float(fs, t) { C_floating(*fs, T_float_ty(cx, t)) } ast::lit_bool(b) { C_bool(b) } ast::lit_nil { C_nil() } ast::lit_str(s) { @@ -2158,7 +2158,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t], ast_map::node_ctor(nm, _, ct, pt) { (pt, nm, alt ct { ast_map::res_ctor(_, _, sp) { sp } ast_map::class_ctor(ct_, _) { ct_.span }}) } - ast_map::node_dtor(_, dtor, _, pt) {(pt, "drop", dtor.span)} + ast_map::node_dtor(_, dtor, _, pt) {(pt, @"drop", dtor.span)} ast_map::node_expr(*) { ccx.tcx.sess.bug("Can't monomorphize an expr") } ast_map::node_export(*) { ccx.tcx.sess.bug("Can't monomorphize an export") @@ -2184,7 +2184,7 @@ fn monomorphic_fn(ccx: @crate_ctxt, fn_id: ast::def_id, real_substs: [ty::t], } ccx.monomorphizing.insert(fn_id, depth + 1u); - let pt = *pt + [path_name(ccx.names(name))]; + let pt = *pt + [path_name(@ccx.names(*name))]; let s = mangle_exported_name(ccx, pt, mono_ty); let mk_lldecl = {|| @@ -3382,7 +3382,7 @@ fn trans_rec(bcx: block, fields: [ast::field], let mut temp_cleanups = []; for fields.each {|fld| let ix = option::get(vec::position(ty_fields, {|ft| - str::eq(fld.node.ident, ft.ident) + str::eq(*fld.node.ident, *ft.ident) })); let dst = GEPi(bcx, addr, [0u, ix]); bcx = trans_expr_save_in(bcx, fld.node.expr, dst); @@ -3395,7 +3395,7 @@ fn trans_rec(bcx: block, fields: [ast::field], bcx = cx; // Copy over inherited fields for ty_fields.eachi {|i, tf| - if !vec::any(fields, {|f| str::eq(f.node.ident, tf.ident)}) { + if !vec::any(fields, {|f| str::eq(*f.node.ident, *tf.ident)}) { let dst = GEPi(bcx, addr, [0u, i]); let base = GEPi(bcx, base_val, [0u, i]); let val = load_if_immediate(bcx, base, tf.mt.ty); @@ -3841,7 +3841,7 @@ fn trans_log(log_ex: @ast::expr, lvl: @ast::expr, ccx.module_data.get(modname) } else { let s = link::mangle_internal_name_by_path_and_seq( - ccx, modpath, "loglevel"); + ccx, modpath, @"loglevel"); let global = str::as_c_str(s, {|buf| llvm::LLVMAddGlobal(ccx.llmod, T_i32(), buf) }); @@ -4320,7 +4320,7 @@ fn alloc_local(cx: block, local: @ast::local) -> block { let val = alloc_ty(cx, t); if cx.sess().opts.debuginfo { option::iter(simple_name) {|name| - str::as_c_str(name, {|buf| + str::as_c_str(*name, {|buf| llvm::LLVMSetValueName(val, buf) }); } @@ -4604,7 +4604,7 @@ fn trans_enum_variant(ccx: @crate_ctxt, enum_id: ast::node_id, let fn_args = vec::map(variant.node.args, {|varg| {mode: ast::expl(ast::by_copy), ty: varg.ty, - ident: "arg", + ident: @"arg", id: varg.id} }); let fcx = new_fn_ctxt_w_id(ccx, [], llfndecl, variant.node.id, @@ -5122,7 +5122,7 @@ fn get_dtor_symbol(ccx: @crate_ctxt, path: path, id: ast::node_id) -> str { some(s) { s } none { let s = mangle_exported_name(ccx, path + - [path_name(ccx.names("dtor"))], ty::node_id_to_type(ccx.tcx, id)); + [path_name(@ccx.names("dtor"))], ty::node_id_to_type(ccx.tcx, id)); ccx.item_symbols.insert(id, s); s } @@ -5164,7 +5164,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef { // def_ids otherwise -- one to identify the type, and one to // find the dtor symbol. let t = ty::node_id_to_type(ccx.tcx, dtor_id); - register_fn_full(ccx, i.span, my_path + [path_name("dtor")], + register_fn_full(ccx, i.span, my_path + [path_name(@"dtor")], i.id, t) } } @@ -5172,7 +5172,7 @@ fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef { ast_map::node_method(m, impl_id, pth) { exprt = true; let mty = ty::node_id_to_type(ccx.tcx, id); - let pth = *pth + [path_name(ccx.names("meth")), + let pth = *pth + [path_name(@ccx.names("meth")), path_name(m.ident)]; let llfn = register_fn_full(ccx, m.span, pth, id, mty); set_inline_hint_if_appr(m.attrs, llfn); @@ -5248,7 +5248,7 @@ fn trans_constant(ccx: @crate_ctxt, it: @ast::item) { let path = item_path(ccx, it); for vec::each(variants) {|variant| let p = path + [path_name(variant.node.name), - path_name("discrim")]; + path_name(@"discrim")]; let s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx)); let disr_val = vi[i].disr_val; note_unique_llvm_symbol(ccx, s); @@ -5376,7 +5376,7 @@ fn decl_crate_map(sess: session::session, mapmeta: link_meta, let cstore = sess.cstore; while cstore::have_crate_data(cstore, n_subcrates) { n_subcrates += 1; } let mapname = if sess.building_library { - mapmeta.name + "_" + mapmeta.vers + "_" + mapmeta.extras_hash + *mapmeta.name + "_" + *mapmeta.vers + "_" + mapmeta.extras_hash } else { "toplevel" }; let sym_name = "_rust_crate_map_" + mapname; let arrtype = T_array(int_type, n_subcrates as uint); @@ -5395,8 +5395,8 @@ fn fill_crate_map(ccx: @crate_ctxt, map: ValueRef) { while cstore::have_crate_data(cstore, i) { let cdata = cstore::get_crate_data(cstore, i); let nm = "_rust_crate_map_" + cdata.name + - "_" + cstore::get_crate_vers(cstore, i) + - "_" + cstore::get_crate_hash(cstore, i); + "_" + *cstore::get_crate_vers(cstore, i) + + "_" + *cstore::get_crate_hash(cstore, i); let cr = str::as_c_str(nm, {|buf| llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type, buf) }); @@ -5506,7 +5506,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt, // crashes if the module identifer is same as other symbols // such as a function name in the module. // 1. http://llvm.org/bugs/show_bug.cgi?id=11479 - let llmod_id = link_meta.name + ".rc"; + let llmod_id = *link_meta.name + ".rc"; let llmod = str::as_c_str(llmod_id, {|buf| llvm::LLVMModuleCreateWithNameInContext diff --git a/src/rustc/middle/trans/closure.rs b/src/rustc/middle/trans/closure.rs index a32983b79663d..8d97653d18289 100644 --- a/src/rustc/middle/trans/closure.rs +++ b/src/rustc/middle/trans/closure.rs @@ -390,7 +390,7 @@ fn trans_expr_fn(bcx: block, let ccx = bcx.ccx(), bcx = bcx; let fty = node_id_type(bcx, id); let llfnty = type_of_fn_from_ty(ccx, fty); - let sub_path = bcx.fcx.path + [path_name("anon")]; + let sub_path = bcx.fcx.path + [path_name(@"anon")]; let s = mangle_internal_name_by_path(ccx, sub_path); let llfn = decl_internal_cdecl_fn(ccx.llmod, s, llfnty); @@ -676,7 +676,7 @@ fn trans_bind_thunk(ccx: @crate_ctxt, // construct and return that thunk. // Give the thunk a name, type, and value. - let s = mangle_internal_name_by_path_and_seq(ccx, path, "thunk"); + let s = mangle_internal_name_by_path_and_seq(ccx, path, @"thunk"); let llthunk_ty = get_pair_fn_ty(type_of(ccx, incoming_fty)); let llthunk = decl_internal_cdecl_fn(ccx.llmod, s, llthunk_ty); diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index 3bac52a949a0b..6474fa716b4bc 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -933,7 +933,7 @@ fn path_str(p: path) -> str { alt e { ast_map::path_name(s) | ast_map::path_mod(s) { if first { first = false; } else { r += "::"; } - r += s; + r += *s; } } } r @@ -966,7 +966,7 @@ fn field_idx_strict(cx: ty::ctxt, sp: span, ident: ast::ident, -> uint { alt ty::field_idx(ident, fields) { none { cx.sess.span_bug(sp, #fmt("base expr doesn't appear to \ - have a field named %s", ident)); } + have a field named %s", *ident)); } some(i) { i } } } diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs index f45bb4d5011ea..f80dd130e0e59 100644 --- a/src/rustc/middle/trans/debuginfo.rs +++ b/src/rustc/middle/trans/debuginfo.rs @@ -421,7 +421,7 @@ fn create_record(cx: @crate_ctxt, t: ty::t, fields: [ast::ty_field], let field_t = ty::get_field(t, field.node.ident).mt.ty; let ty_md = create_ty(cx, field_t, field.node.mt.ty); let (size, align) = size_and_align_of(cx, field_t); - add_member(scx, field.node.ident, + add_member(scx, *field.node.ident, line_from_span(cx.sess.codemap, field.span) as int, size as int, align as int, ty_md.node); } @@ -661,7 +661,7 @@ fn create_local_var(bcx: block, local: @ast::local) none { create_function(bcx.fcx).node } some(_) { create_block(bcx).node } }; - let mdnode = create_var(tg, context, name, filemd.node, + let mdnode = create_var(tg, context, *name, filemd.node, loc.line as int, tymd.node); let mdval = @{node: mdnode, data: {id: local.node.id}}; update_cache(cache, AutoVariableTag, local_var_metadata(mdval)); @@ -703,7 +703,7 @@ fn create_arg(bcx: block, arg: ast::arg, sp: span) let tymd = create_ty(cx, ty, arg.ty); let filemd = create_file(cx, loc.file.name); let context = create_function(bcx.fcx); - let mdnode = create_var(tg, context.node, arg.ident, filemd.node, + let mdnode = create_var(tg, context.node, *arg.ident, filemd.node, loc.line as int, tymd.node); let mdval = @{node: mdnode, data: {id: arg.id}}; update_cache(cache, tg, argument_metadata(mdval)); @@ -769,10 +769,10 @@ fn create_function(fcx: fn_ctxt) -> @metadata { ast_map::node_expr(expr) { alt expr.node { ast::expr_fn(_, decl, _, _) { - (dbg_cx.names("fn"), decl.output, expr.id) + (@dbg_cx.names("fn"), decl.output, expr.id) } ast::expr_fn_block(decl, _, _) { - (dbg_cx.names("fn"), decl.output, expr.id) + (@dbg_cx.names("fn"), decl.output, expr.id) } _ { fcx.ccx.sess.span_bug(expr.span, "create_function: \ expected an expr_fn or fn_block here"); } @@ -810,8 +810,8 @@ fn create_function(fcx: fn_ctxt) -> @metadata { let fn_metadata = [lltag(SubprogramTag), llunused(), file_node, - llstr(ident), - llstr(ident), //XXX fully-qualified C++ name + llstr(*ident), + llstr(*ident), //XXX fully-qualified C++ name llstr(""), //XXX MIPS name????? file_node, lli32(loc.line as int), diff --git a/src/rustc/middle/trans/native.rs b/src/rustc/middle/trans/native.rs index 9dec0e8dfb07d..ed15741e57b2a 100644 --- a/src/rustc/middle/trans/native.rs +++ b/src/rustc/middle/trans/native.rs @@ -421,8 +421,8 @@ fn decl_x86_64_fn(tys: x86_64_tys, fn link_name(i: @ast::native_item) -> str { alt attr::first_attr_value_str_by_name(i.attrs, "link_name") { - none { ret i.ident; } - option::some(ln) { ret ln; } + none { ret *i.ident; } + option::some(ln) { ret *ln; } } } @@ -805,7 +805,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::native_item, let fcx = new_fn_ctxt_w_id(ccx, path, decl, item.id, some(substs), some(item.span)); let mut bcx = top_scope_block(fcx, none), lltop = bcx.llbb; - alt check item.ident { + alt check *item.ident { "size_of" { let tp_ty = substs.tys[0]; let lltp_ty = type_of::type_of(ccx, tp_ty); @@ -913,7 +913,7 @@ fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl, let _icx = ccx.insn_ctxt("native::crust::build_rust_fn"); let t = ty::node_id_to_type(ccx.tcx, id); let ps = link::mangle_internal_name_by_path( - ccx, path + [ast_map::path_name("__rust_abi")]); + ccx, path + [ast_map::path_name(@"__rust_abi")]); let llty = type_of_fn_from_ty(ccx, t); let llfndecl = decl_internal_cdecl_fn(ccx.llmod, ps, llty); trans_fn(ccx, path, decl, body, llfndecl, no_self, none, id); @@ -950,7 +950,7 @@ fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl, } let shim_name = link::mangle_internal_name_by_path( - ccx, path + [ast_map::path_name("__rust_stack_shim")]); + ccx, path + [ast_map::path_name(@"__rust_stack_shim")]); ret build_shim_fn_(ccx, shim_name, llrustfn, tys, lib::llvm::CCallConv, build_args, build_ret); diff --git a/src/rustc/middle/trans/reflect.rs b/src/rustc/middle/trans/reflect.rs index 4b6e92aa5adaf..0eaeb6513682f 100644 --- a/src/rustc/middle/trans/reflect.rs +++ b/src/rustc/middle/trans/reflect.rs @@ -41,7 +41,7 @@ impl methods for reflector { fn visit(ty_name: str, args: [ValueRef]) { let tcx = self.bcx.tcx(); - let mth_idx = option::get(ty::method_idx("visit_" + ty_name, + let mth_idx = option::get(ty::method_idx(@("visit_" + ty_name), *self.visitor_methods)); let mth_ty = ty::mk_fn(tcx, self.visitor_methods[mth_idx].fty); let v = self.visitor_val; @@ -142,7 +142,7 @@ impl methods for reflector { for fields.eachi {|i, field| self.bracketed_mt("rec_field", field.mt, [self.c_uint(i), - self.c_slice(field.ident)]); + self.c_slice(*field.ident)]); } self.visit("leave_rec", [self.c_uint(vec::len(fields))]); } @@ -209,7 +209,7 @@ impl methods for reflector { for fields.eachi {|i, field| self.bracketed_mt("class_field", field.mt, [self.c_uint(i), - self.c_slice(field.ident)]); + self.c_slice(*field.ident)]); } self.visit("leave_class", [self.c_uint(vec::len(fields))]); } @@ -228,7 +228,7 @@ impl methods for reflector { let extra = [self.c_uint(i), self.c_int(v.disr_val), self.c_uint(vec::len(v.args)), - self.c_slice(v.name)]; + self.c_slice(*v.name)]; self.visit("enter_enum_variant", extra); for v.args.eachi {|j, a| self.bracketed_t("enum_variant_field", a, diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index 2b21e3e954eaf..cfd779460eb34 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -421,7 +421,7 @@ fn gen_enum_shapes(ccx: @crate_ctxt) -> ValueRef { let variant_shape = shape_of_variant(ccx, v); add_substr(data, variant_shape); - let zname = str::bytes(v.name) + [0u8]; + let zname = str::bytes(*v.name) + [0u8]; add_substr(data, zname); } enum_variants += [variants]; diff --git a/src/rustc/middle/trans/tvec.rs b/src/rustc/middle/trans/tvec.rs index 0760bdaf24e2b..1861f690f9eac 100644 --- a/src/rustc/middle/trans/tvec.rs +++ b/src/rustc/middle/trans/tvec.rs @@ -233,7 +233,7 @@ fn get_base_and_len(cx: block, v: ValueRef, e_ty: ty::t) } } -fn trans_estr(bcx: block, s: str, vstore: ast::vstore, +fn trans_estr(bcx: block, s: @str, vstore: ast::vstore, dest: dest) -> block { let _icx = bcx.insn_ctxt("tvec::trans_estr"); let ccx = bcx.ccx(); @@ -242,27 +242,27 @@ fn trans_estr(bcx: block, s: str, vstore: ast::vstore, ast::vstore_fixed(_) { // "hello"/_ => "hello"/5 => [i8 x 6] in llvm - #debug("trans_estr: fixed: %s", s); - C_postr(s) + #debug("trans_estr: fixed: %s", *s); + C_postr(*s) } ast::vstore_slice(_) { // "hello" => (*i8, 6u) in llvm - #debug("trans_estr: slice '%s'", s); - C_estr_slice(ccx, s) + #debug("trans_estr: slice '%s'", *s); + C_estr_slice(ccx, *s) } ast::vstore_uniq { - let cs = PointerCast(bcx, C_cstr(ccx, s), T_ptr(T_i8())); - let len = C_uint(ccx, str::len(s)); + let cs = PointerCast(bcx, C_cstr(ccx, *s), T_ptr(T_i8())); + let len = C_uint(ccx, str::len(*s)); let c = Call(bcx, ccx.upcalls.str_new_uniq, [cs, len]); PointerCast(bcx, c, T_unique_ptr(T_unique(ccx, T_vec(ccx, T_i8())))) } ast::vstore_box { - let cs = PointerCast(bcx, C_cstr(ccx, s), T_ptr(T_i8())); - let len = C_uint(ccx, str::len(s)); + let cs = PointerCast(bcx, C_cstr(ccx, *s), T_ptr(T_i8())); + let len = C_uint(ccx, str::len(*s)); Call(bcx, ccx.upcalls.str_new_shared, [cs, len]) } }; diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index fac2754796a49..315e3be2afd4f 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -76,7 +76,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint) } ast_map::node_native_item(i@@{node: native_item_fn(_, _), _}, abi, _) { if abi == native_abi_rust_intrinsic { - let flags = alt check i.ident { + let flags = alt check *i.ident { "visit_ty" { 3u } "size_of" | "pref_align_of" | "min_align_of" | "init" | "reinterpret_cast" { use_repr } diff --git a/src/rustc/middle/tstate/auxiliary.rs b/src/rustc/middle/tstate/auxiliary.rs index b97e6b21c3988..acc11572fe2c2 100644 --- a/src/rustc/middle/tstate/auxiliary.rs +++ b/src/rustc/middle/tstate/auxiliary.rs @@ -41,7 +41,7 @@ fn comma_str(args: [@constr_arg_use]) -> str { if comma { rslt += ", "; } else { comma = true; } alt a.node { carg_base { rslt += "*"; } - carg_ident(i) { rslt += i.ident; } + carg_ident(i) { rslt += *i.ident; } carg_lit(l) { rslt += lit_to_str(l); } } } @@ -143,11 +143,11 @@ fn log_states_err(pp: pre_and_post_state) { log_cond_err(p2); } -fn print_ident(i: ident) { log(debug, " " + i + " "); } +fn print_ident(i: ident) { log(debug, " " + *i + " "); } fn print_idents(&idents: [ident]) { if vec::len::(idents) == 0u { ret; } - log(debug, "an ident: " + vec::pop::(idents)); + log(debug, "an ident: " + *vec::pop::(idents)); print_idents(idents); } @@ -500,7 +500,7 @@ fn constraints(fcx: fn_ctxt) -> [norm_constraint] { fn match_args(fcx: fn_ctxt, occs: @dvec, occ: [@constr_arg_use]) -> uint { #debug("match_args: looking at %s", - constr_args_to_str(fn@(i: inst) -> str { ret i.ident; }, occ)); + constr_args_to_str(fn@(i: inst) -> str { ret *i.ident; }, occ)); for (*occs).each {|pd| log(debug, "match_args: candidate " + pred_args_to_str(pd)); @@ -581,7 +581,7 @@ fn expr_to_constr(tcx: ty::ctxt, e: @expr) -> sp_constr { fn pred_args_to_str(p: pred_args) -> str { "<" + uint::str(p.node.bit_num) + ", " + - constr_args_to_str(fn@(i: inst) -> str { ret i.ident; }, p.node.args) + constr_args_to_str(fn@(i: inst) -> str { ret *i.ident; }, p.node.args) + ">" } @@ -695,7 +695,7 @@ fn insts_to_str(stuff: [constr_arg_general_]) -> str { rslt += " " + alt i { - carg_ident(p) { p.ident } + carg_ident(p) { *p.ident } carg_base { "*" } carg_lit(_) { "[lit]" } } + " "; diff --git a/src/rustc/middle/tstate/collect_locals.rs b/src/rustc/middle/tstate/collect_locals.rs index 0d3ab5321df3d..a6ce1642bab61 100644 --- a/src/rustc/middle/tstate/collect_locals.rs +++ b/src/rustc/middle/tstate/collect_locals.rs @@ -138,7 +138,7 @@ fn mk_fn_info(ccx: crate_ctxt, used_vars: v, ignore: ignore}; ccx.fm.insert(id, rslt); - #debug("%s has %u constraints", name, num_constraints(rslt)); + #debug("%s has %u constraints", *name, num_constraints(rslt)); } diff --git a/src/rustc/middle/tstate/states.rs b/src/rustc/middle/tstate/states.rs index 89932070a0c51..2b39288152b17 100644 --- a/src/rustc/middle/tstate/states.rs +++ b/src/rustc/middle/tstate/states.rs @@ -516,7 +516,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool { let stmt_ann = stmt_to_ann(fcx.ccx, *s); - #debug["[ %s ]", fcx.name]; + #debug["[ %s ]", *fcx.name]; #debug["*At beginning: stmt = %s", stmt_to_str(*s)]; #debug["*prestate = %s", tritv::to_str(stmt_ann.states.prestate)]; #debug["*poststate = %s", tritv::to_str(stmt_ann.states.prestate)]; diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 8ffc0f36d2039..02e683f4cbc73 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -237,7 +237,7 @@ type ctxt = node_type_substs: hashmap, items: ast_map::map, - intrinsic_ifaces: hashmap, + intrinsic_ifaces: hashmap, freevars: freevars::freevar_map, tcache: type_cache, rcache: creader_cache, @@ -322,7 +322,7 @@ enum region { enum bound_region { br_self, // The self region for classes, impls br_anon, // The anonymous region parameter for a given function. - br_named(str) // A named region parameter. + br_named(ast::ident) // A named region parameter. } type opt_region = option; @@ -414,7 +414,7 @@ enum type_err { terr_constr_mismatch(@type_constr, @type_constr), terr_regions_differ(region, region), terr_vstores_differ(terr_vstore_kind, vstore, vstore), - terr_in_field(@type_err, str), + terr_in_field(@type_err, ast::ident), terr_sorts(t, t), terr_self_substs } @@ -516,7 +516,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map, node_types: @smallintmap::mk(), node_type_substs: map::int_hash(), items: amap, - intrinsic_ifaces: map::str_hash(), + intrinsic_ifaces: map::box_str_hash(), freevars: freevars, tcache: ast_util::new_def_hash(), rcache: mk_rcache(), @@ -1992,7 +1992,7 @@ fn hash_bound_region(br: bound_region) -> uint { alt br { // no idea if this is any good ty::br_self { 0u } ty::br_anon { 1u } - ty::br_named(str) { str::hash(str) } + ty::br_named(str) { str::hash(*str) } } } @@ -2298,7 +2298,7 @@ fn field_idx(id: ast::ident, fields: [field]) -> option { } fn get_field(rec_ty: t, id: ast::ident) -> field { - alt check vec::find(get_fields(rec_ty), {|f| str::eq(f.ident, id) }) { + alt check vec::find(get_fields(rec_ty), {|f| str::eq(*f.ident, *id) }) { some(f) { f } } } @@ -2490,8 +2490,8 @@ fn type_err_to_str(cx: ctxt, err: type_err) -> str { } terr_record_mutability { ret "record elements differ in mutability"; } terr_record_fields(e_fld, a_fld) { - ret "expected a record with field `" + e_fld + - "` but found one with field `" + a_fld + "`"; + ret "expected a record with field `" + *e_fld + + "` but found one with field `" + *a_fld + "`"; } terr_arg_count { ret "incorrect number of function parameters"; } terr_mode_mismatch(e_mode, a_mode) { @@ -2521,7 +2521,7 @@ fn type_err_to_str(cx: ctxt, err: type_err) -> str { vstore_to_str(cx, a_vs)); } terr_in_field(err, fname) { - ret #fmt("in field `%s`, %s", fname, type_err_to_str(cx, *err)); + ret #fmt("in field `%s`, %s", *fname, type_err_to_str(cx, *err)); } terr_sorts(exp, act) { ret #fmt("%s vs %s", ty_sort_str(cx, exp), ty_sort_str(cx, act)); @@ -2592,7 +2592,7 @@ fn ty_to_def_id(ty: t) -> option { } // Enum information -type variant_info = @{args: [t], ctor_ty: t, name: str, +type variant_info = @{args: [t], ctor_ty: t, name: ast::ident, id: ast::def_id, disr_val: int}; fn substd_enum_variants(cx: ctxt, @@ -2667,7 +2667,7 @@ fn item_path(cx: ctxt, id: ast::def_id) -> ast_map::path { *path + [ast_map::path_name(nm)] } ast_map::node_dtor(_, _, _, path) { - *path + [ast_map::path_name("dtor")] + *path + [ast_map::path_name(@"dtor")] } @@ -2861,7 +2861,7 @@ fn lookup_class_method_by_name(cx:ctxt, did: ast::def_id, name: ident, } } cx.sess.span_fatal(sp, #fmt("Class doesn't have a method \ - named %s", name)); + named %s", *name)); } else { csearch::get_class_method(cx.sess.cstore, did, name) diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index bc7f46703e012..079228ada78f1 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -260,7 +260,7 @@ fn check_fn(ccx: @crate_ctxt, vec::iter2(arg_tys, decl.inputs) {|arg_ty, input| assign(input.id, some(arg_ty)); #debug["Argument %s is assigned to %s", - input.ident, fcx.locals.get(input.id).to_str()]; + *input.ident, fcx.locals.get(input.id).to_str()]; } // Add explicitly-declared locals. @@ -284,7 +284,7 @@ fn check_fn(ccx: @crate_ctxt, if !pat_util::pat_is_variant(fcx.ccx.tcx.def_map, p) { assign(p.id, none); #debug["Pattern binding %s is assigned to %s", - path.idents[0], + *path.idents[0], fcx.locals.get(p.id).to_str()]; } _ {} @@ -443,13 +443,13 @@ impl of region_scope for @fn_ctxt { fn anon_region() -> result { result::ok(self.infcx.next_region_var()) } - fn named_region(id: str) -> result { + fn named_region(id: ast::ident) -> result { empty_rscope.named_region(id).chain_err { |_e| alt self.in_scope_regions.find(ty::br_named(id)) { some(r) { result::ok(r) } - none if id == "blk" { self.block_region() } + none if *id == "blk" { self.block_region() } none { - result::err(#fmt["named region `%s` not in scope here", id]) + result::err(#fmt["named region `%s` not in scope here", *id]) } } } @@ -937,7 +937,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, self_expr: self_ex, borrow_scope: op_ex.id, node_id: callee_id, - m_name: opname, + m_name: @opname, self_ty: self_t, supplied_tps: [], include_private: false}); @@ -1113,7 +1113,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, ast::expr_vstore(ev, vst) { let typ = alt ev.node { ast::expr_lit(@{node: ast::lit_str(s), span:_}) { - let tt = ast_expr_vstore_to_vstore(fcx, ev, str::len(s), vst); + let tt = ast_expr_vstore_to_vstore(fcx, ev, str::len(*s), vst); ty::mk_estr(tcx, tt) } ast::expr_vec(args, mutbl) { @@ -1553,7 +1553,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, for fields_t.each {|f| let mut found = false; for base_fields.each {|bf| - if str::eq(f.node.ident, bf.ident) { + if str::eq(*f.node.ident, *bf.ident) { demand::suptype(fcx, f.span, bf.mt.ty, f.node.mt.ty); found = true; } @@ -1561,7 +1561,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, if !found { tcx.sess.span_fatal(f.span, "unknown field in record update: " + - f.node.ident); + *f.node.ident); } } } @@ -1645,7 +1645,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, let t_err = fcx.infcx.resolve_type_vars_if_possible(expr_t); let msg = #fmt["attempted access of field %s on type %s, but \ no public field or method with that name was found", - field, ty_to_str(tcx, t_err)]; + *field, ty_to_str(tcx, t_err)]; tcx.sess.span_err(expr.span, msg); // NB: Adding a bogus type to allow typechecking to continue fcx.write_ty(id, fcx.infcx.next_ty_var()); @@ -1690,7 +1690,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, self_expr: p, borrow_scope: expr.id, node_id: alloc_id, - m_name: "alloc", + m_name: @"alloc", self_ty: p_ty, supplied_tps: [], include_private: false}); @@ -2310,7 +2310,7 @@ fn check_bounds_are_used(ccx: @crate_ctxt, for tps_used.eachi { |i, b| if !b { ccx.tcx.sess.span_err( - span, #fmt["Type parameter %s is unused.", tps[i].ident]); + span, #fmt["Type parameter %s is unused.", *tps[i].ident]); } } } @@ -2323,7 +2323,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) { {mode: ast::expl(m), ty: ty} } let tcx = ccx.tcx; - let (n_tps, inputs, output) = alt it.ident { + let (n_tps, inputs, output) = alt *it.ident { "size_of" | "pref_align_of" | "min_align_of" { (1u, [], ty::mk_uint(ccx.tcx)) } "get_tydesc" { (1u, [], ty::mk_nil_ptr(tcx)) } @@ -2337,8 +2337,8 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) { "needs_drop" { (1u, [], ty::mk_bool(tcx)) } "visit_ty" { - assert ccx.tcx.intrinsic_ifaces.contains_key("ty_visitor"); - let (_, visitor_iface) = ccx.tcx.intrinsic_ifaces.get("ty_visitor"); + assert ccx.tcx.intrinsic_ifaces.contains_key(@"ty_visitor"); + let (_, visitor_iface) = ccx.tcx.intrinsic_ifaces.get(@"ty_visitor"); (1u, [arg(ast::by_ref, visitor_iface)], ty::mk_nil(tcx)) } "frame_address" { diff --git a/src/rustc/middle/typeck/check/alt.rs b/src/rustc/middle/typeck/check/alt.rs index 6965751084c1d..d274423c815a5 100644 --- a/src/rustc/middle/typeck/check/alt.rs +++ b/src/rustc/middle/typeck/check/alt.rs @@ -191,8 +191,8 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) { fields", ex_f_count, f_count]); } - fn matches(name: str, f: ty::field) -> bool { - ret str::eq(name, f.ident); + fn matches(name: ast::ident, f: ty::field) -> bool { + ret str::eq(*name, *f.ident); } for fields.each {|f| alt vec::find(ex_fields, bind matches(f.ident, _)) { @@ -203,7 +203,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) { tcx.sess.span_fatal(pat.span, #fmt["mismatched types: did not \ expect a record with a field `%s`", - f.ident]); + *f.ident]); } } } diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs index d6d43b0d3b2d7..22d51093fa301 100644 --- a/src/rustc/middle/typeck/check/method.rs +++ b/src/rustc/middle/typeck/check/method.rs @@ -19,7 +19,7 @@ impl methods for lookup { // Entrypoint: fn method() -> option { #debug["method lookup(m_name=%s, self_ty=%s)", - self.m_name, self.fcx.infcx.ty_to_str(self.self_ty)]; + *self.m_name, self.fcx.infcx.ty_to_str(self.self_ty)]; // First, see whether this is an interface-bounded parameter let pass1 = alt ty::get(self.self_ty).struct { diff --git a/src/rustc/middle/typeck/check/regionck.rs b/src/rustc/middle/typeck/check/regionck.rs index 81977a7901430..a837f1b267c4e 100644 --- a/src/rustc/middle/typeck/check/regionck.rs +++ b/src/rustc/middle/typeck/check/regionck.rs @@ -65,7 +65,7 @@ fn visit_pat(p: @ast::pat, &&rcx: rcx, v: rvt) { alt p.node { ast::pat_ident(path, _) if !pat_util::pat_is_variant(fcx.ccx.tcx.def_map, p) { - #debug["visit_pat binding=%s", path.idents[0]]; + #debug["visit_pat binding=%s", *path.idents[0]]; visit_node(p.id, p.span, rcx); } _ {} diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs index e81bd9d354780..afc79b52428be 100644 --- a/src/rustc/middle/typeck/collect.rs +++ b/src/rustc/middle/typeck/collect.rs @@ -29,7 +29,7 @@ fn collect_item_types(ccx: @crate_ctxt, crate: @ast::crate) { // there ought to be a better approach. Attributes? for crate.node.module.items.each {|crate_item| - if crate_item.ident == "intrinsic" { + if *crate_item.ident == "intrinsic" { alt crate_item.node { ast::item_mod(m) { for m.items.each {|intrinsic_item| @@ -170,7 +170,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span, self_ty: ty::t) { if impl_m.tps != if_m.tps { - tcx.sess.span_err(sp, "method `" + if_m.ident + + tcx.sess.span_err(sp, "method `" + *if_m.ident + "` has an incompatible set of type parameters"); ret; } @@ -178,7 +178,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span, if vec::len(impl_m.fty.inputs) != vec::len(if_m.fty.inputs) { tcx.sess.span_err(sp,#fmt["method `%s` has %u parameters \ but the iface has %u", - if_m.ident, + *if_m.ident, vec::len(impl_m.fty.inputs), vec::len(if_m.fty.inputs)]); ret; @@ -211,7 +211,7 @@ fn compare_impl_method(tcx: ty::ctxt, sp: span, }; require_same_types( tcx, sp, impl_fty, if_fty, - {|| "method `" + if_m.ident + "` has an incompatible type"}); + {|| "method `" + *if_m.ident + "` has an incompatible type"}); ret; // Replaces bound references to the self region with `with_r`. @@ -242,7 +242,7 @@ fn check_methods_against_iface(ccx: @crate_ctxt, ccx.tcx.sess.span_err( span, #fmt["method `%s`'s purity \ not match the iface method's \ - purity", m.ident]); + purity", *m.ident]); } compare_impl_method( ccx.tcx, span, m, vec::len(tps), @@ -251,7 +251,7 @@ fn check_methods_against_iface(ccx: @crate_ctxt, none { tcx.sess.span_err( a_ifacety.path.span, - #fmt["missing method `%s`", if_m.ident]); + #fmt["missing method `%s`", *if_m.ident]); } } // alt } // |if_m| @@ -511,7 +511,7 @@ fn ty_of_item(ccx: @crate_ctxt, it: @ast::item) rp: ast::rp_none, // functions do not have a self ty: ty::mk_fn(ccx.tcx, tofd)}; #debug["type of %s (id %d) is %s", - it.ident, it.id, ty_to_str(tcx, tpt.ty)]; + *it.ident, it.id, ty_to_str(tcx, tpt.ty)]; ccx.tcx.tcache.insert(local_def(it.id), tpt); ret tpt; } diff --git a/src/rustc/middle/typeck/rscope.rs b/src/rustc/middle/typeck/rscope.rs index cf5d78a0f2f53..2420250aa1ad6 100644 --- a/src/rustc/middle/typeck/rscope.rs +++ b/src/rustc/middle/typeck/rscope.rs @@ -2,7 +2,7 @@ import result::result; iface region_scope { fn anon_region() -> result; - fn named_region(id: str) -> result; + fn named_region(id: ast::ident) -> result; } enum empty_rscope { empty_rscope } @@ -10,8 +10,8 @@ impl of region_scope for empty_rscope { fn anon_region() -> result { result::err("region types are not allowed here") } - fn named_region(id: str) -> result { - if id == "static" { result::ok(ty::re_static) } + fn named_region(id: ast::ident) -> result { + if *id == "static" { result::ok(ty::re_static) } else { result::err("only the static region is allowed here") } } } @@ -27,9 +27,9 @@ impl of region_scope for type_rscope { } } } - fn named_region(id: str) -> result { + fn named_region(id: ast::ident) -> result { empty_rscope.named_region(id).chain_err { |_e| - if id == "self" { self.anon_region() } + if *id == "self" { self.anon_region() } else { result::err("named regions other than `self` are not \ allowed as part of a type declaration") @@ -47,7 +47,7 @@ impl of region_scope for @anon_rscope { fn anon_region() -> result { result::ok(self.anon) } - fn named_region(id: str) -> result { + fn named_region(id: ast::ident) -> result { self.base.named_region(id) } } @@ -61,7 +61,7 @@ impl of region_scope for @binding_rscope { fn anon_region() -> result { result::ok(ty::re_bound(ty::br_anon)) } - fn named_region(id: str) -> result { + fn named_region(id: ast::ident) -> result { self.base.named_region(id).chain_err {|_e| result::ok(ty::re_bound(ty::br_named(id))) } diff --git a/src/rustc/util/common.rs b/src/rustc/util/common.rs index dfddbab647fc1..e382e3835baea 100644 --- a/src/rustc/util/common.rs +++ b/src/rustc/util/common.rs @@ -72,7 +72,7 @@ fn local_rhs_span(l: @ast::local, def: span) -> span { fn is_main_name(path: syntax::ast_map::path) -> bool { // FIXME: path should be a constrained type, so we know // the call to last doesn't fail - vec::last(path) == syntax::ast_map::path_name("main") + vec::last(path) == syntax::ast_map::path_name(@"main") } // diff --git a/src/rustc/util/ppaux.rs b/src/rustc/util/ppaux.rs index 3c60cb911fe4a..431eb8b0aea6a 100644 --- a/src/rustc/util/ppaux.rs +++ b/src/rustc/util/ppaux.rs @@ -21,7 +21,7 @@ import driver::session::session; fn bound_region_to_str(cx: ctxt, br: bound_region) -> str { alt br { br_anon { "&" } - br_named(str) { #fmt["&%s", str] } + br_named(str) { #fmt["&%s", *str] } br_self if cx.sess.ppregions() { "&" } br_self { "&self" } } @@ -130,7 +130,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str { _ {purity_to_str(purity) + " "} }; s += proto_to_str(proto); - alt ident { some(i) { s += " "; s += i; } _ { } } + alt ident { some(i) { s += " "; s += *i; } _ { } } s += "("; let mut strs = []; for inputs.each {|a| strs += [fn_input_to_str(cx, a)]; } @@ -152,7 +152,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str { m.fty.output, m.fty.ret_style, m.fty.constraints) + ";"; } fn field_to_str(cx: ctxt, f: field) -> str { - ret f.ident + ": " + mt_to_str(cx, f.mt); + ret *f.ident + ": " + mt_to_str(cx, f.mt); } // if there is an id, print that instead of the structural type: diff --git a/src/rustdoc/attr_parser.rs b/src/rustdoc/attr_parser.rs index a16c90b4c083a..ca0878626a437 100644 --- a/src/rustdoc/attr_parser.rs +++ b/src/rustdoc/attr_parser.rs @@ -67,7 +67,8 @@ fn parse_crate(attrs: [ast::attribute]) -> crate_attrs { let link_metas = attr::find_linkage_metas(attrs); { - name: attr::last_meta_item_value_str_by_name(link_metas, "name") + name: attr::last_meta_item_value_str_by_name( + link_metas, "name").map({|x|*x}) } } @@ -98,7 +99,7 @@ fn should_not_extract_crate_name_if_no_name_value_in_link_attribute() { fn parse_desc(attrs: [ast::attribute]) -> option { alt doc_meta(attrs) { some(meta) { - attr::get_meta_item_value_str(meta) + attr::get_meta_item_value_str(meta).map({|x|*x}) } none { none } } diff --git a/src/rustdoc/attr_pass.rs b/src/rustdoc/attr_pass.rs index 9f1fc9fdc22b7..983576e581687 100644 --- a/src/rustdoc/attr_pass.rs +++ b/src/rustdoc/attr_pass.rs @@ -151,7 +151,7 @@ fn fold_enum( }, _) { let ast_variant = option::get( vec::find(ast_variants) {|v| - v.node.name == variant.name + *v.node.name == variant.name }); attr_parser::parse_desc(ast_variant.node.attrs) @@ -207,14 +207,14 @@ fn merge_method_attrs( node: ast::item_iface(_, _, methods), _ }, _) { par::seqmap(methods) {|method| - (method.ident, attr_parser::parse_desc(method.attrs)) + (*method.ident, attr_parser::parse_desc(method.attrs)) } } ast_map::node_item(@{ node: ast::item_impl(_, _, _, _, methods), _ }, _) { par::seqmap(methods) {|method| - (method.ident, attr_parser::parse_desc(method.attrs)) + (*method.ident, attr_parser::parse_desc(method.attrs)) } } _ { fail "unexpected item" } diff --git a/src/rustdoc/extract.rs b/src/rustdoc/extract.rs index 25bf5d6c64f4c..35e9fd5ea31b2 100644 --- a/src/rustdoc/extract.rs +++ b/src/rustdoc/extract.rs @@ -33,14 +33,14 @@ fn top_moddoc_from_crate( crate: @ast::crate, default_name: str ) -> doc::moddoc { - moddoc_from_mod(mk_itemdoc(ast::crate_node_id, default_name), + moddoc_from_mod(mk_itemdoc(ast::crate_node_id, @default_name), crate.node.module) } fn mk_itemdoc(id: ast::node_id, name: ast::ident) -> doc::itemdoc { { id: id, - name: name, + name: *name, path: [], brief: none, desc: none, @@ -169,7 +169,7 @@ fn variantdocs_from_variants( fn variantdoc_from_variant(variant: ast::variant) -> doc::variantdoc { { - name: variant.node.name, + name: *variant.node.name, desc: none, sig: none } @@ -210,7 +210,7 @@ fn ifacedoc_from_iface( item: itemdoc, methods: par::seqmap(methods) {|method| { - name: method.ident, + name: *method.ident, brief: none, desc: none, sections: [], @@ -242,7 +242,7 @@ fn impldoc_from_impl( self_ty: none, methods: par::seqmap(methods) {|method| { - name: method.ident, + name: *method.ident, brief: none, desc: none, sections: [], diff --git a/src/rustdoc/prune_unexported_pass.rs b/src/rustdoc/prune_unexported_pass.rs index 2c14271a630b8..0c4614adf1dac 100644 --- a/src/rustdoc/prune_unexported_pass.rs +++ b/src/rustdoc/prune_unexported_pass.rs @@ -114,7 +114,7 @@ fn is_exported_from_mod( ast_map::node_item(item, _) { alt item.node { ast::item_mod(m) { - ast_util::is_exported(item_name, m) + ast_util::is_exported(@item_name, m) } _ { fail "is_exported_from_mod: not a mod"; @@ -131,7 +131,7 @@ fn is_exported_from_crate( item_name: str ) -> bool { astsrv::exec(srv) {|ctxt| - ast_util::is_exported(item_name, ctxt.ast.node.module) + ast_util::is_exported(@item_name, ctxt.ast.node.module) } } diff --git a/src/rustdoc/reexport_pass.rs b/src/rustdoc/reexport_pass.rs index 338c5d70f2875..f9448bff082af 100644 --- a/src/rustdoc/reexport_pass.rs +++ b/src/rustdoc/reexport_pass.rs @@ -187,7 +187,7 @@ fn build_reexport_path_map(srv: astsrv::srv, -def_map: def_map) -> path_map { if !def.reexp { cont; } alt def_map.find(def.id) { some(itemtag) { - reexportdocs += [(name, itemtag)]; + reexportdocs += [(*name, itemtag)]; } _ {} } @@ -231,9 +231,9 @@ fn find_reexport_impl_docs( some(ast_map::node_item(item, path)) { let path = ast_map::path_to_str(*path); if str::is_empty(path) { - item.ident + *item.ident } else { - path + "::" + item.ident + path + "::" + *item.ident } } _ { @@ -241,7 +241,7 @@ fn find_reexport_impl_docs( "" } }; - let ident = i.ident; + let ident = *i.ident; let doc = alt check def_map.find(i.did) { some(doc) { doc } }; diff --git a/src/rustdoc/tystr_pass.rs b/src/rustdoc/tystr_pass.rs index 289062ddcdf91..85740205ffa5b 100644 --- a/src/rustdoc/tystr_pass.rs +++ b/src/rustdoc/tystr_pass.rs @@ -116,7 +116,7 @@ fn fold_enum( }, _) { let ast_variant = option::get( vec::find(ast_variants) {|v| - v.node.name == variant.name + *v.node.name == variant.name }); pprust::variant_to_str(ast_variant) @@ -151,7 +151,7 @@ fn fold_res( ast_map::node_item(@{ node: ast::item_res(decl, tys, _, _, _, rp), _ }, _) { - pprust::res_to_str(decl, doc.name(), tys, rp) + pprust::res_to_str(decl, @doc.name(), tys, rp) } } }) @@ -200,7 +200,7 @@ fn get_method_sig( node: ast::item_iface(_, _, methods), _ }, _) { alt check vec::find(methods) {|method| - method.ident == method_name + *method.ident == method_name } { some(method) { some(pprust::fun_to_str( @@ -215,7 +215,7 @@ fn get_method_sig( node: ast::item_impl(_, _, _, _, methods), _ }, _) { alt check vec::find(methods) {|method| - method.ident == method_name + *method.ident == method_name } { some(method) { some(pprust::fun_to_str( @@ -307,7 +307,7 @@ fn fold_type( }, _) { some(#fmt( "type %s%s = %s", - ident, + *ident, pprust::typarams_to_str(params), pprust::ty_to_str(ty) )) From cce7327487e113d1d38c7771a187d3ad29dc0011 Mon Sep 17 00:00:00 2001 From: Lindsey Kuper Date: Wed, 13 Jun 2012 11:08:21 -0700 Subject: [PATCH 4/9] Allow trailing commas in import lists. Closes #2582. --- src/libsyntax/parse/parser.rs | 2 +- src/test/run-pass/import-trailing-comma.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/test/run-pass/import-trailing-comma.rs diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 975e90318770a..e0029b2a222f5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2414,7 +2414,7 @@ class parser { token::LBRACE { let idents = self.parse_unspanned_seq( token::LBRACE, token::RBRACE, - seq_sep_trailing_disallowed(token::COMMA), + seq_sep_trailing_allowed(token::COMMA), {|p| p.parse_path_list_ident()}); let path = @{span: mk_sp(lo, self.span.hi), global: false, idents: path, diff --git a/src/test/run-pass/import-trailing-comma.rs b/src/test/run-pass/import-trailing-comma.rs new file mode 100644 index 0000000000000..a6a56e9009dc6 --- /dev/null +++ b/src/test/run-pass/import-trailing-comma.rs @@ -0,0 +1,10 @@ +import foo::bar::{baz, quux,}; + +mod foo { + mod bar { + fn baz() { } + fn quux() { } + } +} + +fn main() { baz(); quux(); } From 6f95c79b95319a8d91de2a5e361eab8d71375d05 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 13 Jun 2012 11:20:21 -0700 Subject: [PATCH 5/9] Traverse types in reachability Issue 2526 showed a test case where a library exported only a type that was a synonym for a class. Because the class's destructor wasn't getting marked as reachable, its linkage was wrongly getting set to "internal". The solution is for reachability to traverse types. Closes #2526. --- src/rustc/middle/trans/reachable.rs | 28 ++++++++++++++++++++++++- src/test/auxiliary/issue-2526.rs | 32 +++++++++++++++++++++++++++++ src/test/run-pass/issue-2526-a.rs | 8 ++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/test/auxiliary/issue-2526.rs create mode 100644 src/test/run-pass/issue-2526-a.rs diff --git a/src/rustc/middle/trans/reachable.rs b/src/rustc/middle/trans/reachable.rs index 2b70846787420..55a4b865e903b 100644 --- a/src/rustc/middle/trans/reachable.rs +++ b/src/rustc/middle/trans/reachable.rs @@ -135,11 +135,37 @@ fn traverse_public_item(cx: ctx, item: @item) { } } } - item_const(*) | item_ty(*) | + item_ty(t, _, _) { + traverse_ty(t, cx, mk_ty_visitor()); + } + item_const(*) | item_enum(*) | item_iface(*) {} } } +fn mk_ty_visitor() -> visit::vt { + visit::mk_vt(@{visit_ty: traverse_ty with *visit::default_visitor()}) +} + +fn traverse_ty(ty: @ty, cx: ctx, v: visit::vt) { + if cx.rmap.contains_key(ty.id) { ret; } + cx.rmap.insert(ty.id, ()); + + alt ty.node { + ty_path(p, p_id) { + alt cx.tcx.def_map.find(p_id) { + // Kind of a hack to check this here, but I'm not sure what else + // to do + some(def_prim_ty(_)) { /* do nothing */ } + some(d) { traverse_def_id(cx, def_id_of_def(d)); } + none { /* do nothing -- but should we fail here? */ } + } + for p.types.each {|t| v.visit_ty(t, cx, v); }; + } + _ { visit::visit_ty(ty, cx, v); } + } +} + fn traverse_inline_body(cx: ctx, body: blk) { fn traverse_expr(e: @expr, cx: ctx, v: visit::vt) { alt e.node { diff --git a/src/test/auxiliary/issue-2526.rs b/src/test/auxiliary/issue-2526.rs new file mode 100644 index 0000000000000..9dd7d262731ed --- /dev/null +++ b/src/test/auxiliary/issue-2526.rs @@ -0,0 +1,32 @@ +#[link(name = "zmq", + vers = "0.2", + uuid = "54cc1bc9-02b8-447c-a227-75ebc923bc29")]; +#[crate_type = "lib"]; + +use std; + +export context; + +resource arc_destruct(_data: int) { } + +fn arc(_data: T) -> arc_destruct { + arc_destruct(0) +} + +fn init() -> arc_destruct unsafe { + arc(context_res()) +} + +class context_res { + let ctx : int; + + new() { self.ctx = 0; } + + drop { } +} + +type context = arc_destruct; + +impl context for context { + fn socket() { } +} diff --git a/src/test/run-pass/issue-2526-a.rs b/src/test/run-pass/issue-2526-a.rs new file mode 100644 index 0000000000000..fdbcc005ae2b4 --- /dev/null +++ b/src/test/run-pass/issue-2526-a.rs @@ -0,0 +1,8 @@ +// xfail-fast +// aux-build:issue-2526.rs + +use zmq; +import zmq::*; + +fn main() {} + From e5a5fc20290e70752af73860b1a192b33588624f Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Wed, 13 Jun 2012 15:46:57 -0700 Subject: [PATCH 6/9] Allow impls to be re-exported It was a little hard for me to believe, but it seems that re-exporting an impl doesn't work at a, because encoder::encode_info_for_mod requires that all the impls in the current module's impl map be local (that is, bound to a value in the current crate's item map). Fixed it. Closes #2414. --- src/rustc/metadata/encoder.rs | 14 +++++++++----- src/test/auxiliary/issue-2414-a.rs | 5 +++++ src/test/auxiliary/issue-2414-b.rs | 9 +++++++++ src/test/run-pass/issue-2414-c.rs | 7 +++++++ 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 src/test/auxiliary/issue-2414-a.rs create mode 100644 src/test/auxiliary/issue-2414-b.rs create mode 100644 src/test/run-pass/issue-2414-c.rs diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index e10554c79edf0..9ad1ef1a4e1d4 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -396,17 +396,21 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: ebml::writer, md: _mod, let (ident, did) = i; if ast_util::is_exported(ident, md) { ebml_w.start_tag(tag_mod_impl); + alt ecx.tcx.items.find(did.node) { + some(ast_map::node_item(it@@{node: cl@item_class(*),_},_)) { /* If did stands for an iface ref, we need to map it to its parent class */ - alt ecx.tcx.items.get(did.node) { - ast_map::node_item(it@@{node: cl@item_class(*),_},_) { ebml_w.wr_str(def_to_str(local_def(it.id))); } - ast_map::node_item(@{node: item_impl(_,_, - some(ifce),_,_),_},_) { + some(ast_map::node_item(@{node: item_impl(_,_, + some(ifce),_,_),_},_)) { ebml_w.wr_str(def_to_str(did)); } - _ { + some(_) { + ebml_w.wr_str(def_to_str(did)); + } + none { + // Must be a re-export, then! ebml_w.wr_str(def_to_str(did)); } }; diff --git a/src/test/auxiliary/issue-2414-a.rs b/src/test/auxiliary/issue-2414-a.rs new file mode 100644 index 0000000000000..0f4b51a8dad4e --- /dev/null +++ b/src/test/auxiliary/issue-2414-a.rs @@ -0,0 +1,5 @@ +#[link(name = "a", vers = "0.1")]; +#[crate_type = "lib"]; + +type t1 = uint; +impl t2 for str { } diff --git a/src/test/auxiliary/issue-2414-b.rs b/src/test/auxiliary/issue-2414-b.rs new file mode 100644 index 0000000000000..b5a27c6fabc45 --- /dev/null +++ b/src/test/auxiliary/issue-2414-b.rs @@ -0,0 +1,9 @@ +// xfail-fast + +#[link(name = "b", vers = "0.1")]; +#[crate_type = "lib"]; + +use a; + +import a::t2; +export t2; diff --git a/src/test/run-pass/issue-2414-c.rs b/src/test/run-pass/issue-2414-c.rs new file mode 100644 index 0000000000000..17defc82e229c --- /dev/null +++ b/src/test/run-pass/issue-2414-c.rs @@ -0,0 +1,7 @@ +// xfail-fast +// aux-build:issue-2414-a.rs +// aux-build:issue-2414-b.rs + +use b; + +fn main() {} From f8afe107fa7a677dc611dd39532570ddaab3bfab Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Wed, 13 Jun 2012 15:07:19 -0700 Subject: [PATCH 7/9] Minor makefile cleanup. --- mk/rt.mk | 7 ++++--- mk/rustllvm.mk | 5 ----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/mk/rt.mk b/mk/rt.mk index af991f747b988..cd38226730161 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -142,9 +142,10 @@ rt/$(1)/$(CFG_RUNTIME): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \ $$(CFG_GCCISH_POST_LIB_FLAGS) $$(RUNTIME_LIBS_$(1)) \ $$(CFG_LIBUV_LINK_FLAGS),$$(RUNTIME_DEF_$(1)),$$(CFG_RUNTIME)) -# FIXME: For some reason libuv's makefiles can't figure out the correct definition -# of CC on the mingw I'm using, so we are explicitly using gcc. Also, we -# have to list environment variables first on windows... mysterious +# FIXME: For some reason libuv's makefiles can't figure out the +# correct definition of CC on the mingw I'm using, so we are +# explicitly using gcc. Also, we have to list environment variables +# first on windows... mysterious ifdef CFG_ENABLE_FAST_MAKE LIBUV_DEPS := $$(S)/.gitmodules diff --git a/mk/rustllvm.mk b/mk/rustllvm.mk index 8453f7b94688c..fea09dae5af90 100644 --- a/mk/rustllvm.mk +++ b/mk/rustllvm.mk @@ -14,11 +14,6 @@ endif RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, RustWrapper.cpp) -# Behind an ifdef for now since this requires a patched LLVM. -ifdef CFG_STACK_GROWTH -RUSTLLVM_OBJS_CS_$(1) += rustllvm/RustPrologHook.cpp -endif - RUSTLLVM_DEF_$(1) := rustllvm/rustllvm$$(CFG_DEF_SUFFIX) RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \ From 31f4b63dffb49e65d3de4ecbef573e15b0f44e36 Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Wed, 13 Jun 2012 15:27:07 -0700 Subject: [PATCH 8/9] Update the build system to handle dependency on header files. Closes #2547. --- mk/platform.mk | 14 +++++++++----- mk/rt.mk | 19 +++++-------------- mk/rustllvm.mk | 2 ++ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/mk/platform.mk b/mk/platform.mk index 61526f1f559a4..1a487ca80d836 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -214,14 +214,16 @@ ifeq ($(CFG_C_COMPILER),clang) endif CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g CFG_GCCISH_LINK_FLAGS += -g - CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \ - -MM $(2) + # These flags will cause the compiler to produce a .d file + # next to the .o file that lists header deps. + CFG_DEPEND_FLAGS = -MMD -MP -MT $(1) -MF $(1:%.o=%.d) define CFG_MAKE_CC CFG_COMPILE_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \ $$(CFG_GCCISH_CFLAGS) $$(CFG_CLANG_CFLAGS) \ $$(CFG_GCCISH_CFLAGS_$$(HOST_$(1))) \ $$(CFG_CLANG_CFLAGS_$$(HOST_$(1))) \ + $$(CFG_DEPEND_FLAGS) \ -c -o $$(1) $$(2) CFG_LINK_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \ $$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \ @@ -245,8 +247,9 @@ ifeq ($(CFG_C_COMPILER),gcc) endif CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g CFG_GCCISH_LINK_FLAGS += -g - CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \ - -MM $(2) + # These flags will cause the compiler to produce a .d file + # next to the .o file that lists header deps. + CFG_DEPEND_FLAGS = -MMD -MP -MT $(1) -MF $(1:%.o=%.d) define CFG_MAKE_CC CFG_COMPILE_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \ @@ -254,6 +257,7 @@ ifeq ($(CFG_C_COMPILER),gcc) $$(CFG_GCCISH_CFLAGS_$$(HOST_$(1))) \ $$(CFG_GCC_CFLAGS) \ $$(CFG_GCC_CFLAGS_$$(HOST_$(1))) \ + $$(CFG_DEPEND_FLAGS) \ -c -o $$(1) $$(2) CFG_LINK_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \ $$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \ @@ -272,7 +276,7 @@ endif # We're using llvm-mc as our assembler because it supports # .cfi pseudo-ops on mac define CFG_MAKE_ASSEMBLER - CFG_ASSEMBLE_$(1)=$$(CPP) $$(2) | \ + CFG_ASSEMBLE_$(1)=$$(CPP) $$(CFG_DEPEND_FLAGS) $$(2) | \ $$(LLVM_MC_$$(CFG_HOST_TRIPLE)) \ -assemble \ -filetype=obj \ diff --git a/mk/rt.mk b/mk/rt.mk index cd38226730161..7f5d024079e1b 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -79,17 +79,6 @@ RUNTIME_S_$(1) := rt/arch/$$(HOST_$(1))/_context.S \ rt/arch/$$(HOST_$(1))/ccall.S \ rt/arch/$$(HOST_$(1))/record_sp.S -RUNTIME_HDR_$(1) := $$(wildcard \ - rt/*.h \ - rt/bigint/*.h \ - rt/isaac/*.h \ - rt/msvc/*.h \ - rt/sync/*.h \ - rt/uthash/*.h \ - rt/util/*.h \ - rt/vg/*.h \ - rt/arch/$$(HOST_$(1))/*.h) - ifeq ($$(HOST_$(1)), i386) LIBUV_ARCH_$(1) := ia32 else @@ -116,14 +105,17 @@ RUNTIME_INCS_$(1) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \ -I $$(S)src/libuv/include RUNTIME_OBJS_$(1) := $$(RUNTIME_CS_$(1):rt/%.cpp=rt/$(1)/%.o) \ $$(RUNTIME_S_$(1):rt/%.S=rt/$(1)/%.o) +RUNTIME_DEP_FILES_$(1) := $$(RUNTIME_OBJS_$(1):%.o=%.d) +-include $$(RUNTIME_DEP_FILES_$(1)) + RUNTIME_LIBS_$(1) := $$(LIBUV_LIB_$(1)) -rt/$(1)/%.o: rt/%.cpp $$(RUNTIME_HDR_$(1)) $$(MKFILE_DEPS) +rt/$(1)/%.o: rt/%.cpp $$(MKFILE_DEPS) @$$(call E, compile: $$@) $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1)) \ $$(SNAP_DEFINES)) $$< -rt/$(1)/%.o: rt/%.S $$(RUNTIME_HDR_$(1)) $$(MKFILE_DEPS) \ +rt/$(1)/%.o: rt/%.S $$(MKFILE_DEPS) \ $$(LLVM_CONFIG_$$(CFG_HOST_TRIPLE)) @$$(call E, compile: $$@) $$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<) @@ -134,7 +126,6 @@ rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a: \ $$(Q)ar rcs $$@ $$< rt/$(1)/$(CFG_RUNTIME): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \ - $$(RUNTIME_HDR_$(1)) \ $$(RUNTIME_DEF_$(1)) \ $$(RUNTIME_LIBS_$(1)) @$$(call E, link: $$@) diff --git a/mk/rustllvm.mk b/mk/rustllvm.mk index fea09dae5af90..63b71eb3850e7 100644 --- a/mk/rustllvm.mk +++ b/mk/rustllvm.mk @@ -20,6 +20,8 @@ RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \ -iquote $$(LLVM_INCDIR_$(1)) \ -iquote $$(S)src/rustllvm/include RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=rustllvm/$(1)/%.o) +RUSTLLVM_DEP_FILES_$(1) := $$(RUSTLLVM_OBJS_OBJS_$(1):%.o=%.d) +-include $$(RUSTLLVM_DEP_FILES_$(1)) rustllvm/$(1)/$(CFG_RUSTLLVM): $$(RUSTLLVM_OBJS_OBJS_$(1)) \ $$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1)) From f3868061cd7988080c30d6d5bf352a5a5fe2460b Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 13 Jun 2012 18:07:21 -0700 Subject: [PATCH 9/9] Remove typestate --- doc/rust.md | 372 +------ src/cargo/cargo.rs | 1 - src/compiletest/compiletest.rs | 1 - src/compiletest/runtest.rs | 1 - src/fuzzer/fuzzer.rs | 3 - src/libcore/path.rs | 2 +- src/libcore/result.rs | 7 +- src/libsyntax/ast.rs | 66 +- src/libsyntax/ast_util.rs | 2 +- src/libsyntax/ext/auto_serialize.rs | 17 +- src/libsyntax/fold.rs | 44 +- src/libsyntax/parse/classify.rs | 8 +- src/libsyntax/parse/parser.rs | 126 +-- src/libsyntax/print/pprust.rs | 78 +- src/libsyntax/visit.rs | 19 +- src/rustc/back/rpath.rs | 9 +- src/rustc/driver/driver.rs | 2 - src/rustc/front/test.rs | 9 +- src/rustc/metadata/tydecode.rs | 87 +- src/rustc/metadata/tyencode.rs | 49 - src/rustc/middle/borrowck/categorization.rs | 4 +- src/rustc/middle/liveness.rs | 10 +- src/rustc/middle/resolve.rs | 16 - src/rustc/middle/trans/base.rs | 37 +- src/rustc/middle/trans/native.rs | 3 +- src/rustc/middle/trans/reflect.rs | 1 - src/rustc/middle/trans/shape.rs | 1 - src/rustc/middle/trans/type_of.rs | 1 - src/rustc/middle/trans/type_use.rs | 4 +- src/rustc/middle/tstate/ann.rs | 257 ----- src/rustc/middle/tstate/annotate.rs | 74 -- src/rustc/middle/tstate/auxiliary.rs | 981 ------------------ src/rustc/middle/tstate/bitvectors.rs | 186 ---- src/rustc/middle/tstate/ck.rs | 151 --- src/rustc/middle/tstate/collect_locals.rs | 163 --- .../middle/tstate/pre_post_conditions.rs | 637 ------------ src/rustc/middle/tstate/states.rs | 631 ----------- src/rustc/middle/tstate/tritv.rs | 291 ------ src/rustc/middle/ty.rs | 137 +-- src/rustc/middle/typeck.rs | 4 +- src/rustc/middle/typeck/astconv.rs | 13 +- src/rustc/middle/typeck/check.rs | 86 +- src/rustc/middle/typeck/collect.rs | 10 +- src/rustc/middle/typeck/infer.rs | 74 +- src/rustc/rustc.rc | 13 - src/rustc/util/ppaux.rs | 35 +- src/rustdoc/unindent_pass.rs | 2 +- src/test/compile-fail/fn-constraint.rs | 10 - .../compile-fail/if-check-precond-fail.rs | 12 - src/test/compile-fail/impure-pred.rs | 3 - src/test/compile-fail/liveness-unused.rs | 7 +- .../compile-fail/loop-pred-constraints.rs | 16 - src/test/compile-fail/no-constraint-prop.rs | 18 - src/test/compile-fail/nonsense-constraints.rs | 13 - src/test/compile-fail/not-a-pred-2.rs | 14 - src/test/compile-fail/not-a-pred-check.rs | 10 - src/test/compile-fail/not-a-pred.rs | 8 - src/test/compile-fail/not-pred-args.rs | 11 - src/test/compile-fail/pred-assign.rs | 16 - src/test/compile-fail/pred-on-wrong-slots.rs | 17 - src/test/compile-fail/pred-swap.rs | 16 - src/test/compile-fail/slot-as-pred.rs | 12 - src/test/compile-fail/tstate-and-init.rs | 7 - src/test/compile-fail/tstate-block-uninit.rs | 11 - .../compile-fail/tstate-break-uninit-2.rs | 16 - src/test/compile-fail/tstate-break-uninit.rs | 16 - src/test/compile-fail/tstate-ctor-unsat.rs | 25 - src/test/compile-fail/tstate-fru.rs | 14 - src/test/compile-fail/tstate-if-no-else.rs | 10 - src/test/compile-fail/tstate-if-with-else.rs | 14 - .../compile-fail/tstate-loop-constraints.rs | 19 - src/test/compile-fail/tstate-or-init.rs | 7 - src/test/compile-fail/tstate-return.rs | 9 - .../compile-fail/tstate-unsat-after-item.rs | 9 - .../tstate-unsat-in-called-fn-expr.rs | 9 - .../compile-fail/tstate-unsat-in-fn-expr.rs | 9 - src/test/compile-fail/tstate-unsat.rs | 7 - src/test/compile-fail/tstate-while-break.rs | 15 - src/test/compile-fail/tstate-while-cond.rs | 7 - .../tstate-while-loop-unsat-constriants.rs | 16 - src/test/compile-fail/tstate-while.rs | 10 - src/test/run-fail/fn-constraint-claim.rs | 7 - src/test/run-fail/fn-constraint.rs | 9 - src/test/run-fail/if-check-fail.rs | 16 - src/test/run-fail/pred.rs | 7 - src/test/run-fail/unwind-check.rs | 8 - src/test/run-fail/zip-different-lengths.rs | 36 - src/test/run-pass/bug-862.rs | 7 - src/test/run-pass/check-pattern-bound.rs | 9 - src/test/run-pass/claim-nonterm.rs | 7 - src/test/run-pass/constrained-type.rs | 11 - .../run-pass/constraint-prop-expr-move.rs | 10 - src/test/run-pass/constraint-prop-move.rs | 8 - src/test/run-pass/constraint-prop-swap.rs | 8 - src/test/run-pass/constraint-prop.rs | 8 - src/test/run-pass/fn-constraint.rs | 7 - src/test/run-pass/if-check-precond.rs | 11 - src/test/run-pass/if-check.rs | 15 - src/test/run-pass/issue-933.rs | 2 - src/test/run-pass/issue-970.rs | 6 - src/test/run-pass/non-boolean-pure-fns.rs | 8 +- src/test/run-pass/pred-check.rs | 4 - src/test/run-pass/pred.rs | 14 - src/test/run-pass/typestate-transitive.rs | 7 - src/test/run-pass/unchecked-predicates.rs | 41 - src/test/run-pass/weird-exprs.rs | 4 +- src/test/run-pass/zip-same-length.rs | 39 - 107 files changed, 105 insertions(+), 5342 deletions(-) delete mode 100644 src/rustc/middle/tstate/ann.rs delete mode 100644 src/rustc/middle/tstate/annotate.rs delete mode 100644 src/rustc/middle/tstate/auxiliary.rs delete mode 100644 src/rustc/middle/tstate/bitvectors.rs delete mode 100644 src/rustc/middle/tstate/ck.rs delete mode 100644 src/rustc/middle/tstate/collect_locals.rs delete mode 100644 src/rustc/middle/tstate/pre_post_conditions.rs delete mode 100644 src/rustc/middle/tstate/states.rs delete mode 100644 src/rustc/middle/tstate/tritv.rs delete mode 100644 src/test/compile-fail/fn-constraint.rs delete mode 100644 src/test/compile-fail/if-check-precond-fail.rs delete mode 100644 src/test/compile-fail/loop-pred-constraints.rs delete mode 100644 src/test/compile-fail/no-constraint-prop.rs delete mode 100644 src/test/compile-fail/nonsense-constraints.rs delete mode 100644 src/test/compile-fail/not-a-pred-2.rs delete mode 100644 src/test/compile-fail/not-a-pred-check.rs delete mode 100644 src/test/compile-fail/not-a-pred.rs delete mode 100644 src/test/compile-fail/not-pred-args.rs delete mode 100644 src/test/compile-fail/pred-assign.rs delete mode 100644 src/test/compile-fail/pred-on-wrong-slots.rs delete mode 100644 src/test/compile-fail/pred-swap.rs delete mode 100644 src/test/compile-fail/slot-as-pred.rs delete mode 100644 src/test/compile-fail/tstate-and-init.rs delete mode 100644 src/test/compile-fail/tstate-block-uninit.rs delete mode 100644 src/test/compile-fail/tstate-break-uninit-2.rs delete mode 100644 src/test/compile-fail/tstate-break-uninit.rs delete mode 100644 src/test/compile-fail/tstate-ctor-unsat.rs delete mode 100644 src/test/compile-fail/tstate-fru.rs delete mode 100644 src/test/compile-fail/tstate-if-no-else.rs delete mode 100644 src/test/compile-fail/tstate-if-with-else.rs delete mode 100644 src/test/compile-fail/tstate-loop-constraints.rs delete mode 100644 src/test/compile-fail/tstate-or-init.rs delete mode 100644 src/test/compile-fail/tstate-return.rs delete mode 100644 src/test/compile-fail/tstate-unsat-after-item.rs delete mode 100644 src/test/compile-fail/tstate-unsat-in-called-fn-expr.rs delete mode 100644 src/test/compile-fail/tstate-unsat-in-fn-expr.rs delete mode 100644 src/test/compile-fail/tstate-unsat.rs delete mode 100644 src/test/compile-fail/tstate-while-break.rs delete mode 100644 src/test/compile-fail/tstate-while-cond.rs delete mode 100644 src/test/compile-fail/tstate-while-loop-unsat-constriants.rs delete mode 100644 src/test/compile-fail/tstate-while.rs delete mode 100644 src/test/run-fail/fn-constraint-claim.rs delete mode 100644 src/test/run-fail/fn-constraint.rs delete mode 100644 src/test/run-fail/if-check-fail.rs delete mode 100644 src/test/run-fail/pred.rs delete mode 100644 src/test/run-fail/unwind-check.rs delete mode 100644 src/test/run-fail/zip-different-lengths.rs delete mode 100644 src/test/run-pass/bug-862.rs delete mode 100644 src/test/run-pass/check-pattern-bound.rs delete mode 100644 src/test/run-pass/claim-nonterm.rs delete mode 100644 src/test/run-pass/constrained-type.rs delete mode 100644 src/test/run-pass/constraint-prop-expr-move.rs delete mode 100644 src/test/run-pass/constraint-prop-move.rs delete mode 100644 src/test/run-pass/constraint-prop-swap.rs delete mode 100644 src/test/run-pass/constraint-prop.rs delete mode 100644 src/test/run-pass/fn-constraint.rs delete mode 100644 src/test/run-pass/if-check-precond.rs delete mode 100644 src/test/run-pass/if-check.rs delete mode 100644 src/test/run-pass/issue-933.rs delete mode 100644 src/test/run-pass/issue-970.rs delete mode 100644 src/test/run-pass/pred-check.rs delete mode 100644 src/test/run-pass/pred.rs delete mode 100644 src/test/run-pass/typestate-transitive.rs delete mode 100644 src/test/run-pass/unchecked-predicates.rs delete mode 100644 src/test/run-pass/zip-same-length.rs diff --git a/doc/rust.md b/doc/rust.md index 13b46367a966d..121c01154d4b0 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -211,7 +211,7 @@ The keywords in [source files](#source-files) are the following strings: ~~~~~~~~ {.keyword} alt assert be break -check claim class const cont copy crust +check class const cont copy crust drop else enum export fail false fn for @@ -914,19 +914,11 @@ express that `f` requires no explicit `ret`, as if it returns control to the caller, it returns a value (true because it never returns control). -#### Predicate functions +#### Pure functions -Any pure boolean function is called a *predicate function*, and may be used in -a [constraint](#constraints), as part of the static [typestate -system](#typestate-system). A predicate declaration is identical to a function -declaration, except that it is declared with the additional keyword `pure`. In -addition, the typechecker checks the body of a predicate with a restricted set -of typechecking rules. A predicate +*TODO:* need to rewrite this to reflect reality -* may not contain an assignment or self-call expression; and -* may only call other predicates, not general functions. - -An example of a predicate: +An example of a pure function: ~~~~ pure fn lt_42(x: int) -> bool { @@ -943,10 +935,6 @@ pure fn pure_length(ls: list) -> uint { /* ... */ } pure fn nonempty_list(ls: list) -> bool { pure_length(ls) > 0u } ~~~~ -In this example, `nonempty_list` is a predicate---it can be used in a -typestate constraint---but the auxiliary function `pure_length` is -not. - *TODO:* should actually define referential transparency. The effect checking rules previously enumerated are a restricted set of @@ -1929,10 +1917,6 @@ an optional reference slot to serve as the function's output, bound to the `lval` on the right hand side of the call. If the function eventually returns, then the expression completes. -A call expression statically requires that the precondition declared in the -callee's signature is satisfied by the expression prestate. In this way, -typestates propagate through function boundaries. - An example of a call expression: ~~~~ @@ -2026,7 +2010,8 @@ loop_expr : "loop" '{' block '}'; For a block `b`, the expression `loop b` is semantically equivalent to `while true b`. However, `loop`s differ from `while` loops in that the -typestate analysis pass takes into account that `loop`s are infinite. +the compiler knows that `loop`s are infinite loops, and thus will +not warn about any unreachable code that follows. For example, the following (contrived) function uses a `loop` with a `ret` expression: @@ -2041,7 +2026,7 @@ fn count() -> bool { } ~~~~ -This function compiles, because typestate recognizes that the `loop` +This function compiles, because rustc recognizes that the `loop` never terminates (except non-locally, with `ret`), thus there is no need to insert a spurious `fail` or `ret` after the `loop`. If `loop` were replaced with `while true`, the function would be rejected @@ -2399,128 +2384,17 @@ library. It is best to use the macro forms of logging (*#error*, *#debug*, etc.) to minimize disruption to code using the logging facility when it is changed. - -### Check expressions - -~~~~~~~~{.ebnf .gram} -check_expr : "check" call_expr ; -~~~~~~~~ - -A `check` expression connects dynamic assertions made at run-time to the -static [typestate system](#typestate-system). A `check` expression takes a -constraint to check at run-time. If the constraint holds at run-time, control -passes through the `check` and on to the next expression in the enclosing -block. If the condition fails to hold at run-time, the `check` expression -behaves as a `fail` expression. - -The typestate algorithm is built around `check` expressions, and in particular -the fact that control *will not pass* a check expression with a condition that -fails to hold. The typestate algorithm can therefore assume that the (static) -postcondition of a `check` expression includes the checked constraint -itself. From there, the typestate algorithm can perform dataflow calculations -on subsequent expressions, propagating [conditions](#conditions) forward and -statically comparing implied states and their specifications. - -~~~~~~~~ -# fn print(i: int) { } - -pure fn even(x: int) -> bool { - ret x & 1 == 0; -} - -fn print_even(x: int) : even(x) { - print(x); -} - -fn test() { - let y: int = 8; - - // Cannot call print_even(y) here. - - check even(y); - - // Can call print_even(y) here, since even(y) now holds. - print_even(y); -} -~~~~~~~~ - -### Prove expressions - -**Note: Prove expressions are not yet supported by the compiler.** - -~~~~~~~~{.ebnf .gram} -prove_expr : "prove" call_expr ; -~~~~~~~~ - -A `prove` expression has no run-time effect. Its purpose is to statically -check (and document) that its argument constraint holds at its expression -entry point. If its argument typestate does not hold, under the typestate -algorithm, the program containing it will fail to compile. - -### Claim expressions - -~~~~~~~~{.ebnf .gram} -claim_expr : "claim" call_expr ; -~~~~~~~~ - -A `claim` expression is an unsafe variant on a `check` expression that is not -actually checked at runtime. Thus, using a `claim` implies a proof obligation -to ensure---without compiler assistance---that an assertion always holds. - -Setting a runtime flag can turn all `claim` expressions into `check` -expressions in a compiled Rust program, but the default is to not check the -assertion contained in a `claim`. The idea behind `claim` is that performance -profiling might identify a few bottlenecks in the code where actually checking -a given callee's predicate is too expensive; `claim` allows the code to -typecheck without removing the predicate check at every other call site. - - - -### If-Check expressions - -An `if check` expression combines a `if` expression and a `check` -expression in an indivisible unit that can be used to build more complex -conditional control-flow than the `check` expression affords. - -In fact, `if check` is a "more primitive" expression than `check`; -instances of the latter can be rewritten as instances of the former. The -following two examples are equivalent: - -Example using `check`: - -~~~~ -# pure fn even(x: int) -> bool { true } -# fn print_even(x: int) { } -# let x = 0; - -check even(x); -print_even(x); -~~~~ - -Equivalent example using `if check`: - -~~~~ -# pure fn even(x: int) -> bool { true } -# fn print_even(x: int) { } -# let x = 0; - -if check even(x) { - print_even(x); -} else { - fail; -} -~~~~ - ### Assert expressions ~~~~~~~~{.ebnf .gram} assert_expr : "assert" expr ; ~~~~~~~~ -An `assert` expression is similar to a `check` expression, except -the condition may be any boolean-typed expression, and the compiler makes no -use of the knowledge that the condition holds if the program continues to -execute after the `assert`. +An `assert` expression checks that a boolean condition holds, and +fails the task otherwise. The condition may be any boolean-typed +expression, and the compiler makes no use of the knowledge that the +condition holds if the program continues to execute after the +`assert`. ### Syntax extension expressions @@ -2601,13 +2475,10 @@ macro-generated and user-written code can cause unintentional capture. Future versions of Rust will address these issues. -# Types and typestates - -## Types +# Types Every slot and value in a Rust program has a type. The _type_ of a *value* -defines the interpretation of the memory holding it. The type of a *slot* may -also include [constraints](#constraints). +defines the interpretation of the memory holding it. Built-in types and type-constructors are tightly integrated into the language, in nontrivial ways that are not possible to emulate in user-defined @@ -2860,219 +2731,6 @@ implemented in the library. Generic functions that send values bound the kind of these values to sendable. - -## Typestate system - - -Rust programs have a static semantics that determine the types of values -produced by each expression, as well as the *predicates* that hold over -slots in the environment at each point in time during execution. - -The latter semantics -- the dataflow analysis of predicates holding over slots --- is called the *typestate* system. - -### Points - -Control flows from statement to statement in a block, and through the -evaluation of each expression, from one sub-expression to another. This -sequential control flow is specified as a set of _points_, each of which -has a set of points before and after it in the implied control flow. - -For example, this code: - -~~~~~~~~ -# let mut s; - -s = "hello, world"; -io::println(s); -~~~~~~~~ - -Consists of 2 statements, 3 expressions and 12 points: - - -* the point before the first statement -* the point before evaluating the static initializer `"hello, world"` -* the point after evaluating the static initializer `"hello, world"` -* the point after the first statement -* the point before the second statement -* the point before evaluating the function value `print` -* the point after evaluating the function value `print` -* the point before evaluating the arguments to `print` -* the point before evaluating the symbol `s` -* the point after evaluating the symbol `s` -* the point after evaluating the arguments to `print` -* the point after the second statement - - -Whereas this code: - - -~~~~~~~~ -# fn x() -> str { "" } -# fn y() -> str { "" } - -io::println(x() + y()); -~~~~~~~~ - -Consists of 1 statement, 7 expressions and 14 points: - - -* the point before the statement -* the point before evaluating the function value `print` -* the point after evaluating the function value `print` -* the point before evaluating the arguments to `print` -* the point before evaluating the arguments to `+` -* the point before evaluating the function value `x` -* the point after evaluating the function value `x` -* the point before evaluating the arguments to `x` -* the point after evaluating the arguments to `x` -* the point before evaluating the function value `y` -* the point after evaluating the function value `y` -* the point before evaluating the arguments to `y` -* the point after evaluating the arguments to `y` -* the point after evaluating the arguments to `+` -* the point after evaluating the arguments to `print` - - -The typestate system reasons over points, rather than statements or -expressions. This may seem counter-intuitive, but points are the more -primitive concept. Another way of thinking about a point is as a set of -*instants in time* at which the state of a task is fixed. By contrast, a -statement or expression represents a *duration in time*, during which the -state of the task changes. The typestate system is concerned with constraining -the possible states of a task's memory at *instants*; it is meaningless to -speak of the state of a task's memory "at" a statement or expression, as each -statement or expression is likely to change the contents of memory. - - -### Control flow graph - -Each *point* can be considered a vertex in a directed *graph*. Each -kind of expression or statement implies a number of points *and edges* in -this graph. The edges connect the points within each statement or expression, -as well as between those points and those of nearby statements and expressions -in the program. The edges between points represent *possible* indivisible -control transfers that might occur during execution. - -This implicit graph is called the _control-flow graph_, or _CFG_. - - -### Constraints - -A [_predicate_](#predicate-functions) is a pure boolean function declared with -the keywords `pure fn`. - -A _constraint_ is a predicate applied to specific slots. - -For example, consider the following code: - -~~~~~~~~ -pure fn is_less_than(a: int, b: int) -> bool { - ret a < b; -} - -fn test() { - let x: int = 10; - let y: int = 20; - check is_less_than(x,y); -} -~~~~~~~~ - -This example defines the predicate `is_less_than`, and applies it to the slots -`x` and `y`. The constraint being checked on the third line of the function is -`is_less_than(x,y)`. - -Predicates can only apply to slots holding immutable values. The slots a -predicate applies to can themselves be mutable, but the types of values held -in those slots must be immutable. - -### Conditions - -A _condition_ is a set of zero or more constraints. - -Each *point* has an associated *condition*: - -* The _precondition_ of a statement or expression is the condition required at -in the point before it. -* The _postcondition_ of a statement or expression is the condition enforced -in the point after it. - -Any constraint present in the precondition and *absent* in the postcondition -is considered to be *dropped* by the statement or expression. - - -### Calculated typestates - -The typestate checking system *calculates* an additional condition for each -point called its _typestate_. For a given statement or expression, we call the -two typestates associated with its two points the prestate and a poststate. - -* The _prestate_ of a statement or expression is the typestate of the -point before it. -* The _poststate_ of a statement or expression is the typestate of the -point after it. - -A _typestate_ is a condition that has _been determined by the typestate -algorithm_ to hold at a point. This is a subtle but important point to -understand: preconditions and postconditions are *inputs* to the typestate -algorithm; prestates and poststates are *outputs* from the typestate -algorithm. - -The typestate algorithm analyses the preconditions and postconditions of every -statement and expression in a block, and computes a condition for each -typestate. Specifically: - - -* Initially, every typestate is empty. -* Each statement or expression's poststate is given the union of the its -prestate, precondition, and postcondition. -* Each statement or expression's poststate has the difference between its -precondition and postcondition removed. -* Each statement or expression's prestate is given the intersection of the -poststates of every predecessor point in the CFG. -* The previous three steps are repeated until no typestates in the -block change. - -The typestate algorithm is a very conventional dataflow calculation, and can -be performed using bit-set operations, with one bit per predicate and one -bit-set per condition. - -After the typestates of a block are computed, the typestate algorithm checks -that every constraint in the precondition of a statement is satisfied by its -prestate. If any preconditions are not satisfied, the mismatch is considered a -static (compile-time) error. - - -### Typestate checks - -The key mechanism that connects run-time semantics and compile-time analysis -of typestates is the use of [`check` expressions](#check-expressions). A -`check` expression guarantees that *if* control were to proceed past it, the -predicate associated with the `check` would have succeeded, so the constraint -being checked *statically* holds in subsequent points.^[A `check` expression -is similar to an `assert` call in a C program, with the significant difference -that the Rust compiler *tracks* the constraint that each `check` expression -enforces. Naturally, `check` expressions cannot be omitted from a "production -build" of a Rust program the same way `asserts` are frequently disabled in -deployed C programs.} - -It is important to understand that the typestate system has *no insight* into -the meaning of a particular predicate. Predicates and constraints are not -evaluated in any way at compile time. Predicates are treated as specific (but -unknown) functions applied to specific (also unknown) slots. All the typestate -system does is track which of those predicates -- whatever they calculate -- -*must have been checked already* in order for program control to reach a -particular point in the CFG. The fundamental building block, therefore, is the -`check` statement, which tells the typestate system "if control passes this -point, the checked predicate holds". - -From this building block, constraints can be propagated to function signatures -and constrained types, and the responsibility to `check` a constraint -pushed further and further away from the site at which the program requires it -to hold in order to execute properly. - - - # Memory and concurrency models Rust has a memory model centered around concurrently-executing _tasks_. Thus @@ -3164,7 +2822,7 @@ Local variables are not initialized when allocated; the entire frame worth of local variables are allocated at once, on frame-entry, in an uninitialized state. Subsequent statements within a function may or may not initialize the local variables. Local variables can be used only after they have been -initialized; this condition is guaranteed by the typestate system. +initialized; this condition is guaranteed statically. References are created for function arguments. If the compiler can not prove that the referred-to value will outlive the reference, it will try to set diff --git a/src/cargo/cargo.rs b/src/cargo/cargo.rs index 5ddd11d278685..2897aecd705d6 100644 --- a/src/cargo/cargo.rs +++ b/src/cargo/cargo.rs @@ -766,7 +766,6 @@ fn rustc_sysroot() -> str { alt os::self_exe_path() { some(path) { let path = [path, "..", "bin", "rustc"]; - check vec::is_not_empty(path); let rustc = path::normalize(path::connect_many(path)); #debug(" rustc: %s", rustc); rustc diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 079fba0ba652d..b69d5b262347c 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -38,7 +38,6 @@ fn parse_config(args: [str]) -> config { getopts::optflag("verbose"), getopts::optopt("logfile")]; - check (vec::is_not_empty(args)); let args_ = vec::tail(args); let match = alt getopts::getopts(args_, opts) { diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 3ccf8fdf34111..5ed27c54e1b01 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -121,7 +121,6 @@ fn run_pretty_test(config: config, props: test_props, testfile: str) { if option::is_some(props.pp_exact) { // Now we have to care about line endings let cr = "\r"; - check (str::is_not_empty(cr)); actual = str::replace(actual, cr, ""); expected = str::replace(expected, cr, ""); } diff --git a/src/fuzzer/fuzzer.rs b/src/fuzzer/fuzzer.rs index efef3233685a5..eccc34f4db0af 100644 --- a/src/fuzzer/fuzzer.rs +++ b/src/fuzzer/fuzzer.rs @@ -69,7 +69,6 @@ pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool { // position, the pretty-printer can't preserve this even by // parenthesizing!! See email to marijn. ast::expr_if(_, _, _) { false } - ast::expr_if_check(_, _, _) { false } ast::expr_block(_) { false } ast::expr_alt(_, _, _) { false } ast::expr_while(_, _) { false } @@ -89,7 +88,6 @@ pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool { // https://github.com/mozilla/rust/issues/927 //ast::expr_assert(_) { false } - ast::expr_check(_, _) { false } // https://github.com/mozilla/rust/issues/928 //ast::expr_cast(_, _) { false } @@ -107,7 +105,6 @@ pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool { fn safe_to_steal_ty(t: @ast::ty, tm: test_mode) -> bool { alt t.node { // https://github.com/mozilla/rust/issues/971 - ast::ty_constr(_, _) { false } // Other restrictions happen to be the same. _ { safe_to_replace_ty(t.node, tm) } diff --git a/src/libcore/path.rs b/src/libcore/path.rs index 2e62b73063d9d..0790cbaaae1b7 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -213,7 +213,7 @@ fn normalize(p: path) -> path { let s = strip_dots(s); let s = rollup_doubledots(s); - let s = if check vec::is_not_empty(s) { + let s = if vec::is_not_empty(s) { connect_many(s) } else { "" diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 3c6622ba69dd9..a155884b40d78 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -279,7 +279,9 @@ library, a precondition is used here because result::t is generally used in 'careful' code contexts where it is both appropriate and easy to accommodate an error like the vectors being of different lengths."] fn map_vec2(ss: [S], ts: [T], op: fn(S,T) -> result) - : vec::same_length(ss, ts) -> result<[V],U> { + -> result<[V],U> { + + assert vec::same_length(ss, ts); let n = vec::len(ts); let mut vs = []; @@ -302,9 +304,10 @@ on its own as no result vector is built. "] fn iter_vec2(ss: [S], ts: [T], op: fn(S,T) -> result<(),U>) - : vec::same_length(ss, ts) -> result<(),U> { + assert vec::same_length(ss, ts); + let n = vec::len(ts); let mut i = 0u; while i < n { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 5381a9f345d23..4522b74d88088 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -282,9 +282,6 @@ type field = spanned; #[auto_serialize] enum blk_check_mode { default_blk, unchecked_blk, unsafe_blk, } -#[auto_serialize] -enum expr_check_mode { claimed_expr, checked_expr, } - #[auto_serialize] type expr = {id: node_id, node: expr_, span: span}; @@ -317,12 +314,6 @@ enum expr_ { // the outside). expr_loop_body(@expr), expr_block(blk), - - /* - * FIXME: many of these @exprs should be constrained with - * is_lval once we have constrained types working. - * (See #34) - */ expr_copy(@expr), expr_move(@expr, @expr), expr_assign(@expr, @expr), @@ -345,9 +336,6 @@ enum expr_ { /* just an assert, no significance to typestate */ expr_assert(@expr), - /* preds that typestate is aware of */ - expr_check(expr_check_mode, @expr), - expr_if_check(@expr, blk, option<@expr>), expr_mac(mac), } @@ -464,7 +452,6 @@ enum ty_ { ty_fn(proto, fn_decl), ty_tup([@ty]), ty_path(@path, node_id), - ty_constr(@ty, [@ty_constr]), ty_vstore(@ty, vstore), ty_mac(mac), // ty_infer means the type should be inferred instead of it having been @@ -473,56 +460,6 @@ enum ty_ { ty_infer, } - -/* -A constraint arg that's a function argument is referred to by its position -rather than name. This is so we could have higher-order functions that have -constraints (potentially -- right now there's no way to write that), and also -so that the typestate pass doesn't have to map a function name onto its decl. -So, the constr_arg type is parameterized: it's instantiated with uint for -declarations, and ident for uses. -*/ -#[auto_serialize] -enum constr_arg_general_ { carg_base, carg_ident(T), carg_lit(@lit), } - -#[auto_serialize] -type fn_constr_arg = constr_arg_general_; - -#[auto_serialize] -type sp_constr_arg = spanned>; - -#[auto_serialize] -type ty_constr_arg = sp_constr_arg<@path>; - -#[auto_serialize] -type constr_arg = spanned; - -// Constrained types' args are parameterized by paths, since -// we refer to paths directly and not by indices. -// The implicit root of such path, in the constraint-list for a -// constrained type, is * (referring to the base record) - -#[auto_serialize] -type constr_general_ = - {path: @path, args: [@sp_constr_arg], id: ID}; - -// In the front end, constraints have a node ID attached. -// Typeck turns this to a def_id, using the output of resolve. -#[auto_serialize] -type constr_general = spanned>; - -#[auto_serialize] -type constr_ = constr_general_; - -#[auto_serialize] -type constr = spanned>; - -#[auto_serialize] -type ty_constr_ = constr_general_<@path, node_id>; - -#[auto_serialize] -type ty_constr = spanned; - /* The parser generates ast::constrs; resolve generates a mapping from each function to a list of ty::constr_defs, corresponding to these. */ @@ -534,8 +471,7 @@ type fn_decl = {inputs: [arg], output: @ty, purity: purity, - cf: ret_style, - constraints: [@constr]}; + cf: ret_style}; #[auto_serialize] enum purity { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index d4efdb4bb0d01..9a5e8c28f5452 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -384,7 +384,7 @@ fn dtor_dec() -> fn_decl { // dtor has one argument, of type () {inputs: [{mode: ast::expl(ast::by_ref), ty: nil_t, ident: @"_", id: 0}], - output: nil_t, purity: impure_fn, cf: return_val, constraints: []} + output: nil_t, purity: impure_fn, cf: return_val} } // ______________________________________________________________________ diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs index 888ff7d4ef294..ad5bd5f43ff8d 100644 --- a/src/libsyntax/ext/auto_serialize.rs +++ b/src/libsyntax/ext/auto_serialize.rs @@ -158,8 +158,7 @@ impl helpers for ext_ctxt { node: ast::ty_fn(ast::proto_any, {inputs: args, output: output, purity: ast::impure_fn, - cf: ast::return_val, - constraints: []}), + cf: ast::return_val}), span: span} } @@ -438,10 +437,6 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map, } } - ast::ty_constr(ty, _) { - ser_ty(cx, tps, ty, s, v) - } - ast::ty_mac(_) { cx.span_err(ty.span, "cannot serialize macro types"); [] @@ -543,8 +538,7 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident, tps: [ast::ty_param], node: ast::item_fn({inputs: ser_inputs, output: ser_output, purity: ast::impure_fn, - cf: ast::return_val, - constraints: []}, + cf: ast::return_val}, ser_tps, ser_blk), vis: ast::public, @@ -661,10 +655,6 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map, } } - ast::ty_constr(ty, constrs) { - deser_ty(cx, tps, ty, d) - } - ast::ty_mac(_) { #ast{ fail } } @@ -744,8 +734,7 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, node: ast::item_fn({inputs: deser_inputs, output: v_ty, purity: ast::impure_fn, - cf: ast::return_val, - constraints: []}, + cf: ast::return_val}, deser_tps, deser_blk), vis: ast::public, diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 04a3c95ce1c0e..cc215b486faee 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -33,8 +33,6 @@ iface ast_fold { fn fold_decl(&&@decl) -> @decl; fn fold_expr(&&@expr) -> @expr; fn fold_ty(&&@ty) -> @ty; - fn fold_constr(&&@constr) -> @constr; - fn fold_ty_constr(&&@ty_constr) -> @ty_constr; fn fold_mod(_mod) -> _mod; fn fold_native_mod(native_mod) -> native_mod; fn fold_variant(variant) -> variant; @@ -66,9 +64,6 @@ type ast_fold_precursor = @{ fold_decl: fn@(decl_, span, ast_fold) -> (decl_, span), fold_expr: fn@(expr_, span, ast_fold) -> (expr_, span), fold_ty: fn@(ty_, span, ast_fold) -> (ty_, span), - fold_constr: fn@(ast::constr_, span, ast_fold) -> (constr_, span), - fold_ty_constr: fn@(ast::ty_constr_, span, ast_fold) - -> (ty_constr_, span), fold_mod: fn@(_mod, ast_fold) -> _mod, fold_native_mod: fn@(native_mod, ast_fold) -> native_mod, fold_variant: fn@(variant_, span, ast_fold) -> (variant_, span), @@ -132,8 +127,7 @@ fn fold_fn_decl(decl: ast::fn_decl, fld: ast_fold) -> ast::fn_decl { ret {inputs: vec::map(decl.inputs, bind fold_arg_(_, fld)), output: fld.fold_ty(decl.output), purity: decl.purity, - cf: decl.cf, - constraints: vec::map(decl.constraints, fld.fold_constr)} + cf: decl.cf} } fn fold_ty_param_bound(tpb: ty_param_bound, fld: ast_fold) -> ty_param_bound { @@ -196,10 +190,7 @@ fn noop_fold_native_item(&&ni: @native_item, fld: ast_fold) -> @native_item { native_item_fn({inputs: vec::map(fdec.inputs, fold_arg), output: fld.fold_ty(fdec.output), purity: fdec.purity, - cf: fdec.cf, - constraints: - vec::map(fdec.constraints, - fld.fold_constr)}, + cf: fdec.cf}, fold_ty_params(typms, fld)) } }, @@ -471,11 +462,6 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr_log(i, lv, e) { expr_log(i, fld.fold_expr(lv), fld.fold_expr(e)) } expr_assert(e) { expr_assert(fld.fold_expr(e)) } - expr_check(m, e) { expr_check(m, fld.fold_expr(e)) } - expr_if_check(cond, tr, fl) { - expr_if_check(fld.fold_expr(cond), fld.fold_block(tr), - option::map(fl, fld.fold_expr)) - } expr_mac(mac) { expr_mac(fold_mac(mac)) } } } @@ -501,24 +487,11 @@ fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ { ty_fn(proto, decl) {ty_fn(proto, fold_fn_decl(decl, fld))} ty_tup(tys) {ty_tup(vec::map(tys) {|ty| fld.fold_ty(ty)})} ty_path(path, id) {ty_path(fld.fold_path(path), fld.new_id(id))} - ty_constr(ty, constrs) {ty_constr(fld.fold_ty(ty), - vec::map(constrs, fld.fold_ty_constr))} ty_vstore(t, vs) {ty_vstore(fld.fold_ty(t), vs)} ty_mac(mac) {ty_mac(fold_mac(mac))} } } -fn noop_fold_constr(c: constr_, fld: ast_fold) -> constr_ { - {path: fld.fold_path(c.path), args: /* FIXME: bad */ copy c.args, - id: fld.new_id(c.id)} -} - -fn noop_fold_ty_constr(c: ty_constr_, fld: ast_fold) -> ty_constr_ { - let rslt: ty_constr_ = - {path: fld.fold_path(c.path), args: /* FIXME: bad */ copy c.args, - id: fld.new_id(c.id)}; - rslt -} // ...nor do modules fn noop_fold_mod(m: _mod, fld: ast_fold) -> _mod { ret {view_items: vec::map(m.view_items, fld.fold_view_item), @@ -603,8 +576,6 @@ fn default_ast_fold() -> ast_fold_precursor { fold_decl: wrap(noop_fold_decl), fold_expr: wrap(noop_fold_expr), fold_ty: wrap(noop_fold_ty), - fold_constr: wrap(noop_fold_constr), - fold_ty_constr: wrap(noop_fold_ty_constr), fold_mod: noop_fold_mod, fold_native_mod: noop_fold_native_mod, fold_variant: wrap(noop_fold_variant), @@ -693,17 +664,6 @@ impl of ast_fold for ast_fold_precursor { let (n, s) = self.fold_ty(x.node, x.span, self as ast_fold); ret @{id: self.new_id(x.id), node: n, span: self.new_span(s)}; } - fn fold_constr(&&x: @ast::constr) -> - @ast::constr { - let (n, s) = self.fold_constr(x.node, x.span, self as ast_fold); - ret @{node: n, span: self.new_span(s)}; - } - fn fold_ty_constr(&&x: @ast::ty_constr) -> - @ast::ty_constr { - let (n, s) : (ty_constr_, span) = - self.fold_ty_constr(x.node, x.span, self as ast_fold); - ret @{node: n, span: self.new_span(s)}; - } fn fold_mod(x: _mod) -> _mod { ret self.fold_mod(x, self as ast_fold); } diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index aff0334a946bb..d4bd078ac8527 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -5,7 +5,7 @@ import ast_util::*; fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool { alt e.node { - ast::expr_if(_, _, _) | ast::expr_if_check(_, _, _) + ast::expr_if(_, _, _) | ast::expr_alt(_, _, _) | ast::expr_block(_) | ast::expr_while(_, _) | ast::expr_loop(_) | ast::expr_call(_, _, true) { @@ -43,7 +43,6 @@ fn need_parens(expr: @ast::expr, outer_prec: uint) -> bool { ast::expr_assign_op(_, _, _) { true } ast::expr_ret(_) { true } ast::expr_assert(_) { true } - ast::expr_check(_, _) { true } ast::expr_log(_, _, _) { true } _ { !parse::classify::expr_requires_semi_to_be_stmt(expr) } } @@ -63,8 +62,9 @@ fn ends_in_lit_int(ex: @ast::expr) -> bool { ast::expr_move(_, sub) | ast::expr_copy(sub) | ast::expr_assign(_, sub) | ast::expr_assign_op(_, _, sub) | ast::expr_swap(_, sub) | - ast::expr_log(_, _, sub) | ast::expr_assert(sub) | - ast::expr_check(_, sub) { ends_in_lit_int(sub) } + ast::expr_log(_, _, sub) | ast::expr_assert(sub) { + ends_in_lit_int(sub) + } ast::expr_fail(osub) | ast::expr_ret(osub) { alt osub { some(ex) { ends_in_lit_int(ex) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index e0029b2a222f5..dc00fb749a24c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -183,15 +183,9 @@ class parser { {mode: mode, ty: p.parse_ty(false), ident: name, id: p.get_id()} }; - // FIXME: constrs is empty because right now, higher-order functions - // can't have constrained types. - // Not sure whether that would be desirable anyway. See #34 for the - // story on constrained types. - let constrs: [@constr] = []; let (ret_style, ret_ty) = self.parse_ret_ty(); ret {inputs: inputs, output: ret_ty, - purity: purity, cf: ret_style, - constraints: constrs}; + purity: purity, cf: ret_style}; } fn parse_ty_methods() -> [ty_method] { @@ -232,71 +226,6 @@ class parser { self.fatal("unbound variable `" + *i + "` in constraint arg"); } - fn parse_type_constr_arg() -> @ty_constr_arg { - let sp = self.span; - let mut carg = carg_base; - self.expect(token::BINOP(token::STAR)); - if self.token == token::DOT { - // "*..." notation for record fields - self.bump(); - let pth = self.parse_path_without_tps(); - carg = carg_ident(pth); - } - // No literals yet, I guess? - ret @{node: carg, span: sp}; - } - - fn parse_constr_arg(args: [arg]) -> @constr_arg { - let sp = self.span; - let mut carg = carg_base; - if self.token == token::BINOP(token::STAR) { - self.bump(); - } else { - let i: ident = self.parse_value_ident(); - carg = carg_ident(self.ident_index(args, i)); - } - ret @{node: carg, span: sp}; - } - - fn parse_ty_constr(fn_args: [arg]) -> @constr { - let lo = self.span.lo; - let path = self.parse_path_without_tps(); - let args = self.parse_unspanned_seq( - token::LPAREN, token::RPAREN, - seq_sep_trailing_disallowed(token::COMMA), - {|p| p.parse_constr_arg(fn_args)}); - ret @spanned(lo, self.span.hi, - {path: path, args: args, id: self.get_id()}); - } - - fn parse_constr_in_type() -> @ty_constr { - let lo = self.span.lo; - let path = self.parse_path_without_tps(); - let args: [@ty_constr_arg] = self.parse_unspanned_seq( - token::LPAREN, token::RPAREN, - seq_sep_trailing_disallowed(token::COMMA), - {|p| p.parse_type_constr_arg()}); - let hi = self.span.lo; - let tc: ty_constr_ = {path: path, args: args, id: self.get_id()}; - ret @spanned(lo, hi, tc); - } - - - fn parse_constrs(pser: fn(parser) -> @constr_general) -> - [@constr_general] { - let mut constrs: [@constr_general] = []; - loop { - let constr = pser(self); - constrs += [constr]; - if self.token == token::COMMA { self.bump(); } - else { ret constrs; } - }; - } - - fn parse_type_constraints() -> [@ty_constr] { - ret self.parse_constrs({|p| p.parse_constr_in_type()}); - } - fn parse_ret_ty() -> (ret_style, @ty) { ret if self.eat(token::RARROW) { let lo = self.span.lo; @@ -397,16 +326,7 @@ class parser { if vec::len(elems) == 0u { self.unexpected_last(token::RBRACE); } - let hi = self.span.hi; - - let t = ty_rec(elems); - if self.token == token::COLON { - self.bump(); - ty_constr(@{id: self.get_id(), - node: t, - span: mk_sp(lo, hi)}, - self.parse_type_constraints()) - } else { t } + ty_rec(elems) } else if self.token == token::LBRACKET { self.expect(token::LBRACKET); let t = ty_vec(self.parse_mt()); @@ -859,21 +779,6 @@ class parser { let e = self.parse_expr(); ex = expr_assert(e); hi = e.span.hi; - } else if self.eat_keyword("check") { - /* Should be a predicate (pure boolean function) applied to - arguments that are all either slot variables or literals. - but the typechecker enforces that. */ - let e = self.parse_expr(); - hi = e.span.hi; - ex = expr_check(checked_expr, e); - } else if self.eat_keyword("claim") { - /* Same rules as check, except that if check-claims - is enabled (a command-line flag), then the parser turns - claims into check */ - - let e = self.parse_expr(); - hi = e.span.hi; - ex = expr_check(claimed_expr, e); } else if self.eat_keyword("ret") { if can_begin_expr(self.token) { let e = self.parse_expr(); @@ -1218,14 +1123,8 @@ class parser { } fn parse_if_expr() -> @expr { - if self.eat_keyword("check") { - let q = self.parse_if_expr_1(); - ret self.mk_expr(q.lo, q.hi, - expr_if_check(q.cond, q.then, q.els)); - } else { - let q = self.parse_if_expr_1(); - ret self.mk_expr(q.lo, q.hi, expr_if(q.cond, q.then, q.els)); - } + let q = self.parse_if_expr_1(); + ret self.mk_expr(q.lo, q.hi, expr_if(q.cond, q.then, q.els)); } fn parse_fn_expr(proto: proto) -> @expr { @@ -1792,20 +1691,11 @@ class parser { let inputs = either::lefts(args_or_capture_items); let capture_clause = @either::rights(args_or_capture_items); - // Use the args list to translate each bound variable - // mentioned in a constraint to an arg index. - // Seems weird to do this in the parser, but I'm not sure how else to. - let mut constrs = []; - if self.token == token::COLON { - self.bump(); - constrs = self.parse_constrs({|p| p.parse_ty_constr(inputs) }); - } let (ret_style, ret_ty) = self.parse_ret_ty(); ret ({inputs: inputs, output: ret_ty, purity: purity, - cf: ret_style, - constraints: constrs}, capture_clause); + cf: ret_style}, capture_clause); } fn parse_fn_block_decl() -> (fn_decl, capture_clause) { @@ -1827,8 +1717,7 @@ class parser { ret ({inputs: either::lefts(inputs_captures), output: output, purity: impure_fn, - cf: return_val, - constraints: []}, + cf: return_val}, @either::rights(inputs_captures)); } @@ -1951,8 +1840,7 @@ class parser { output: @{id: self.get_id(), node: ty_nil, span: ast_util::dummy_sp()}, purity: impure_fn, - cf: return_val, - constraints: [] + cf: return_val }; (ident, item_res(decl, ty_params, dtor, self.get_id(), self.get_id(), rp), none) diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index a63e3139b5bbe..768bea35e1fb0 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -400,11 +400,6 @@ fn print_type_ex(s: ps, &&ty: @ast::ty, print_colons: bool) { print_ty_fn(s, some(proto), d, none, none); } ast::ty_path(path, _) { print_path(s, path, print_colons); } - ast::ty_constr(t, cs) { - print_type(s, t); - space(s.s); - word(s.s, constrs_str(cs, ty_constr_to_str)); - } ast::ty_vstore(t, v) { print_type(s, t); print_vstore(s, v); @@ -792,9 +787,8 @@ fn print_maybe_parens_discrim(s: ps, e: @ast::expr) { } fn print_if(s: ps, test: @ast::expr, blk: ast::blk, - elseopt: option<@ast::expr>, chk: bool) { + elseopt: option<@ast::expr>) { head(s, "if"); - if chk { word_nbsp(s, "check"); } print_maybe_parens_discrim(s, test); space(s.s); print_block(s, blk); @@ -980,10 +974,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) { print_type_ex(s, ty, true); } ast::expr_if(test, blk, elseopt) { - print_if(s, test, blk, elseopt, false); - } - ast::expr_if_check(test, blk, elseopt) { - print_if(s, test, blk, elseopt, true); + print_if(s, test, blk, elseopt); } ast::expr_while(test, blk) { head(s, "while"); @@ -1134,15 +1125,6 @@ fn print_expr(s: ps, &&expr: @ast::expr) { } } } - ast::expr_check(m, expr) { - alt m { - ast::claimed_expr { word_nbsp(s, "claim"); } - ast::checked_expr { word_nbsp(s, "check"); } - } - popen(s); - print_expr(s, expr); - pclose(s); - } ast::expr_assert(expr) { word_nbsp(s, "assert"); print_expr(s, expr); @@ -1168,8 +1150,7 @@ fn print_expr_parens_if_not_bot(s: ps, ex: @ast::expr) { ast::expr_assign(_, _) | ast::expr_assign_op(_, _, _) | ast::expr_swap(_, _) | ast::expr_log(_, _, _) | ast::expr_assert(_) | - ast::expr_call(_, _, true) | - ast::expr_check(_, _) { true } + ast::expr_call(_, _, true) { true } _ { false } }; if parens { popen(s); } @@ -1351,9 +1332,6 @@ fn print_fn_args_and_ret(s: ps, decl: ast::fn_decl, popen(s); print_fn_args(s, decl, cap_items); pclose(s); - word(s.s, constrs_str(decl.constraints, {|c| - ast_fn_constr_to_str(decl, c) - })); maybe_print_comment(s, decl.output.span.lo); if decl.output.node != ast::ty_nil { @@ -1561,7 +1539,6 @@ fn print_ty_fn(s: ps, opt_proto: option, else { print_type(s, decl.output); } end(s); } - word(s.s, constrs_str(decl.constraints, ast_ty_fn_constr_to_str)); end(s); } @@ -1749,60 +1726,11 @@ fn next_comment(s: ps) -> option { } } -fn constr_args_to_str(f: fn@(T) -> str, args: [@ast::sp_constr_arg]) -> - str { - let mut comma = false; - let mut s = "("; - for args.each {|a| - if comma { s += ", "; } else { comma = true; } - s += constr_arg_to_str::(f, a.node); - } - s += ")"; - ret s; -} - -fn constr_arg_to_str(f: fn@(T) -> str, c: ast::constr_arg_general_) -> - str { - alt c { - ast::carg_base { ret "*"; } - ast::carg_ident(i) { ret f(i); } - ast::carg_lit(l) { ret lit_to_str(l); } - } -} - // needed b/c constr_args_to_str needs // something that takes an alias // (argh) fn uint_to_str(&&i: uint) -> str { ret uint::str(i); } -fn ast_ty_fn_constr_to_str(&&c: @ast::constr) -> str { - ret path_to_str(c.node.path) + - constr_args_to_str(uint_to_str, c.node.args); -} - -fn ast_fn_constr_to_str(decl: ast::fn_decl, &&c: @ast::constr) -> str { - let arg_to_str = bind fn_arg_idx_to_str(decl, _); - ret path_to_str(c.node.path) + - constr_args_to_str(arg_to_str, c.node.args); -} - -fn ty_constr_to_str(&&c: @ast::ty_constr) -> str { - fn ty_constr_path_to_str(&&p: @ast::path) -> str { "*." + path_to_str(p) } - - ret path_to_str(c.node.path) + - constr_args_to_str::<@ast::path>(ty_constr_path_to_str, - c.node.args); -} - -fn constrs_str(constrs: [T], elt: fn(T) -> str) -> str { - let mut s = "", colon = true; - for constrs.each {|c| - if colon { s += " : "; colon = false; } else { s += ", "; } - s += elt(c); - } - ret s; -} - fn fn_arg_idx_to_str(decl: ast::fn_decl, &&idx: uint) -> str { *decl.inputs[idx].ident } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 8b70848b248b4..98c17c7b4cf77 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -198,21 +198,12 @@ fn visit_ty(t: @ty, e: E, v: vt) { ty_tup(ts) { for ts.each {|tt| v.visit_ty(tt, e, v); } } ty_fn(_, decl) { for decl.inputs.each {|a| v.visit_ty(a.ty, e, v); } - for decl.constraints.each {|c| - v.visit_constr(c.node.path, c.span, c.node.id, e, v); - } v.visit_ty(decl.output, e, v); } ty_path(p, _) { visit_path(p, e, v); } ty_vstore(t, _) { v.visit_ty(t, e, v); } - ty_constr(t, cs) { - v.visit_ty(t, e, v); - for cs.each {|tc| - v.visit_constr(tc.node.path, tc.span, tc.node.id, e, v); - } - } ty_nil | ty_bot | ty_mac(_) | @@ -276,9 +267,6 @@ fn visit_ty_params(tps: [ty_param], e: E, v: vt) { fn visit_fn_decl(fd: fn_decl, e: E, v: vt) { for fd.inputs.each {|a| v.visit_ty(a.ty, e, v); } - for fd.constraints.each {|c| - v.visit_constr(c.node.path, c.span, c.node.id, e, v); - } v.visit_ty(fd.output, e, v); } @@ -382,7 +370,7 @@ fn visit_expr(ex: @expr, e: E, v: vt) { } expr_binary(_, a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); } expr_addr_of(_, x) | expr_unary(_, x) | expr_loop_body(x) | - expr_check(_, x) | expr_assert(x) { + expr_assert(x) { v.visit_expr(x, e, v); } expr_lit(_) { } @@ -392,11 +380,6 @@ fn visit_expr(ex: @expr, e: E, v: vt) { v.visit_block(b, e, v); visit_expr_opt(eo, e, v); } - expr_if_check(x, b, eo) { - v.visit_expr(x, e, v); - v.visit_block(b, e, v); - visit_expr_opt(eo, e, v); - } expr_while(x, b) { v.visit_expr(x, e, v); v.visit_block(b, e, v); } expr_loop(b) { v.visit_block(b, e, v); } expr_alt(x, arms, _) { diff --git a/src/rustc/back/rpath.rs b/src/rustc/back/rpath.rs index 06376c18cb042..4a160cda2b609 100644 --- a/src/rustc/back/rpath.rs +++ b/src/rustc/back/rpath.rs @@ -100,7 +100,9 @@ fn get_rpaths_relative_to_output(os: session::os, fn get_rpath_relative_to_output(os: session::os, cwd: path::path, output: path::path, - &&lib: path::path) : not_win32(os) -> str { + &&lib: path::path) -> str { + assert not_win32(os); + // Mac doesn't appear to support $ORIGIN let prefix = alt os { session::os_linux { "$ORIGIN" + path::path_sep() } @@ -141,7 +143,7 @@ fn get_relative_to(abs1: path::path, abs2: path::path) -> path::path { path += vec::slice(split2, start_idx, len2 - 1u); - if check vec::is_not_empty(path) { + if vec::is_not_empty(path) { ret path::connect_many(path); } else { ret "."; @@ -308,7 +310,6 @@ mod test { #[cfg(target_os = "linux")] fn test_rpath_relative() { let o = session::os_linux; - check not_win32(o); let res = get_rpath_relative_to_output(o, "/usr", "bin/rustc", "lib/libstd.so"); assert res == "$ORIGIN/../lib"; @@ -318,7 +319,6 @@ mod test { #[cfg(target_os = "freebsd")] fn test_rpath_relative() { let o = session::os_freebsd; - check not_win32(o); let res = get_rpath_relative_to_output(o, "/usr", "bin/rustc", "lib/libstd.so"); assert res == "$ORIGIN/../lib"; @@ -329,7 +329,6 @@ mod test { fn test_rpath_relative() { // this is why refinements would be nice let o = session::os_macos; - check not_win32(o); let res = get_rpath_relative_to_output(o, "/usr", "bin/rustc", "lib/libstd.so"); assert res == "@executable_path/../lib"; diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs index 550e2290bfae8..0f570140aa729 100644 --- a/src/rustc/driver/driver.rs +++ b/src/rustc/driver/driver.rs @@ -199,8 +199,6 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg, let last_use_map = time(time_passes, "liveness checking", bind middle::liveness::check_crate(ty_cx, method_map, crate)); - time(time_passes, "typestate checking", - bind middle::tstate::ck::check_crate(ty_cx, crate)); let (root_map, mutbl_map) = time( time_passes, "borrow checking", bind middle::borrowck::check_crate(ty_cx, method_map, crate)); diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index 44b9356896beb..e3306764ba116 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -219,8 +219,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item { {inputs: [], output: ret_ty, purity: ast::impure_fn, - cf: ast::return_val, - constraints: []}; + cf: ast::return_val}; // The vector of test_descs for this crate let test_descs = mk_test_desc_vec(cx); @@ -356,8 +355,7 @@ fn mk_test_wrapper(cx: test_ctxt, inputs: [], output: @{id: cx.sess.next_node_id(), node: ast::ty_nil, span: span}, purity: ast::impure_fn, - cf: ast::return_val, - constraints: [] + cf: ast::return_val }; let wrapper_body: ast::blk = nospan({ @@ -402,8 +400,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { {inputs: [args_arg], output: @ret_ty, purity: ast::impure_fn, - cf: ast::return_val, - constraints: []}; + cf: ast::return_val}; let test_main_call_expr = mk_test_main_call(cx); diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs index c6e70c6db07b1..b6ebcde0bef4c 100644 --- a/src/rustc/metadata/tydecode.rs +++ b/src/rustc/metadata/tydecode.rs @@ -63,31 +63,6 @@ fn parse_ret_ty(st: @pstate, conv: conv_did) -> (ast::ret_style, ty::t) { } } -fn parse_constrs_gen(st: @pstate, conv: conv_did, - pser: fn(@pstate) - -> ast::constr_arg_general_) -> [@ty::constr_general] { - let mut rslt: [@ty::constr_general] = []; - alt peek(st) { - ':' { - loop { - next(st); - rslt += [parse_constr(st, conv, pser)]; - if peek(st) != ';' { break; } - } - } - _ {} - } - rslt -} - -fn parse_constrs(st: @pstate, conv: conv_did) -> [@ty::constr] { - parse_constrs_gen(st, conv, parse_constr_arg) -} - -fn parse_ty_constrs(st: @pstate, conv: conv_did) -> [@ty::type_constr] { - parse_constrs_gen(st, conv, parse_ty_constr_arg) -} - fn parse_path(st: @pstate) -> @ast::path { let mut idents: [ast::ident] = []; fn is_last(c: char) -> bool { ret c == '(' || c == ':'; } @@ -106,58 +81,6 @@ fn parse_path(st: @pstate) -> @ast::path { }; } -fn parse_constr_arg(st: @pstate) -> ast::fn_constr_arg { - alt peek(st) { - '*' { st.pos += 1u; ret ast::carg_base; } - c { - - /* how will we disambiguate between - an arg index and a lit argument? */ - if c >= '0' && c <= '9' { - next(st); - // FIXME #877 - ret ast::carg_ident((c as uint) - 48u); - } else { - #error("Lit args are unimplemented"); - fail; // FIXME #877 - } - /* - else { - auto lit = parse_lit(st, conv, ','); - args += [respan(st.span, ast::carg_lit(lit))]; - } - */ - } - } -} - -fn parse_ty_constr_arg(st: @pstate) -> ast::constr_arg_general_<@path> { - alt peek(st) { - '*' { st.pos += 1u; ret ast::carg_base; } - c { ret ast::carg_ident(parse_path(st)); } - } -} - -fn parse_constr(st: @pstate, conv: conv_did, - pser: fn(@pstate) -> ast::constr_arg_general_) - -> @ty::constr_general { - // FIXME: use real spans and not a bogus one (#2407) - let sp = ast_util::dummy_sp(); - let mut args: [@sp_constr_arg] = []; - let pth = parse_path(st); - let mut ignore: char = next(st); - assert (ignore == '('); - let def = parse_def(st, conv); - let mut an_arg: constr_arg_general_; - loop { - an_arg = pser(st); - args += [@respan(sp, an_arg)]; - ignore = next(st); - if ignore != ';' { break; } - } - assert (ignore == ')'); - ret @respan(sp, {path: pth, args: args, id: def}); -} fn parse_ty_rust_fn(st: @pstate, conv: conv_did) -> ty::t { ret ty::mk_fn(st.tcx, parse_ty_fn(st, conv)); @@ -373,13 +296,6 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { } } } - 'A' { - assert (next(st) == '['); - let tt = parse_ty(st, conv); - let tcs = parse_ty_constrs(st, conv); - assert (next(st) == ']'); - ret ty::mk_constr(st.tcx, tt, tcs); - } '"' { let def = parse_def(st, conv); let inner = parse_ty(st, conv); @@ -467,10 +383,9 @@ fn parse_ty_fn(st: @pstate, conv: conv_did) -> ty::fn_ty { inputs += [{mode: ast::expl(mode), ty: parse_ty(st, conv)}]; } st.pos += 1u; // eat the ']' - let cs = parse_constrs(st, conv); let (ret_style, ret_ty) = parse_ret_ty(st, conv); ret {purity: purity, proto: proto, inputs: inputs, output: ret_ty, - ret_style: ret_style, constraints: cs}; + ret_style: ret_style}; } diff --git a/src/rustc/metadata/tyencode.rs b/src/rustc/metadata/tyencode.rs index a158b0b01fdfa..6fd2800e00a9a 100644 --- a/src/rustc/metadata/tyencode.rs +++ b/src/rustc/metadata/tyencode.rs @@ -296,12 +296,6 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) { ty::ty_opaque_closure_ptr(ty::ck_block) { w.write_str("C&"/&); } ty::ty_opaque_closure_ptr(ty::ck_box) { w.write_str("C@"/&); } ty::ty_opaque_closure_ptr(ty::ck_uniq) { w.write_str("C~"/&); } - ty::ty_constr(ty, cs) { - w.write_str("A["/&); - enc_ty(w, cx, ty); - for cs.each {|tc| enc_ty_constr(w, cx, tc); } - w.write_char(']'); - } ty::ty_opaque_box { w.write_char('B'); } ty::ty_class(def, substs) { #debug("~~~~ %s", "a["); @@ -355,55 +349,12 @@ fn enc_ty_fn(w: io::writer, cx: @ctxt, ft: ty::fn_ty) { enc_ty(w, cx, arg.ty); } w.write_char(']'); - let mut colon = true; - for ft.constraints.each {|c| - if colon { - w.write_char(':'); - colon = false; - } else { w.write_char(';'); } - enc_constr(w, cx, c); - } alt ft.ret_style { noreturn { w.write_char('!'); } _ { enc_ty(w, cx, ft.output); } } } -fn enc_constr_gen(w: io::writer, cx: @ctxt, - c: @ty::constr_general, - write_arg: fn(@sp_constr_arg)) { - w.write_str(path_to_str(c.node.path)); - w.write_char('('); - w.write_str(cx.ds(c.node.id)); - w.write_char('|'); - let mut semi = false; - for c.node.args.each {|a| - if semi { w.write_char(';'); } else { semi = true; } - write_arg(a); - } - w.write_char(')'); -} - -fn enc_constr(w: io::writer, cx: @ctxt, c: @ty::constr) { - enc_constr_gen(w, cx, c, {|a| - alt a.node { - carg_base { w.write_char('*'); } - carg_ident(i) { w.write_uint(i); } - carg_lit(l) { w.write_str(lit_to_str(l)); } - } - }); -} - -fn enc_ty_constr(w: io::writer, cx: @ctxt, c: @ty::type_constr) { - enc_constr_gen(w, cx, c, {|a| - alt a.node { - carg_base { w.write_char('*'); } - carg_ident(p) { w.write_str(path_to_str(p)); } - carg_lit(l) { w.write_str(lit_to_str(l)); } - } - }); -} - fn enc_bounds(w: io::writer, cx: @ctxt, bs: @[ty::param_bound]) { for vec::each(*bs) {|bound| alt bound { diff --git a/src/rustc/middle/borrowck/categorization.rs b/src/rustc/middle/borrowck/categorization.rs index 4a6f8c15147cb..32824082da443 100644 --- a/src/rustc/middle/borrowck/categorization.rs +++ b/src/rustc/middle/borrowck/categorization.rs @@ -173,11 +173,11 @@ impl public_methods for borrowck_ctxt { ast::expr_addr_of(*) | ast::expr_call(*) | ast::expr_bind(*) | ast::expr_swap(*) | ast::expr_move(*) | ast::expr_assign(*) | ast::expr_assign_op(*) | ast::expr_fn(*) | ast::expr_fn_block(*) | - ast::expr_assert(*) | ast::expr_check(*) | ast::expr_ret(*) | + ast::expr_assert(*) | ast::expr_ret(*) | ast::expr_loop_body(*) | ast::expr_unary(*) | ast::expr_copy(*) | ast::expr_cast(*) | ast::expr_fail(*) | ast::expr_vstore(*) | ast::expr_vec(*) | ast::expr_tup(*) | - ast::expr_if_check(*) | ast::expr_if(*) | ast::expr_log(*) | + ast::expr_if(*) | ast::expr_log(*) | ast::expr_new(*) | ast::expr_binary(*) | ast::expr_while(*) | ast::expr_block(*) | ast::expr_loop(*) | ast::expr_alt(*) | ast::expr_lit(*) | ast::expr_break | ast::expr_mac(*) | diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index 38571680ec6bb..3019994beab66 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -394,7 +394,7 @@ fn visit_expr(expr: @expr, &&self: @ir_maps, vt: vt<@ir_maps>) { } // live nodes required for interesting control flow: - expr_if_check(*) | expr_if(*) | expr_alt(*) | + expr_if(*) | expr_alt(*) | expr_while(*) | expr_loop(*) { (*self).add_live_node_for_node(expr.id, lnk_expr(expr.span)); visit::visit_expr(expr, self, vt); @@ -408,7 +408,7 @@ fn visit_expr(expr: @expr, &&self: @ir_maps, vt: vt<@ir_maps>) { expr_index(*) | expr_field(*) | expr_vstore(*) | expr_vec(*) | expr_rec(*) | expr_call(*) | expr_tup(*) | expr_bind(*) | expr_new(*) | expr_log(*) | expr_binary(*) | - expr_assert(*) | expr_check(*) | expr_addr_of(*) | expr_copy(*) | + expr_assert(*) | expr_addr_of(*) | expr_copy(*) | expr_loop_body(*) | expr_cast(*) | expr_unary(*) | expr_fail(*) | expr_break | expr_cont | expr_lit(_) | expr_ret(*) | expr_block(*) | expr_move(*) | expr_assign(*) | expr_swap(*) | @@ -875,7 +875,6 @@ class liveness { } } - expr_if_check(cond, then, els) | expr_if(cond, then, els) { // // (cond) @@ -1047,7 +1046,6 @@ class liveness { } expr_assert(e) | - expr_check(_, e) | expr_addr_of(_, e) | expr_copy(e) | expr_loop_body(e) | @@ -1397,12 +1395,12 @@ fn check_expr(expr: @expr, &&self: @liveness, vt: vt<@liveness>) { } // no correctness conditions related to liveness - expr_if_check(*) | expr_if(*) | expr_alt(*) | + expr_if(*) | expr_alt(*) | expr_while(*) | expr_loop(*) | expr_index(*) | expr_field(*) | expr_vstore(*) | expr_vec(*) | expr_rec(*) | expr_tup(*) | expr_bind(*) | expr_new(*) | expr_log(*) | expr_binary(*) | - expr_assert(*) | expr_check(*) | expr_copy(*) | + expr_assert(*) | expr_copy(*) | expr_loop_body(*) | expr_cast(*) | expr_unary(*) | expr_fail(*) | expr_ret(*) | expr_break | expr_cont | expr_lit(_) | expr_block(*) | expr_swap(*) | expr_mac(*) | expr_addr_of(*) { diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index fb9ae118a4aad..daf76aa8e1b25 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -634,9 +634,6 @@ fn visit_fn_with_scope(e: @env, fk: visit::fn_kind, decl: ast::fn_decl, _ { /* fallthrough */ } } - // here's where we need to set up the mapping - // for f's constrs in the table. - for decl.constraints.each {|c| resolve_constr(e, c, sc, v); } let scope = alt fk { visit::fk_item_fn(_, tps) | visit::fk_res(_, tps, _) | visit::fk_method(_, tps, _) | visit::fk_ctor(_, tps, _, _) | @@ -742,19 +739,6 @@ fn follow_import(e: env, &&sc: scopes, path: [ident], sp: span) -> } else { ret none; } } -fn resolve_constr(e: @env, c: @ast::constr, &&sc: scopes, _v: vt) { - alt lookup_path_strict(*e, sc, c.span, c.node.path, ns_val) { - some(d@ast::def_fn(_,ast::pure_fn)) { - e.def_map.insert(c.node.id, d); - } - _ { - let s = path_to_str(c.node.path); - e.sess.span_err(c.span, #fmt("%s is not declared pure. Try \ - `pure fn %s` instead of `fn %s`.", s, s, s)); - } - } -} - // Import resolution fn resolve_import(e: env, n_id: node_id, name: ast::ident, ids: [ast::ident], sp: codemap::span, &&sc: scopes) { diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 62128c4cf54f8..bdbffe604d7d3 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -858,8 +858,7 @@ fn get_res_dtor(ccx: @crate_ctxt, did: ast::def_id, substs: [ty::t]) inputs: [{mode: ast::expl(ast::by_ref), ty: ty::mk_nil_ptr(ccx.tcx)}], output: ty::mk_nil(ccx.tcx), - ret_style: ast::return_val, - constraints: []}); + ret_style: ast::return_val}); trans_external_path(ccx, did, fty) } } @@ -2029,14 +2028,13 @@ fn normalize_for_monomorphization(tcx: ty::ctxt, ty: ty::t) -> option { proto: fty.proto, inputs: [], output: ty::mk_nil(tcx), - ret_style: ast::return_val, - constraints: []})) } - ty::ty_iface(_, _) { some(ty::mk_fn(tcx, {purity: ast::impure_fn, - proto: ast::proto_box, - inputs: [], - output: ty::mk_nil(tcx), - ret_style: ast::return_val, - constraints: []})) } + ret_style: ast::return_val})) } + ty::ty_iface(_, _) { some(ty::mk_fn(tcx, + {purity: ast::impure_fn, + proto: ast::proto_box, + inputs: [], + output: ty::mk_nil(tcx), + ret_style: ast::return_val})) } ty::ty_ptr(_) { some(ty::mk_uint(tcx)) } _ { none } } @@ -3537,7 +3535,7 @@ fn trans_expr(bcx: block, e: @ast::expr, dest: dest) -> block { fn unrooted(bcx: block, e: @ast::expr, dest: dest) -> block { let tcx = bcx.tcx(); alt e.node { - ast::expr_if(cond, thn, els) | ast::expr_if_check(cond, thn, els) { + ast::expr_if(cond, thn, els) { ret trans_if(bcx, cond, thn, els, dest); } ast::expr_alt(expr, arms, mode) { @@ -3644,23 +3642,6 @@ fn trans_expr(bcx: block, e: @ast::expr, dest: dest) -> block { assert dest == ignore; ret trans_check_expr(bcx, e, a, "Assertion"); } - ast::expr_check(ast::checked_expr, a) { - assert dest == ignore; - ret trans_check_expr(bcx, e, a, "Predicate"); - } - ast::expr_check(ast::claimed_expr, a) { - assert dest == ignore; - /* Claims are turned on and off by a global variable - that the RTS sets. This case generates code to - check the value of that variable, doing nothing - if it's set to false and acting like a check - otherwise. */ - let c = get_extern_const(bcx.ccx().externs, bcx.ccx().llmod, - "check_claims", T_bool()); - ret with_cond(bcx, Load(bcx, c)) {|bcx| - trans_check_expr(bcx, e, a, "Claim") - }; - } ast::expr_while(cond, body) { assert dest == ignore; ret trans_while(bcx, cond, body); diff --git a/src/rustc/middle/trans/native.rs b/src/rustc/middle/trans/native.rs index ed15741e57b2a..e6c1513c0c27b 100644 --- a/src/rustc/middle/trans/native.rs +++ b/src/rustc/middle/trans/native.rs @@ -885,8 +885,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::native_item, ty::mk_mach_uint(bcx.tcx(), ast::ty_u8)) }], output: ty::mk_nil(bcx.tcx()), - ret_style: ast::return_val, - constraints: [] + ret_style: ast::return_val }); bcx = trans_call_inner(bcx, none, fty, ty::mk_nil(bcx.tcx()), { |bcx| diff --git a/src/rustc/middle/trans/reflect.rs b/src/rustc/middle/trans/reflect.rs index 0eaeb6513682f..b7295c0ce3052 100644 --- a/src/rustc/middle/trans/reflect.rs +++ b/src/rustc/middle/trans/reflect.rs @@ -248,7 +248,6 @@ impl methods for reflector { ty::ty_self { self.leaf("self") } ty::ty_type { self.leaf("type") } ty::ty_opaque_box { self.leaf("opaque_box") } - ty::ty_constr(t, _) { self.bracketed_t("constr", t, []) } ty::ty_opaque_closure_ptr(ck) { let ckval = alt ck { ty::ck_block { 0u } diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index cfd779460eb34..caa45ea4e5a58 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -391,7 +391,6 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> [u8] { ty::ty_fn({proto: ast::proto_any, _}) { [shape_stack_fn] } ty::ty_fn({proto: ast::proto_bare, _}) { [shape_bare_fn] } ty::ty_opaque_closure_ptr(_) { [shape_opaque_closure_ptr] } - ty::ty_constr(inner_t, _) { shape_of(ccx, inner_t) } ty::ty_var(_) | ty::ty_var_integral(_) | ty::ty_self { ccx.sess.bug("shape_of: unexpected type struct found"); } diff --git a/src/rustc/middle/trans/type_of.rs b/src/rustc/middle/trans/type_of.rs index fb9112fc751ff..a3f6949b8c68e 100644 --- a/src/rustc/middle/trans/type_of.rs +++ b/src/rustc/middle/trans/type_of.rs @@ -146,7 +146,6 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef { T_struct(tys) } ty::ty_opaque_closure_ptr(_) { T_opaque_box_ptr(cx) } - ty::ty_constr(subt,_) { type_of(cx, subt) } ty::ty_class(did, ts) { // only instance vars are record fields at runtime let fields = lookup_class_fields(cx.tcx, did); diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index 315e3be2afd4f..b26bfbf8add46 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -219,8 +219,8 @@ fn mark_for_expr(cx: ctx, e: @expr) { } expr_alt(_, _, _) | expr_block(_) | expr_if(_, _, _) | expr_while(_, _) | expr_fail(_) | expr_break | expr_cont | - expr_unary(_, _) | expr_lit(_) | expr_assert(_) | expr_check(_, _) | - expr_if_check(_, _, _) | expr_mac(_) | expr_addr_of(_, _) | + expr_unary(_, _) | expr_lit(_) | expr_assert(_) | + expr_mac(_) | expr_addr_of(_, _) | expr_ret(_) | expr_loop(_) | expr_bind(_, _) | expr_loop_body(_) {} } } diff --git a/src/rustc/middle/tstate/ann.rs b/src/rustc/middle/tstate/ann.rs deleted file mode 100644 index a6a46d1e222e9..0000000000000 --- a/src/rustc/middle/tstate/ann.rs +++ /dev/null @@ -1,257 +0,0 @@ - -import tritv::*; - -type precond = t; - -/* 2 means "this constraint may or may not be true after execution" - 1 means "this constraint is definitely true after execution" - 0 means "this constraint is definitely false after execution" */ -type postcond = t; - - -/* 2 means "don't know about this constraint" - 1 means "this constraint is definitely true before entry" - 0 means "this constraint is definitely false on entry" */ -type prestate = t; - - -/* similar to postcond */ -type poststate = t; - - -/* 1 means "this variable is definitely initialized" - 0 means "don't know whether this variable is - initialized" */ - -/* - This says: this expression requires the constraints whose value is 1 in -
 to be true, and given the precondition, it guarantees that the
-   constraints in  whose values are 1 are true, and that the constraints
-   in  whose values are 0 are false.
- */
-
-/* named thus so as not to confuse with prestate and poststate */
-type pre_and_post = {precondition: precond, postcondition: postcond};
-
-
-/* FIXME: once it's implemented: (Issue #34) */
-
-//  : ((*.precondition).nbits == (*.postcondition).nbits);
-type pre_and_post_state = {prestate: prestate, poststate: poststate};
-
-type ts_ann = {conditions: pre_and_post, states: pre_and_post_state};
-
-fn true_precond(num_vars: uint) -> precond { ret create_tritv(num_vars); }
-
-fn true_postcond(num_vars: uint) -> postcond { ret true_precond(num_vars); }
-
-fn empty_prestate(num_vars: uint) -> prestate { ret true_precond(num_vars); }
-
-fn empty_poststate(num_vars: uint) -> poststate {
-    ret true_precond(num_vars);
-}
-
-fn false_postcond(num_vars: uint) -> postcond {
-    let rslt = create_tritv(num_vars);
-    tritv_set_all(rslt);
-    ret rslt;
-}
-
-fn empty_pre_post(num_vars: uint) -> pre_and_post {
-    ret {precondition: empty_prestate(num_vars),
-         postcondition: empty_poststate(num_vars)};
-}
-
-fn empty_states(num_vars: uint) -> pre_and_post_state {
-    ret {prestate: true_precond(num_vars),
-         poststate: true_postcond(num_vars)};
-}
-
-fn empty_ann(num_vars: uint) -> ts_ann {
-    ret {conditions: empty_pre_post(num_vars),
-         states: empty_states(num_vars)};
-}
-
-fn get_pre(&&p: pre_and_post) -> precond { ret p.precondition; }
-
-fn get_post(&&p: pre_and_post) -> postcond { ret p.postcondition; }
-
-fn difference(p1: precond, p2: precond) -> bool {
-    ret tritv_difference(p1, p2);
-}
-
-fn union(p1: precond, p2: precond) -> bool { ret tritv_union(p1, p2); }
-
-fn intersect(p1: precond, p2: precond) -> bool {
-    ret tritv_intersect(p1, p2);
-}
-
-fn pps_len(p: pre_and_post) -> uint {
-    // gratuitous check
-
-    assert (p.precondition.nbits == p.postcondition.nbits);
-    ret p.precondition.nbits;
-}
-
-fn require(i: uint, p: pre_and_post) {
-    // sets the ith bit in p's pre
-    tritv_set(i, p.precondition, ttrue);
-}
-
-fn require_and_preserve(i: uint, p: pre_and_post) {
-    // sets the ith bit in p's pre and post
-    tritv_set(i, p.precondition, ttrue);
-    tritv_set(i, p.postcondition, ttrue);
-}
-
-fn set_in_postcond(i: uint, p: pre_and_post) -> bool {
-    // sets the ith bit in p's post
-    ret set_in_postcond_(i, p.postcondition);
-}
-
-fn set_in_postcond_(i: uint, p: postcond) -> bool {
-    let was_set = tritv_get(p, i);
-    tritv_set(i, p, ttrue);
-    ret was_set != ttrue;
-}
-
-fn set_in_poststate(i: uint, s: pre_and_post_state) -> bool {
-    // sets the ith bit in p's post
-    ret set_in_poststate_(i, s.poststate);
-}
-
-fn set_in_poststate_(i: uint, p: poststate) -> bool {
-    let was_set = tritv_get(p, i);
-    tritv_set(i, p, ttrue);
-    ret was_set != ttrue;
-
-}
-
-fn clear_in_poststate(i: uint, s: pre_and_post_state) -> bool {
-    // sets the ith bit in p's post
-    ret clear_in_poststate_(i, s.poststate);
-}
-
-fn clear_in_poststate_(i: uint, s: poststate) -> bool {
-    let was_set = tritv_get(s, i);
-    tritv_set(i, s, tfalse);
-    ret was_set != tfalse;
-}
-
-fn clear_in_prestate(i: uint, s: pre_and_post_state) -> bool {
-    // sets the ith bit in p's pre
-    ret clear_in_prestate_(i, s.prestate);
-}
-
-fn clear_in_prestate_(i: uint, s: prestate) -> bool {
-    let was_set = tritv_get(s, i);
-    tritv_set(i, s, tfalse);
-    ret was_set != tfalse;
-}
-
-fn clear_in_postcond(i: uint, s: pre_and_post) -> bool {
-    // sets the ith bit in p's post
-    let was_set = tritv_get(s.postcondition, i);
-    tritv_set(i, s.postcondition, tfalse);
-    ret was_set != tfalse;
-}
-
-// Sets all the bits in a's precondition to equal the
-// corresponding bit in p's precondition.
-fn set_precondition(a: ts_ann, p: precond) {
-    tritv_copy(a.conditions.precondition, p);
-}
-
-
-// Sets all the bits in a's postcondition to equal the
-// corresponding bit in p's postcondition.
-fn set_postcondition(a: ts_ann, p: postcond) {
-    tritv_copy(a.conditions.postcondition, p);
-}
-
-
-// Sets all the bits in a's prestate to equal the
-// corresponding bit in p's prestate.
-fn set_prestate(a: ts_ann, p: prestate) -> bool {
-    ret tritv_copy(a.states.prestate, p);
-}
-
-
-// Sets all the bits in a's postcondition to equal the
-// corresponding bit in p's postcondition.
-fn set_poststate(a: ts_ann, p: poststate) -> bool {
-    ret tritv_copy(a.states.poststate, p);
-}
-
-
-// Set all the bits in p that are set in new
-fn extend_prestate(p: prestate, newv: poststate) -> bool {
-    ret tritv_union(p, newv);
-}
-
-
-// Set all the bits in p that are set in new
-fn extend_poststate(p: poststate, newv: poststate) -> bool {
-    ret tritv_union(p, newv);
-}
-
-// Sets the given bit in p to "don't care"
-fn relax_prestate(i: uint, p: prestate) -> bool {
-    let was_set = tritv_get(p, i);
-    tritv_set(i, p, dont_care);
-    ret was_set != dont_care;
-}
-
-// Clears the given bit in p
-fn relax_poststate(i: uint, p: poststate) -> bool {
-    ret relax_prestate(i, p);
-}
-
-// Clears the given bit in p
-fn relax_precond(i: uint, p: precond) { relax_prestate(i, p); }
-
-// Sets all the bits in p to "don't care"
-fn clear(p: precond) { tritv_clear(p); }
-
-// Sets all the bits in p to true
-fn set(p: precond) { tritv_set_all(p); }
-
-fn ann_precond(a: ts_ann) -> precond { ret a.conditions.precondition; }
-
-fn ann_prestate(a: ts_ann) -> prestate { ret a.states.prestate; }
-
-fn ann_poststate(a: ts_ann) -> poststate { ret a.states.poststate; }
-
-fn pp_clone(p: pre_and_post) -> pre_and_post {
-    ret {precondition: clone(p.precondition),
-         postcondition: clone(p.postcondition)};
-}
-
-fn clone(p: prestate) -> prestate { ret tritv_clone(p); }
-
-
-// returns true if a implies b
-// that is, returns true except if for some bits c and d,
-// c = 1 and d = either 0 or "don't know"
-fn implies(a: t, b: t) -> bool {
-    let tmp = tritv_clone(b);
-    tritv_difference(tmp, a);
-    ret tritv_doesntcare(tmp);
-}
-
-fn trit_str(t: trit) -> str {
-    alt t { dont_care { "?" } ttrue { "1" } tfalse { "0" } }
-}
-
-// FIXME: Would be nice to have unit tests for some of these operations, as
-// a step towards formalizing them more rigorously. #2538
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/tstate/annotate.rs b/src/rustc/middle/tstate/annotate.rs
deleted file mode 100644
index 0db63a4ac26dc..0000000000000
--- a/src/rustc/middle/tstate/annotate.rs
+++ /dev/null
@@ -1,74 +0,0 @@
-
-import syntax::ast::*;
-import syntax::visit;
-import syntax::codemap::span;
-import syntax::print::pprust::stmt_to_str;
-import aux::{num_constraints, get_fn_info, crate_ctxt, add_node};
-import ann::empty_ann;
-import pat_util::pat_binding_ids;
-
-fn collect_ids_expr(e: @expr, rs: @mut [node_id]) { *rs += [e.id]; }
-
-fn collect_ids_block(b: blk, rs: @mut [node_id]) { *rs += [b.node.id]; }
-
-fn collect_ids_stmt(s: @stmt, rs: @mut [node_id]) {
-    alt s.node {
-      stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) {
-        #debug["node_id %s", int::str(id)];
-        #debug["%s", stmt_to_str(*s)];
-        *rs += [id];
-      }
-    }
-}
-
-fn collect_ids_local(tcx: ty::ctxt, l: @local, rs: @mut [node_id]) {
-    *rs += pat_binding_ids(tcx.def_map, l.node.pat);
-}
-
-fn node_ids_in_fn(tcx: ty::ctxt, body: blk, rs: @mut [node_id]) {
-    let collect_ids =
-        visit::mk_simple_visitor(@{visit_expr: bind collect_ids_expr(_, rs),
-                                   visit_block: bind collect_ids_block(_, rs),
-                                   visit_stmt: bind collect_ids_stmt(_, rs),
-                                   visit_local:
-                                       bind collect_ids_local(tcx, _, rs)
-                                   with *visit::default_simple_visitor()});
-    collect_ids.visit_block(body, (), collect_ids);
-}
-
-fn init_vecs(ccx: crate_ctxt, node_ids: [node_id], len: uint) {
-    for node_ids.each {|i|
-        log(debug, int::str(i) + " |-> " + uint::str(len));
-        add_node(ccx, i, empty_ann(len));
-    }
-}
-
-fn visit_fn(ccx: crate_ctxt, num_constraints: uint, body: blk) {
-    let node_ids: @mut [node_id] = @mut [];
-    node_ids_in_fn(ccx.tcx, body, node_ids);
-    let node_id_vec = *node_ids;
-    init_vecs(ccx, node_id_vec, num_constraints);
-}
-
-fn annotate_in_fn(ccx: crate_ctxt, _fk: visit::fn_kind, _decl: fn_decl,
-                  body: blk, _sp: span, id: node_id) {
-    let f_info = get_fn_info(ccx, id);
-    visit_fn(ccx, num_constraints(f_info), body);
-}
-
-fn annotate_crate(ccx: crate_ctxt, crate: crate) {
-    let do_ann =
-        visit::mk_simple_visitor(
-            @{visit_fn: bind annotate_in_fn(ccx, _, _, _, _, _)
-              with *visit::default_simple_visitor()});
-    visit::visit_crate(crate, (), do_ann);
-}
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/tstate/auxiliary.rs b/src/rustc/middle/tstate/auxiliary.rs
deleted file mode 100644
index acc11572fe2c2..0000000000000
--- a/src/rustc/middle/tstate/auxiliary.rs
+++ /dev/null
@@ -1,981 +0,0 @@
-import option::*;
-import pat_util::*;
-import syntax::ast::*;
-import syntax::ast_util::*;
-import syntax::{visit, codemap};
-import codemap::span;
-import std::map::{hashmap, int_hash};
-import syntax::print::pprust::path_to_str;
-import tstate::ann::{pre_and_post, pre_and_post_state, empty_ann, prestate,
-                     poststate, precond, postcond,
-                     set_prestate, set_poststate, set_in_poststate_,
-                     extend_prestate, extend_poststate, set_precondition,
-                     set_postcondition, ts_ann,
-                     clear_in_postcond,
-                     clear_in_poststate_};
-import driver::session::session;
-import dvec::{dvec, extensions};
-import tritv::{dont_care, tfalse, tritv_get, ttrue};
-
-import syntax::print::pprust::{constr_args_to_str, lit_to_str};
-
-// Used to communicate which operands should be invalidated
-// to helper functions
-enum oper_type {
-    oper_move,
-    oper_swap,
-    oper_assign,
-    oper_assign_op,
-    oper_pure,
-}
-
-/* logging funs */
-fn def_id_to_str(d: def_id) -> str {
-    ret int::str(d.crate) + "," + int::str(d.node);
-}
-
-fn comma_str(args: [@constr_arg_use]) -> str {
-    let mut rslt = "";
-    let mut comma = false;
-    for args.each {|a|
-        if comma { rslt += ", "; } else { comma = true; }
-        alt a.node {
-          carg_base { rslt += "*"; }
-          carg_ident(i) { rslt += *i.ident; }
-          carg_lit(l) { rslt += lit_to_str(l); }
-        }
-    }
-    ret rslt;
-}
-
-fn constraint_to_str(tcx: ty::ctxt, c: sp_constr) -> str {
-    ret #fmt("%s(%s) - arising from %s",
-             path_to_str(c.node.path),
-             comma_str(c.node.args),
-             codemap::span_to_str(c.span, tcx.sess.codemap));
-}
-
-fn tritv_to_str(fcx: fn_ctxt, v: tritv::t) -> str {
-    let mut s = "";
-    let mut comma = false;
-    for constraints(fcx).each {|p|
-        alt tritv_get(v, p.bit_num) {
-          dont_care { }
-          tt {
-            s +=
-                if comma { ", " } else { comma = true; "" } +
-                    if tt == tfalse { "!" } else { "" } +
-                    constraint_to_str(fcx.ccx.tcx, p.c);
-          }
-        }
-    }
-    ret s;
-}
-
-fn log_tritv(fcx: fn_ctxt, v: tritv::t) {
-    log(debug, tritv_to_str(fcx, v));
-}
-
-fn first_difference_string(fcx: fn_ctxt, expected: tritv::t, actual: tritv::t)
-   -> str {
-    let mut s = "";
-    for constraints(fcx).each {|c|
-        if tritv_get(expected, c.bit_num) == ttrue &&
-               tritv_get(actual, c.bit_num) != ttrue {
-            s = constraint_to_str(fcx.ccx.tcx, c.c);
-            break;
-        }
-    }
-    ret s;
-}
-
-fn log_tritv_err(fcx: fn_ctxt, v: tritv::t) {
-    log(error, tritv_to_str(fcx, v));
-}
-
-fn tos(v: [uint]) -> str {
-    let mut rslt = "";
-    for v.each {|i|
-        if i == 0u {
-            rslt += "0";
-        } else if i == 1u { rslt += "1"; } else { rslt += "?"; }
-    }
-    ret rslt;
-}
-
-fn log_cond(v: [uint]) { log(debug, tos(v)); }
-
-fn log_cond_err(v: [uint]) { log(error, tos(v)); }
-
-fn log_pp(pp: pre_and_post) {
-    let p1 = tritv::to_vec(pp.precondition);
-    let p2 = tritv::to_vec(pp.postcondition);
-    #debug("pre:");
-    log_cond(p1);
-    #debug("post:");
-    log_cond(p2);
-}
-
-fn log_pp_err(pp: pre_and_post) {
-    let p1 = tritv::to_vec(pp.precondition);
-    let p2 = tritv::to_vec(pp.postcondition);
-    #error("pre:");
-    log_cond_err(p1);
-    #error("post:");
-    log_cond_err(p2);
-}
-
-fn log_states(pp: pre_and_post_state) {
-    let p1 = tritv::to_vec(pp.prestate);
-    let p2 = tritv::to_vec(pp.poststate);
-    #debug("prestate:");
-    log_cond(p1);
-    #debug("poststate:");
-    log_cond(p2);
-}
-
-fn log_states_err(pp: pre_and_post_state) {
-    let p1 = tritv::to_vec(pp.prestate);
-    let p2 = tritv::to_vec(pp.poststate);
-    #error("prestate:");
-    log_cond_err(p1);
-    #error("poststate:");
-    log_cond_err(p2);
-}
-
-fn print_ident(i: ident) { log(debug, " " + *i + " "); }
-
-fn print_idents(&idents: [ident]) {
-    if vec::len::(idents) == 0u { ret; }
-    log(debug, "an ident: " + *vec::pop::(idents));
-    print_idents(idents);
-}
-
-
-/* data structures */
-
-/**********************************************************************/
-
-/* Two different data structures represent constraints in different
- contexts: constraint and norm_constraint.
-
-constraint gets used to record constraints in a table keyed by def_ids.  Each
-constraint has a single operator but a list of possible argument lists, and
-thus represents several constraints at once, one for each possible argument
-list.
-
-norm_constraint, in contrast, gets used when handling an instance of a
-constraint rather than a definition of a constraint. It has only a single
-argument list.
-
-The representation of constraints, where multiple instances of the
-same predicate are collapsed into one entry in the table, makes it
-easier to look up a specific instance.
-
-Both types are in constrast with the constraint type defined in
-syntax::ast, which is for predicate constraints only, and is what
-gets generated by the parser. aux and ast share the same type
-to represent predicate *arguments* however. This type
-(constr_arg_general) is parameterized (see comments in syntax::ast).
-
-Both types store an ident and span, for error-logging purposes.
-*/
-type pred_args_ = {args: [@constr_arg_use], bit_num: uint};
-
-type pred_args = spanned;
-
-// The attached node ID is the *defining* node ID
-// for this local.
-type constr_arg_use = spanned>;
-
-/* Predicate constraints refer to the truth value of a predicate on variables
-(definitely false, maybe true, or definitely true).  The  field (and the
- field in the npred constructor) names a user-defined function that
-may be the operator in a "check" expression in the source.  */
-
-type constraint = {
-    path: @path,
-    // FIXME: really only want it to be mut during collect_locals.
-    // freeze it after that. (#2539)
-    descs: @dvec
-};
-
-type tsconstr = {
-    path: @path,
-    def_id: def_id,
-    args: [@constr_arg_use]
-};
-
-type sp_constr = spanned;
-
-type norm_constraint = {bit_num: uint, c: sp_constr};
-
-type constr_map = std::map::hashmap;
-
-/* Contains stuff that has to be computed up front */
-/* For easy access, the fn_info stores two special constraints for each
-function.  So we need context. And so it seems clearer to just have separate
-constraints. */
-type fn_info =
-    /* list, accumulated during pre/postcondition
-    computation, of all local variables that may be
-    used */
-    // Doesn't seem to work without the @ -- bug
-    {constrs: constr_map,
-     num_constraints: uint,
-     cf: ret_style,
-     used_vars: @mut [node_id],
-     ignore: bool};
-
-/* mapping from node ID to typestate annotation */
-type node_ann_table = @mut [mut ts_ann];
-
-
-/* mapping from function name to fn_info map */
-type fn_info_map = std::map::hashmap;
-
-type fn_ctxt =
-    {enclosing: fn_info, id: node_id, name: ident, ccx: crate_ctxt};
-
-type crate_ctxt = {tcx: ty::ctxt, node_anns: node_ann_table, fm: fn_info_map};
-
-fn get_fn_info(ccx: crate_ctxt, id: node_id) -> fn_info {
-    assert (ccx.fm.contains_key(id));
-    ret ccx.fm.get(id);
-}
-
-fn add_node(ccx: crate_ctxt, i: node_id, a: ts_ann) {
-    let sz = vec::len(*ccx.node_anns);
-    if sz <= i as uint {
-        vec::grow(*ccx.node_anns, (i as uint) - sz + 1u, empty_ann(0u));
-    }
-    ccx.node_anns[i] = a;
-}
-
-fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option {
-    if i as uint < vec::len(*ccx.node_anns) {
-        ret some::(ccx.node_anns[i]);
-    } else { ret none::; }
-}
-
-
-/********* utils ********/
-fn node_id_to_ts_ann(ccx: crate_ctxt, id: node_id) -> ts_ann {
-    alt get_ts_ann(ccx, id) {
-      none {
-        #error("node_id_to_ts_ann: no ts_ann for node_id %d", id);
-        fail;
-      }
-      some(tt) { ret tt; }
-    }
-}
-
-fn node_id_to_poststate(ccx: crate_ctxt, id: node_id) -> poststate {
-    #debug("node_id_to_poststate");
-    ret node_id_to_ts_ann(ccx, id).states.poststate;
-}
-
-fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
-    #debug("stmt_to_ann");
-    alt s.node {
-      stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) {
-        ret node_id_to_ts_ann(ccx, id);
-      }
-    }
-}
-
-
-/* fails if e has no annotation */
-fn expr_states(ccx: crate_ctxt, e: @expr) -> pre_and_post_state {
-    #debug("expr_states");
-    ret node_id_to_ts_ann(ccx, e.id).states;
-}
-
-
-/* fails if e has no annotation */
-fn expr_pp(ccx: crate_ctxt, e: @expr) -> pre_and_post {
-    #debug("expr_pp");
-    ret node_id_to_ts_ann(ccx, e.id).conditions;
-}
-
-fn stmt_pp(ccx: crate_ctxt, s: stmt) -> pre_and_post {
-    ret stmt_to_ann(ccx, s).conditions;
-}
-
-
-/* fails if b has no annotation */
-fn block_pp(ccx: crate_ctxt, b: blk) -> pre_and_post {
-    #debug("block_pp");
-    ret node_id_to_ts_ann(ccx, b.node.id).conditions;
-}
-
-fn clear_pp(pp: pre_and_post) {
-    ann::clear(pp.precondition);
-    ann::clear(pp.postcondition);
-}
-
-fn clear_precond(ccx: crate_ctxt, id: node_id) {
-    let pp = node_id_to_ts_ann(ccx, id);
-    ann::clear(pp.conditions.precondition);
-}
-
-fn block_states(ccx: crate_ctxt, b: blk) -> pre_and_post_state {
-    #debug("block_states");
-    ret node_id_to_ts_ann(ccx, b.node.id).states;
-}
-
-fn stmt_states(ccx: crate_ctxt, s: stmt) -> pre_and_post_state {
-    ret stmt_to_ann(ccx, s).states;
-}
-
-fn expr_precond(ccx: crate_ctxt, e: @expr) -> precond {
-    ret expr_pp(ccx, e).precondition;
-}
-
-fn expr_postcond(ccx: crate_ctxt, e: @expr) -> postcond {
-    ret expr_pp(ccx, e).postcondition;
-}
-
-fn expr_prestate(ccx: crate_ctxt, e: @expr) -> prestate {
-    ret expr_states(ccx, e).prestate;
-}
-
-fn expr_poststate(ccx: crate_ctxt, e: @expr) -> poststate {
-    ret expr_states(ccx, e).poststate;
-}
-
-fn stmt_precond(ccx: crate_ctxt, s: stmt) -> precond {
-    ret stmt_pp(ccx, s).precondition;
-}
-
-fn stmt_postcond(ccx: crate_ctxt, s: stmt) -> postcond {
-    ret stmt_pp(ccx, s).postcondition;
-}
-
-fn states_to_poststate(ss: pre_and_post_state) -> poststate {
-    ret ss.poststate;
-}
-
-fn stmt_prestate(ccx: crate_ctxt, s: stmt) -> prestate {
-    ret stmt_states(ccx, s).prestate;
-}
-
-fn stmt_poststate(ccx: crate_ctxt, s: stmt) -> poststate {
-    ret stmt_states(ccx, s).poststate;
-}
-
-fn block_precond(ccx: crate_ctxt, b: blk) -> precond {
-    ret block_pp(ccx, b).precondition;
-}
-
-fn block_postcond(ccx: crate_ctxt, b: blk) -> postcond {
-    ret block_pp(ccx, b).postcondition;
-}
-
-fn block_prestate(ccx: crate_ctxt, b: blk) -> prestate {
-    ret block_states(ccx, b).prestate;
-}
-
-fn block_poststate(ccx: crate_ctxt, b: blk) -> poststate {
-    ret block_states(ccx, b).poststate;
-}
-
-fn set_prestate_ann(ccx: crate_ctxt, id: node_id, pre: prestate) -> bool {
-    #debug("set_prestate_ann");
-    ret set_prestate(node_id_to_ts_ann(ccx, id), pre);
-}
-
-fn extend_prestate_ann(ccx: crate_ctxt, id: node_id, pre: prestate) -> bool {
-    #debug("extend_prestate_ann");
-    ret extend_prestate(node_id_to_ts_ann(ccx, id).states.prestate, pre);
-}
-
-fn set_poststate_ann(ccx: crate_ctxt, id: node_id, post: poststate) -> bool {
-    #debug("set_poststate_ann");
-    ret set_poststate(node_id_to_ts_ann(ccx, id), post);
-}
-
-fn extend_poststate_ann(ccx: crate_ctxt, id: node_id, post: poststate) ->
-   bool {
-    #debug("extend_poststate_ann");
-    ret extend_poststate(node_id_to_ts_ann(ccx, id).states.poststate, post);
-}
-
-fn set_pre_and_post(ccx: crate_ctxt, id: node_id, pre: precond,
-                    post: postcond) {
-    #debug("set_pre_and_post");
-    let tt = node_id_to_ts_ann(ccx, id);
-    set_precondition(tt, pre);
-    set_postcondition(tt, post);
-}
-
-fn copy_pre_post(ccx: crate_ctxt, id: node_id, sub: @expr) {
-    #debug("set_pre_and_post");
-    let p = expr_pp(ccx, sub);
-    copy_pre_post_(ccx, id, p.precondition, p.postcondition);
-}
-
-fn copy_pre_post_(ccx: crate_ctxt, id: node_id, pre: prestate,
-                  post: poststate) {
-    #debug("set_pre_and_post");
-    let tt = node_id_to_ts_ann(ccx, id);
-    set_precondition(tt, pre);
-    set_postcondition(tt, post);
-}
-
-/* sets all bits to *1* */
-fn set_postcond_false(ccx: crate_ctxt, id: node_id) {
-    let p = node_id_to_ts_ann(ccx, id);
-    ann::set(p.conditions.postcondition);
-}
-
-fn pure_exp(ccx: crate_ctxt, id: node_id, p: prestate) -> bool {
-    ret set_prestate_ann(ccx, id, p) | set_poststate_ann(ccx, id, p);
-}
-
-fn num_constraints(m: fn_info) -> uint { ret m.num_constraints; }
-
-fn new_crate_ctxt(cx: ty::ctxt) -> crate_ctxt {
-    let na: [mut ts_ann] = [mut];
-    ret {tcx: cx, node_anns: @mut na, fm: int_hash::()};
-}
-
-/* Use e's type to determine whether it returns.
- If it has a function type with a ! annotation,
-the answer is noreturn. */
-fn controlflow_expr(ccx: crate_ctxt, e: @expr) -> ret_style {
-    alt ty::get(ty::node_id_to_type(ccx.tcx, e.id)).struct {
-      ty::ty_fn(f) { ret f.ret_style; }
-      _ { ret return_val; }
-    }
-}
-
-fn constraints_expr(cx: ty::ctxt, e: @expr) -> [@ty::constr] {
-    alt ty::get(ty::node_id_to_type(cx, e.id)).struct {
-      ty::ty_fn(f) { ret f.constraints; }
-      _ { ret []; }
-    }
-}
-
-fn node_id_to_def_strict(cx: ty::ctxt, id: node_id) -> def {
-    alt cx.def_map.find(id) {
-      none {
-        #error("node_id_to_def: node_id %d has no def", id);
-        fail;
-      }
-      some(d) { ret d; }
-    }
-}
-
-fn node_id_to_def(ccx: crate_ctxt, id: node_id) -> option {
-    ret ccx.tcx.def_map.find(id);
-}
-
-fn norm_a_constraint(id: def_id, c: constraint) -> [norm_constraint] {
-    let mut rslt: [norm_constraint] = [];
-    for (*c.descs).each {|pd|
-        rslt +=
-            [{bit_num: pd.node.bit_num,
-              c: respan(pd.span, {path: c.path,
-                                  def_id: id,
-                                  args: pd.node.args})}];
-    }
-    ret rslt;
-}
-
-
-// Tried to write this as an iterator, but I got a
-// non-exhaustive match in trans.
-fn constraints(fcx: fn_ctxt) -> [norm_constraint] {
-    let mut rslt: [norm_constraint] = [];
-    for fcx.enclosing.constrs.each {|key, val|
-        rslt += norm_a_constraint(key, val);
-    };
-    ret rslt;
-}
-
-// FIXME
-// Would rather take an immutable vec as an argument,
-// should freeze it at some earlier point. (#2539)
-fn match_args(fcx: fn_ctxt, occs: @dvec,
-              occ: [@constr_arg_use]) -> uint {
-    #debug("match_args: looking at %s",
-           constr_args_to_str(fn@(i: inst) -> str { ret *i.ident; }, occ));
-    for (*occs).each {|pd|
-        log(debug,
-                 "match_args: candidate " + pred_args_to_str(pd));
-        fn eq(p: inst, q: inst) -> bool { ret p.node == q.node; }
-        if ty::args_eq(eq, pd.node.args, occ) { ret pd.node.bit_num; }
-    }
-    fcx.ccx.tcx.sess.bug("match_args: no match for occurring args");
-}
-
-fn def_id_for_constr(tcx: ty::ctxt, t: node_id) -> def_id {
-    alt tcx.def_map.find(t) {
-      none {
-        tcx.sess.bug("node_id_for_constr: bad node_id " + int::str(t));
-      }
-      some(def_fn(i, _)) { ret i; }
-      _ { tcx.sess.bug("node_id_for_constr: pred is not a function"); }
-    }
-}
-
-fn expr_to_constr_arg(tcx: ty::ctxt, e: @expr) -> @constr_arg_use {
-    alt e.node {
-      expr_path(p) {
-        alt tcx.def_map.find(e.id) {
-          some(def_local(nid, _)) | some(def_arg(nid, _)) |
-          some(def_binding(nid)) | some(def_upvar(nid, _, _)) {
-            ret @respan(p.span,
-                        carg_ident({ident: p.idents[0], node: nid}));
-          }
-          some(what) {
-              tcx.sess.span_bug(e.span,
-                 #fmt("exprs_to_constr_args: non-local variable %? \
-                                     as pred arg", what));
-          }
-          none {
-              tcx.sess.span_bug(e.span,
-                 "exprs_to_constr_args: unbound id as pred arg");
-
-          }
-        }
-      }
-      expr_lit(l) { ret @respan(e.span, carg_lit(l)); }
-      _ {
-        tcx.sess.span_fatal(e.span,
-                            "arguments to constrained functions must be " +
-                                "literals or local variables");
-      }
-    }
-}
-
-fn exprs_to_constr_args(tcx: ty::ctxt, args: [@expr]) -> [@constr_arg_use] {
-    let f = bind expr_to_constr_arg(tcx, _);
-    let mut rslt: [@constr_arg_use] = [];
-    for args.each {|e| rslt += [f(e)]; }
-    rslt
-}
-
-fn expr_to_constr(tcx: ty::ctxt, e: @expr) -> sp_constr {
-    alt e.node {
-      expr_call(operator, args, _) {
-        alt operator.node {
-          expr_path(p) {
-            ret respan(e.span,
-                       {path: p,
-                        def_id: def_id_for_constr(tcx, operator.id),
-                        args: exprs_to_constr_args(tcx, args)});
-          }
-          _ {
-            tcx.sess.span_bug(operator.span,
-                              "ill-formed operator in predicate");
-          }
-        }
-      }
-      _ {
-        tcx.sess.span_bug(e.span, "ill-formed predicate");
-      }
-    }
-}
-
-fn pred_args_to_str(p: pred_args) -> str {
-    "<" + uint::str(p.node.bit_num) + ", " +
-        constr_args_to_str(fn@(i: inst) -> str { ret *i.ident; }, p.node.args)
-        + ">"
-}
-
-fn substitute_constr_args(cx: ty::ctxt, actuals: [@expr], c: @ty::constr) ->
-   tsconstr {
-    let mut rslt: [@constr_arg_use] = [];
-    for c.node.args.each {|a|
-        rslt += [substitute_arg(cx, actuals, a)];
-    }
-    ret {path: c.node.path,
-         def_id: c.node.id,
-         args: rslt};
-}
-
-fn substitute_arg(cx: ty::ctxt, actuals: [@expr], a: @constr_arg) ->
-   @constr_arg_use {
-    let num_actuals = vec::len(actuals);
-    alt a.node {
-      carg_ident(i) {
-        if i < num_actuals {
-            ret expr_to_constr_arg(cx, actuals[i]);
-        } else {
-            cx.sess.span_fatal(a.span, "constraint argument out of bounds");
-        }
-      }
-      carg_base { ret @respan(a.span, carg_base); }
-      carg_lit(l) { ret @respan(a.span, carg_lit(l)); }
-    }
-}
-
-fn pred_args_matches(pattern: [constr_arg_general_],
-                     desc: pred_args) ->
-   bool {
-    let mut i = 0u;
-    for desc.node.args.each {|c|
-        let n = pattern[i];
-        alt c.node {
-          carg_ident(p) {
-            alt n {
-              carg_ident(q) { if p.node != q.node { ret false; } }
-              _ { ret false; }
-            }
-          }
-          carg_base { if n != carg_base { ret false; } }
-          carg_lit(l) {
-            alt n {
-              carg_lit(m) { if !const_eval::lit_eq(l, m) { ret false; } }
-              _ { ret false; }
-            }
-          }
-        }
-        i += 1u;
-    }
-    ret true;
-}
-
-fn find_instance_(pattern: [constr_arg_general_],
-                  descs: [pred_args]) ->
-   option {
-    for descs.each {|d|
-        if pred_args_matches(pattern, d) { ret some(d.node.bit_num); }
-    }
-    ret none;
-}
-
-type inst = {ident: ident, node: node_id};
-
-enum dest {
-    local_dest(inst), // RHS is assigned to a local variable
-    call                        // RHS is passed to a function
-}
-
-type subst = [{from: inst, to: inst}];
-
-fn find_instances(_fcx: fn_ctxt, subst: subst,
-                  c: constraint) -> [{from: uint, to: uint}] {
-
-    if vec::len(subst) == 0u { ret []; }
-    let mut res = [];
-    (*c.descs).swap { |v|
-        let v <- vec::from_mut(v);
-        for v.each { |d|
-            if args_mention(d.node.args, find_in_subst_bool, subst) {
-                let old_bit_num = d.node.bit_num;
-                let newv = replace(subst, d);
-                alt find_instance_(newv, v) {
-                  some(d1) {res += [{from: old_bit_num, to: d1}]}
-                  _ {}
-                }
-            } else {}
-        }
-        vec::to_mut(v)
-    }
-    ret res;
-}
-
-fn find_in_subst(id: node_id, s: subst) -> option {
-    for s.each {|p|
-        if id == p.from.node { ret some(p.to); }
-    }
-    ret none;
-}
-
-fn find_in_subst_bool(s: subst, id: node_id) -> bool {
-    is_some(find_in_subst(id, s))
-}
-
-fn insts_to_str(stuff: [constr_arg_general_]) -> str {
-    let mut rslt = "<";
-    for stuff.each {|i|
-        rslt +=
-            " " +
-                alt i {
-                  carg_ident(p) { *p.ident }
-                  carg_base { "*" }
-                  carg_lit(_) { "[lit]" }
-                } + " ";
-    }
-    rslt += ">";
-    rslt
-}
-
-fn replace(subst: subst, d: pred_args) -> [constr_arg_general_] {
-    let mut rslt: [constr_arg_general_] = [];
-    for d.node.args.each {|c|
-        alt c.node {
-          carg_ident(p) {
-            alt find_in_subst(p.node, subst) {
-              some(newv) { rslt += [carg_ident(newv)]; }
-              _ { rslt += [c.node]; }
-            }
-          }
-          _ {
-            rslt += [c.node];
-          }
-        }
-    }
-
-    ret rslt;
-}
-
-enum if_ty { if_check, plain_if, }
-
-fn for_constraints_mentioning(fcx: fn_ctxt, id: node_id,
-                              f: fn(norm_constraint)) {
-    for constraints(fcx).each {|c|
-        if constraint_mentions(fcx, c, id) { f(c); }
-    };
-}
-
-fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) ->
-   def_id {
-    alt local_node_id_to_def(fcx, i) {
-      some(def_local(nid, _)) | some(def_arg(nid, _)) |
-      some(def_upvar(nid, _, _)) {
-        ret local_def(nid);
-      }
-      some(_) {
-        fcx.ccx.tcx.sess.span_fatal(sp,
-                                    "local_node_id_to_def_id: id \
-               isn't a local");
-      }
-      none {
-        // should really be bug. span_bug()?
-        fcx.ccx.tcx.sess.span_fatal(sp,
-                                    "local_node_id_to_def_id: id \
-               is unbound");
-      }
-    }
-}
-
-fn local_node_id_to_def(fcx: fn_ctxt, i: node_id) -> option {
-    fcx.ccx.tcx.def_map.find(i)
-}
-
-fn local_node_id_to_def_id(fcx: fn_ctxt, i: node_id) -> option {
-    alt local_node_id_to_def(fcx, i) {
-      some(def_local(nid, _)) | some(def_arg(nid, _)) |
-      some(def_binding(nid)) | some(def_upvar(nid, _, _)) {
-        some(local_def(nid))
-      }
-      _ { none }
-    }
-}
-
-fn local_node_id_to_local_def_id(fcx: fn_ctxt, i: node_id) ->
-   option {
-    alt local_node_id_to_def_id(fcx, i) {
-      some(did) { some(did.node) }
-      _ { none }
-    }
-}
-
-fn copy_in_postcond(fcx: fn_ctxt, parent_exp: node_id, dest: inst, src: inst,
-                    ty: oper_type) {
-    let post =
-        node_id_to_ts_ann(fcx.ccx, parent_exp).conditions.postcondition;
-    copy_in_poststate_two(fcx, post, post, dest, src, ty);
-}
-
-fn copy_in_poststate(fcx: fn_ctxt, post: poststate, dest: inst, src: inst,
-                     ty: oper_type) {
-    copy_in_poststate_two(fcx, post, post, dest, src, ty);
-}
-
-// In target_post, set the bits corresponding to copies of any
-// constraints mentioning src that are set in src_post, with
-// dest substituted for src.
-// (This doesn't create any new constraints. If a new, substituted
-// constraint isn't already in the bit vector, it's ignored.)
-fn copy_in_poststate_two(fcx: fn_ctxt, src_post: poststate,
-                         target_post: poststate, dest: inst, src: inst,
-                         ty: oper_type) {
-    let mut subst;
-    alt ty {
-      oper_swap { subst = [{from: dest, to: src}, {from: src, to: dest}]; }
-      oper_assign_op {
-        ret; // Don't do any propagation
-      }
-      _ { subst = [{from: src, to: dest}]; }
-    }
-
-
-    for fcx.enclosing.constrs.each_value {|val|
-        // replace any occurrences of the src def_id with the
-        // dest def_id
-        let insts = find_instances(fcx, subst, val);
-        for insts.each {|p|
-            if bitvectors::promises_(p.from, src_post) {
-                set_in_poststate_(p.to, target_post);
-            }
-        }
-    };
-}
-
-fn forget_in_postcond(fcx: fn_ctxt, parent_exp: node_id, dead_v: node_id) {
-    // In the postcondition given by parent_exp, clear the bits
-    // for any constraints mentioning dead_v
-    let d = local_node_id_to_local_def_id(fcx, dead_v);
-    option::iter(d) {|d_id|
-        for_constraints_mentioning(fcx, d_id) {|c|
-                #debug("clearing constraint %u %s",
-                       c.bit_num,
-                       constraint_to_str(fcx.ccx.tcx, c.c));
-                clear_in_postcond(c.bit_num,
-                                  node_id_to_ts_ann(fcx.ccx,
-                                                    parent_exp).conditions);
-        }
-    };
-}
-
-fn forget_in_poststate(fcx: fn_ctxt, p: poststate, dead_v: node_id) -> bool {
-    // In the poststate given by parent_exp, clear the bits
-    // for any constraints mentioning dead_v
-    let d = local_node_id_to_local_def_id(fcx, dead_v);
-    let mut changed = false;
-    option::iter(d) {|d_id|
-        for_constraints_mentioning(fcx, d_id) {|c|
-                changed |= clear_in_poststate_(c.bit_num, p);
-        }
-    }
-    ret changed;
-}
-
-fn any_eq(v: [node_id], d: node_id) -> bool {
-    for v.each {|i| if i == d { ret true; } }
-    false
-}
-
-fn constraint_mentions(_fcx: fn_ctxt, c: norm_constraint, v: node_id) ->
-   bool {
-    ret args_mention(c.c.node.args, any_eq, [v]);
-}
-
-fn args_mention(args: [@constr_arg_use],
-                   q: fn([T], node_id) -> bool,
-                   s: [T]) -> bool {
-
-    for args.each {|a|
-        alt a.node { carg_ident(p1) { if q(s, p1.node) { ret true; } } _ { } }
-    }
-    ret false;
-}
-
-fn use_var(fcx: fn_ctxt, v: node_id) { *fcx.enclosing.used_vars += [v]; }
-
-fn op_to_oper_ty(io: init_op) -> oper_type {
-    alt io { init_move { oper_move } _ { oper_assign } }
-}
-
-// default function visitor
-fn do_nothing(_fk: visit::fn_kind, _decl: fn_decl, _body: blk,
-                 _sp: span, _id: node_id,
-                 _t: T, _v: visit::vt) {
-}
-
-
-fn args_to_constr_args(tcx: ty::ctxt, args: [arg],
-                       indices: [@sp_constr_arg]) -> [@constr_arg_use] {
-    let mut actuals: [@constr_arg_use] = [];
-    let num_args = vec::len(args);
-    for indices.each {|a|
-        actuals +=
-            [@respan(a.span,
-                     alt a.node {
-                       carg_base { carg_base }
-                       carg_ident(i) {
-                         if i < num_args {
-                             carg_ident({ident: args[i].ident,
-                                         node: args[i].id})
-                         } else {
-                             tcx.sess.span_bug(a.span,
-                                               "index out of bounds in \
-                  constraint arg");
-                         }
-                       }
-                       carg_lit(l) { carg_lit(l) }
-                     })];
-    }
-    ret actuals;
-}
-
-fn ast_constr_to_ts_constr(tcx: ty::ctxt, args: [arg], c: @constr) ->
-   tsconstr {
-    let tconstr = ty::ast_constr_to_constr(tcx, c);
-    ret {path: tconstr.node.path,
-         def_id: tconstr.node.id,
-         args: args_to_constr_args(tcx, args, tconstr.node.args)};
-}
-
-fn ast_constr_to_sp_constr(tcx: ty::ctxt, args: [arg], c: @constr) ->
-   sp_constr {
-    let tconstr = ast_constr_to_ts_constr(tcx, args, c);
-    ret respan(c.span, tconstr);
-}
-
-type binding = {lhs: [dest], rhs: option};
-
-fn local_to_bindings(tcx: ty::ctxt, loc: @local) -> binding {
-    let mut lhs = [];
-    pat_bindings(tcx.def_map, loc.node.pat) {|p_id, _s, name|
-      lhs += [local_dest({ident: path_to_ident(name), node: p_id})];
-    };
-    {lhs: lhs, rhs: loc.node.init}
-}
-
-fn locals_to_bindings(tcx: ty::ctxt, locals: [@local]) -> [binding] {
-    let mut rslt = [];
-    for locals.each {|loc| rslt += [local_to_bindings(tcx, loc)]; }
-    ret rslt;
-}
-
-fn callee_modes(fcx: fn_ctxt, callee: node_id) -> [mode] {
-    let ty = ty::type_autoderef(fcx.ccx.tcx,
-                                ty::node_id_to_type(fcx.ccx.tcx, callee));
-    alt ty::get(ty).struct {
-      ty::ty_fn({inputs: args, _}) {
-        let mut modes = [];
-        for args.each {|arg| modes += [arg.mode]; }
-        ret modes;
-      }
-      _ {
-        // Shouldn't happen; callee should be ty_fn.
-        fcx.ccx.tcx.sess.bug("non-fn callee type in callee_modes: " +
-                                 util::ppaux::ty_to_str(fcx.ccx.tcx, ty));
-      }
-    }
-}
-
-fn callee_arg_init_ops(fcx: fn_ctxt, callee: node_id) -> [init_op] {
-    vec::map(callee_modes(fcx, callee)) {|m|
-        alt ty::resolved_mode(fcx.ccx.tcx, m) {
-          by_move { init_move }
-          by_copy | by_ref | by_val | by_mutbl_ref { init_assign }
-        }
-    }
-}
-
-fn arg_bindings(ops: [init_op], es: [@expr]) -> [binding] {
-    let mut bindings: [binding] = [];
-    let mut i = 0u;
-    for ops.each {|op|
-        bindings += [{lhs: [call], rhs: some({op: op, expr: es[i]})}];
-        i += 1u;
-    }
-    ret bindings;
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/tstate/bitvectors.rs b/src/rustc/middle/tstate/bitvectors.rs
deleted file mode 100644
index c3a38ac35eb54..0000000000000
--- a/src/rustc/middle/tstate/bitvectors.rs
+++ /dev/null
@@ -1,186 +0,0 @@
-import syntax::ast::*;
-import syntax::visit;
-import option::*;
-import aux::*;
-import tstate::ann::{pre_and_post, precond, postcond, prestate, poststate,
-                     relax_prestate, relax_precond, relax_poststate,
-                     pps_len, true_precond,
-                     difference, union, clone,
-                     set_in_postcond, set_in_poststate, set_in_poststate_,
-                     clear_in_poststate, clear_in_prestate,
-                     clear_in_poststate_};
-import tritv::*;
-import driver::session::session;
-import std::map::hashmap;
-
-fn bit_num(fcx: fn_ctxt, c: tsconstr) -> uint {
-    let d = c.def_id;
-    assert (fcx.enclosing.constrs.contains_key(d));
-    let rslt = fcx.enclosing.constrs.get(d);
-    match_args(fcx, rslt.descs, c.args)
-}
-
-fn promises(fcx: fn_ctxt, p: poststate, c: tsconstr) -> bool {
-    ret promises_(bit_num(fcx, c), p);
-}
-
-fn promises_(n: uint, p: poststate) -> bool {
-    ret tritv_get(p, n) == ttrue;
-}
-
-// v "happens after" u
-fn seq_trit(u: trit, v: trit) -> trit {
-    alt v { ttrue { ttrue } tfalse { tfalse } dont_care { u } }
-}
-
-// idea: q "happens after" p -- so if something is
-// 1 in q and 0 in p, it's 1 in the result; however,
-// if it's 0 in q and 1 in p, it's 0 in the result
-fn seq_tritv(p: postcond, q: postcond) {
-    let mut i = 0u;
-    assert (p.nbits == q.nbits);
-    while i < p.nbits {
-        tritv_set(i, p, seq_trit(tritv_get(p, i), tritv_get(q, i)));
-        i += 1u;
-    }
-}
-
-fn seq_postconds(fcx: fn_ctxt, ps: [postcond]) -> postcond {
-    let sz = vec::len(ps);
-    if sz >= 1u {
-        let prev = tritv_clone(ps[0]);
-        vec::iter_between(ps, 1u, sz) {|p| seq_tritv(prev, p); }
-        ret prev;
-    } else { ret ann::empty_poststate(num_constraints(fcx.enclosing)); }
-}
-
-// Given a list of pres and posts for exprs e0 ... en,
-// return the precondition for evaluating each expr in order.
-// So, if e0's post is {x} and e1's pre is {x, y, z}, the entire
-// precondition shouldn't include x.
-fn seq_preconds(fcx: fn_ctxt, pps: [pre_and_post]) -> precond {
-    let sz: uint = vec::len(pps);
-    let num_vars: uint = num_constraints(fcx.enclosing);
-
-    fn seq_preconds_go(fcx: fn_ctxt, pps: [pre_and_post],
-                       idx: uint, first: pre_and_post)
-       -> precond {
-        let mut idx = idx;
-        let mut first = first;
-        loop {
-            let sz: uint = vec::len(pps) - idx;
-            if sz >= 1u {
-                let second = pps[0];
-                assert (pps_len(second) == num_constraints(fcx.enclosing));
-                let second_pre = clone(second.precondition);
-                difference(second_pre, first.postcondition);
-                let next_first = clone(first.precondition);
-                union(next_first, second_pre);
-                let next_first_post = clone(first.postcondition);
-                seq_tritv(next_first_post, second.postcondition);
-                idx += 1u;
-                first = {precondition: next_first,
-                         postcondition: next_first_post};
-            } else { ret first.precondition; }
-        }
-    }
-
-    if sz >= 1u {
-        let first = pps[0];
-        assert (pps_len(first) == num_vars);
-        ret seq_preconds_go(fcx, pps, 1u, first);
-    } else { ret true_precond(num_vars); }
-}
-
-fn intersect_states(p: prestate, q: prestate) -> prestate {
-    let rslt = tritv_clone(p);
-    tritv_intersect(rslt, q);
-    ret rslt;
-}
-
-fn gen(fcx: fn_ctxt, id: node_id, c: tsconstr) -> bool {
-    ret set_in_postcond(bit_num(fcx, c),
-                        node_id_to_ts_ann(fcx.ccx, id).conditions);
-}
-
-fn declare_var(fcx: fn_ctxt, c: tsconstr, pre: prestate) -> prestate {
-    let rslt = clone(pre);
-    relax_prestate(bit_num(fcx, c), rslt);
-    // idea is this is scoped
-    relax_poststate(bit_num(fcx, c), rslt);
-    ret rslt;
-}
-
-fn relax_precond_expr(e: @expr, cx: relax_ctxt, vt: visit::vt) {
-    relax_precond(cx.i as uint, expr_precond(cx.fcx.ccx, e));
-    visit::visit_expr(e, cx, vt);
-}
-
-fn relax_precond_stmt(s: @stmt, cx: relax_ctxt, vt: visit::vt) {
-    relax_precond(cx.i as uint, stmt_precond(cx.fcx.ccx, *s));
-    visit::visit_stmt(s, cx, vt);
-}
-
-type relax_ctxt = {fcx: fn_ctxt, i: node_id};
-
-fn relax_precond_block_inner(b: blk, cx: relax_ctxt,
-                             vt: visit::vt) {
-    relax_precond(cx.i as uint, block_precond(cx.fcx.ccx, b));
-    visit::visit_block(b, cx, vt);
-}
-
-fn relax_precond_block(fcx: fn_ctxt, i: node_id, b: blk) {
-    let cx = {fcx: fcx, i: i};
-    let visitor = visit::default_visitor::();
-    let visitor =
-        @{visit_block: relax_precond_block_inner,
-          visit_expr: relax_precond_expr,
-          visit_stmt: relax_precond_stmt,
-          visit_item:
-              fn@(_i: @item, _cx: relax_ctxt, _vt: visit::vt) { },
-          visit_fn: bind do_nothing(_, _, _, _, _, _, _)
-             with *visitor};
-    let v1 = visit::mk_vt(visitor);
-    v1.visit_block(b, cx, v1);
-}
-
-fn gen_poststate(fcx: fn_ctxt, id: node_id, c: tsconstr) -> bool {
-    #debug("gen_poststate");
-    ret set_in_poststate(bit_num(fcx, c),
-                         node_id_to_ts_ann(fcx.ccx, id).states);
-}
-
-fn kill_prestate(fcx: fn_ctxt, id: node_id, c: tsconstr) -> bool {
-    ret clear_in_prestate(bit_num(fcx, c),
-                          node_id_to_ts_ann(fcx.ccx, id).states);
-}
-
-fn kill_all_prestate(fcx: fn_ctxt, id: node_id) {
-    tritv::tritv_kill(node_id_to_ts_ann(fcx.ccx, id).states.prestate);
-}
-
-
-fn kill_poststate(fcx: fn_ctxt, id: node_id, c: tsconstr) -> bool {
-    #debug("kill_poststate");
-    ret clear_in_poststate(bit_num(fcx, c),
-                           node_id_to_ts_ann(fcx.ccx, id).states);
-}
-
-fn kill_poststate_(fcx: fn_ctxt, c: tsconstr, post: poststate) -> bool {
-    #debug("kill_poststate_");
-    ret clear_in_poststate_(bit_num(fcx, c), post);
-}
-
-fn set_in_prestate_constr(fcx: fn_ctxt, c: tsconstr, t: prestate) -> bool {
-    ret set_in_poststate_(bit_num(fcx, c), t);
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/tstate/ck.rs b/src/rustc/middle/tstate/ck.rs
deleted file mode 100644
index 64936ec37e5ee..0000000000000
--- a/src/rustc/middle/tstate/ck.rs
+++ /dev/null
@@ -1,151 +0,0 @@
-
-import syntax::ast;
-import ast::{stmt, fn_ident, node_id, crate, return_val, noreturn, expr};
-import syntax::{visit, print};
-import syntax::codemap::span;
-import middle::ty;
-import tstate::ann::{precond, prestate,
-                     implies, ann_precond, ann_prestate};
-import aux::*;
-
-import util::ppaux::ty_to_str;
-import bitvectors::*;
-import annotate::annotate_crate;
-import collect_locals::mk_f_to_fn_info;
-import pre_post_conditions::fn_pre_post;
-import states::find_pre_post_state_fn;
-import syntax::print::pprust::expr_to_str;
-import driver::session::session;
-import std::map::hashmap;
-
-fn check_states_expr(e: @expr, fcx: fn_ctxt, v: visit::vt) {
-    visit::visit_expr(e, fcx, v);
-
-    let prec: precond = expr_precond(fcx.ccx, e);
-    let pres: prestate = expr_prestate(fcx.ccx, e);
-
-    if !implies(pres, prec) {
-        let mut s = "";
-        let diff = first_difference_string(fcx, prec, pres);
-        s +=
-            "unsatisfied precondition constraint (for example, " + diff +
-                ") for expression:\n";
-        s += syntax::print::pprust::expr_to_str(e);
-        s += "\nprecondition:\n";
-        s += tritv_to_str(fcx, prec);
-        s += "\nprestate:\n";
-        s += tritv_to_str(fcx, pres);
-        fcx.ccx.tcx.sess.span_fatal(e.span, s);
-    }
-}
-
-fn check_states_stmt(s: @stmt, fcx: fn_ctxt, v: visit::vt) {
-    visit::visit_stmt(s, fcx, v);
-
-    let a = stmt_to_ann(fcx.ccx, *s);
-    let prec: precond = ann_precond(a);
-    let pres: prestate = ann_prestate(a);
-
-    #debug("check_states_stmt:");
-    log(debug, print::pprust::stmt_to_str(*s));
-    #debug("prec = ");
-    log_tritv(fcx, prec);
-    #debug("pres = ");
-    log_tritv(fcx, pres);
-
-    if !implies(pres, prec) {
-        let mut ss = "";
-        let diff = first_difference_string(fcx, prec, pres);
-        ss +=
-            "unsatisfied precondition constraint (for example, " + diff +
-                ") for statement:\n";
-        ss += syntax::print::pprust::stmt_to_str(*s);
-        ss += "\nprecondition:\n";
-        ss += tritv_to_str(fcx, prec);
-        ss += "\nprestate: \n";
-        ss += tritv_to_str(fcx, pres);
-        fcx.ccx.tcx.sess.span_fatal(s.span, ss);
-    }
-}
-
-fn check_states_against_conditions(fcx: fn_ctxt,
-                                   fk: visit::fn_kind,
-                                   f_decl: ast::fn_decl,
-                                   f_body: ast::blk,
-                                   sp: span,
-                                   id: node_id) {
-    /* Postorder traversal instead of pre is important
-       because we want the smallest possible erroneous statement
-       or expression. */
-    let visitor = visit::mk_vt(
-        @{visit_stmt: check_states_stmt,
-          visit_expr: check_states_expr,
-          visit_fn: bind do_nothing::(_, _, _, _, _, _, _)
-          with *visit::default_visitor::()});
-    visit::visit_fn(fk, f_decl, f_body, sp, id, fcx, visitor);
-}
-
-fn check_fn_states(fcx: fn_ctxt,
-                   fk: visit::fn_kind,
-                   f_decl: ast::fn_decl,
-                   f_body: ast::blk,
-                   sp: span,
-                   id: node_id) {
-    /* Compute the pre- and post-states for this function */
-
-    // Fixpoint iteration
-    while find_pre_post_state_fn(fcx, f_decl, f_body) { }
-
-    /* Now compare each expr's pre-state to its precondition
-       and post-state to its postcondition */
-
-    check_states_against_conditions(fcx, fk, f_decl, f_body, sp, id);
-}
-
-fn fn_states(fk: visit::fn_kind, f_decl: ast::fn_decl, f_body: ast::blk,
-             sp: span, id: node_id,
-             ccx: crate_ctxt, v: visit::vt) {
-
-    visit::visit_fn(fk, f_decl, f_body, sp, id, ccx, v);
-
-    // We may not care about typestate for this function if it contains
-    // no constrained calls
-    if !ccx.fm.get(id).ignore {
-        /* Look up the var-to-bit-num map for this function */
-
-        let f_info = ccx.fm.get(id);
-        let name = visit::name_of_fn(fk);
-        let fcx = {enclosing: f_info, id: id, name: name, ccx: ccx};
-        check_fn_states(fcx, fk, f_decl, f_body, sp, id)
-    }
-}
-
-fn check_crate(cx: ty::ctxt, crate: @crate) {
-    let ccx: crate_ctxt = new_crate_ctxt(cx);
-    /* Build the global map from function id to var-to-bit-num-map */
-
-    mk_f_to_fn_info(ccx, crate);
-    /* Add a blank ts_ann for every statement (and expression) */
-
-    annotate_crate(ccx, *crate);
-    /* Compute the pre and postcondition for every subexpression */
-
-    let vtor = visit::default_visitor::();
-    let vtor = @{visit_fn: fn_pre_post with *vtor};
-    visit::visit_crate(*crate, ccx, visit::mk_vt(vtor));
-
-    /* Check the pre- and postcondition against the pre- and poststate
-       for every expression */
-    let vtor = visit::default_visitor::();
-    let vtor = @{visit_fn: fn_states with *vtor};
-    visit::visit_crate(*crate, ccx, visit::mk_vt(vtor));
-}
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/tstate/collect_locals.rs b/src/rustc/middle/tstate/collect_locals.rs
deleted file mode 100644
index a6ce1642bab61..0000000000000
--- a/src/rustc/middle/tstate/collect_locals.rs
+++ /dev/null
@@ -1,163 +0,0 @@
-import option::*;
-import pat_util::*;
-import syntax::ast::*;
-import syntax::ast_util::*;
-import syntax::visit;
-import syntax::codemap::span;
-import syntax::ast_util::respan;
-import driver::session::session;
-import aux::*;
-import std::map::hashmap;
-import dvec::{dvec, extensions};
-
-type ctxt = {cs: @mut [sp_constr], tcx: ty::ctxt};
-
-fn collect_pred(e: @expr, cx: ctxt, v: visit::vt) {
-    alt e.node {
-      expr_check(_, ch) { *cx.cs += [expr_to_constr(cx.tcx, ch)]; }
-      expr_if_check(ex, _, _) { *cx.cs += [expr_to_constr(cx.tcx, ex)]; }
-
-      // If it's a call, generate appropriate instances of the
-      // call's constraints.
-      expr_call(operator, operands, _) {
-        for constraints_expr(cx.tcx, operator).each {|c|
-            let ct: sp_constr =
-                respan(c.span,
-                       aux::substitute_constr_args(cx.tcx, operands, c));
-            *cx.cs += [ct];
-        }
-      }
-      _ { }
-    }
-    // visit subexpressions
-    visit::visit_expr(e, cx, v);
-}
-
-fn find_locals(tcx: ty::ctxt,
-               fk: visit::fn_kind,
-               f_decl: fn_decl,
-               f_body: blk,
-               sp: span,
-               id: node_id) -> ctxt {
-    let cx: ctxt = {cs: @mut [], tcx: tcx};
-    let visitor = visit::default_visitor::();
-    let visitor =
-        @{visit_expr: collect_pred,
-          visit_fn: bind do_nothing(_, _, _, _, _, _, _)
-          with *visitor};
-    visit::visit_fn(fk, f_decl, f_body, sp,
-                    id, cx, visit::mk_vt(visitor));
-    ret cx;
-}
-
-fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) ->
-   uint {
-    log(debug,
-             constraint_to_str(tcx, c) + " |-> " + uint::str(next));
-
-    let {path: p, def_id: d_id, args: args} = c.node;
-    alt tbl.find(d_id) {
-      some(ct) {
-        (*ct.descs).push(respan(c.span, {args: args, bit_num: next}));
-      }
-      none {
-        let rslt = @dvec();
-        (*rslt).push(respan(c.span, {args: args, bit_num: next}));
-        tbl.insert(d_id, {path:p, descs:rslt});
-      }
-    }
-    ret next + 1u;
-}
-
-fn contains_constrained_calls(tcx: ty::ctxt, body: blk) -> bool {
-    type cx = @{
-        tcx: ty::ctxt,
-        mut has: bool
-    };
-    let cx = @{
-        tcx: tcx,
-        mut has: false
-    };
-    let vtor = visit::default_visitor::();
-    let vtor = @{visit_expr: visit_expr with *vtor};
-    visit::visit_block(body, cx, visit::mk_vt(vtor));
-    ret cx.has;
-
-    fn visit_expr(e: @expr, &&cx: cx, v: visit::vt) {
-        import syntax::print::pprust;
-        #debug("visiting %?", pprust::expr_to_str(e));
-
-        visit::visit_expr(e, cx, v);
-
-        if constraints_expr(cx.tcx, e).is_not_empty() {
-            #debug("has constraints");
-            cx.has = true;
-        } else {
-            #debug("has not constraints");
-        }
-    }
-}
-
-/* builds a table mapping each local var defined in f
-   to a bit number in the precondition/postcondition vectors */
-fn mk_fn_info(ccx: crate_ctxt,
-              fk: visit::fn_kind,
-              f_decl: fn_decl,
-              f_body: blk,
-              f_sp: span,
-              id: node_id) {
-    let name = visit::name_of_fn(fk);
-    let res_map = new_def_hash::();
-    let mut next: uint = 0u;
-
-    let cx: ctxt = find_locals(ccx.tcx, fk, f_decl, f_body, f_sp, id);
-    /* now we have to add bit nums for both the constraints
-       and the variables... */
-
-    let ignore = !contains_constrained_calls(ccx.tcx, f_body);
-
-    if !ignore {
-        let mut i = 0u, l = vec::len(*cx.cs);
-        while i < l {
-            next = add_constraint(cx.tcx, copy cx.cs[i], next, res_map);
-            i += 1u;
-        }
-        /* if this function has any constraints, instantiate them to the
-        argument names and add them */
-        for f_decl.constraints.each {|c|
-            let sc = ast_constr_to_sp_constr(cx.tcx, f_decl.inputs, c);
-            next = add_constraint(cx.tcx, sc, next, res_map);
-        }
-    }
-
-    let v: @mut [node_id] = @mut [];
-    let rslt =
-        {constrs: res_map,
-         num_constraints: next,
-         cf: f_decl.cf,
-         used_vars: v,
-         ignore: ignore};
-    ccx.fm.insert(id, rslt);
-    #debug("%s has %u constraints", *name, num_constraints(rslt));
-}
-
-
-/* initializes the global fn_info_map (mapping each function ID, including
-   nested locally defined functions, onto a mapping from local variable name
-   to bit number) */
-fn mk_f_to_fn_info(ccx: crate_ctxt, c: @crate) {
-    let visitor =
-        visit::mk_simple_visitor(@{visit_fn:
-                                       bind mk_fn_info(ccx, _, _, _, _, _)
-                                   with *visit::default_simple_visitor()});
-    visit::visit_crate(*c, (), visitor);
-}
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/tstate/pre_post_conditions.rs b/src/rustc/middle/tstate/pre_post_conditions.rs
deleted file mode 100644
index a51a4f72a0e84..0000000000000
--- a/src/rustc/middle/tstate/pre_post_conditions.rs
+++ /dev/null
@@ -1,637 +0,0 @@
-import tstate::ann::*;
-import aux::*;
-import bitvectors::{bit_num, seq_preconds, seq_postconds,
-                    intersect_states,
-                    relax_precond_block, gen};
-import tritv::*;
-
-import pat_util::*;
-import syntax::ast::*;
-import syntax::ast_util::*;
-import syntax::print::pprust::{expr_to_str, stmt_to_str};
-import syntax::visit;
-import util::common::{field_exprs, has_nonlocal_exits};
-import syntax::codemap::span;
-import driver::session::session;
-import std::map::hashmap;
-
-fn find_pre_post_mod(_m: _mod) -> _mod {
-    #debug("implement find_pre_post_mod!");
-    fail;
-}
-
-fn find_pre_post_native_mod(_m: native_mod) -> native_mod {
-    #debug("implement find_pre_post_native_mod");
-    fail;
-}
-
-fn find_pre_post_method(ccx: crate_ctxt, m: @method) {
-    assert (ccx.fm.contains_key(m.id));
-    let fcx: fn_ctxt =
-        {enclosing: ccx.fm.get(m.id),
-         id: m.id,
-         name: m.ident,
-         ccx: ccx};
-    find_pre_post_fn(fcx, m.body);
-}
-
-fn find_pre_post_item(ccx: crate_ctxt, i: item) {
-    alt i.node {
-      item_const(_, e) {
-          // do nothing -- item_consts don't refer to local vars
-      }
-      item_fn(_, _, body) {
-        assert (ccx.fm.contains_key(i.id));
-        let fcx =
-            {enclosing: ccx.fm.get(i.id), id: i.id, name: i.ident, ccx: ccx};
-        find_pre_post_fn(fcx, body);
-      }
-      item_mod(m) { find_pre_post_mod(m); }
-      item_native_mod(nm) { find_pre_post_native_mod(nm); }
-      item_ty(*) | item_enum(*) | item_iface(*) { ret; }
-      item_res(_, _, body, dtor_id, _, _) {
-        let fcx =
-            {enclosing: ccx.fm.get(dtor_id),
-             id: dtor_id,
-             name: i.ident,
-             ccx: ccx};
-        find_pre_post_fn(fcx, body);
-      }
-      item_class(*) {
-          fail "find_pre_post_item: shouldn't be called on item_class";
-      }
-      item_impl(_, _, _, _, ms) {
-        for ms.each {|m| find_pre_post_method(ccx, m); }
-      }
-    }
-}
-
-
-/* Finds the pre and postcondition for each expr in ;
-   sets the precondition in a to be the result of combining
-   the preconditions for , and the postcondition in a to
-   be the union of all postconditions for  */
-fn find_pre_post_exprs(fcx: fn_ctxt, args: [@expr], id: node_id) {
-    if vec::len::<@expr>(args) > 0u {
-        #debug["find_pre_post_exprs: oper = %s", expr_to_str(args[0])];
-    }
-    fn do_one(fcx: fn_ctxt, e: @expr) { find_pre_post_expr(fcx, e); }
-    for args.each {|e| do_one(fcx, e); }
-
-    fn get_pp(ccx: crate_ctxt, &&e: @expr) -> pre_and_post {
-        ret expr_pp(ccx, e);
-    }
-    let pps = vec::map(args, bind get_pp(fcx.ccx, _));
-
-    set_pre_and_post(fcx.ccx, id, seq_preconds(fcx, pps),
-                     seq_postconds(fcx, vec::map(pps, get_post)));
-}
-
-fn find_pre_post_loop(fcx: fn_ctxt, index: @expr, body: blk, id: node_id) {
-    find_pre_post_expr(fcx, index);
-    find_pre_post_block(fcx, body);
-
-    let loop_precond =
-        seq_preconds(fcx, [expr_pp(fcx.ccx, index), block_pp(fcx.ccx, body)]);
-    let loop_postcond =
-        intersect_states(expr_postcond(fcx.ccx, index),
-                         block_postcond(fcx.ccx, body));
-    copy_pre_post_(fcx.ccx, id, loop_precond, loop_postcond);
-}
-
-// Generates a pre/post assuming that a is the
-// annotation for an if-expression with consequent conseq
-// and alternative maybe_alt
-fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
-                  maybe_alt: option<@expr>, id: node_id, chck: if_ty) {
-    find_pre_post_expr(fcx, antec);
-    find_pre_post_block(fcx, conseq);
-    alt maybe_alt {
-      none {
-        alt chck {
-          if_check {
-            let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec);
-            gen(fcx, antec.id, c.node);
-          }
-          _ { }
-        }
-
-        let precond_res =
-            seq_preconds(fcx,
-                         [expr_pp(fcx.ccx, antec),
-                          block_pp(fcx.ccx, conseq)]);
-        set_pre_and_post(fcx.ccx, id, precond_res,
-                         expr_poststate(fcx.ccx, antec));
-      }
-      some(altern) {
-        /*
-          if check = if_check, then
-          be sure that the predicate implied by antec
-          is *not* true in the alternative
-         */
-        find_pre_post_expr(fcx, altern);
-        let precond_false_case =
-            seq_preconds(fcx,
-                         [expr_pp(fcx.ccx, antec), expr_pp(fcx.ccx, altern)]);
-        let postcond_false_case =
-            seq_postconds(fcx,
-                          [expr_postcond(fcx.ccx, antec),
-                           expr_postcond(fcx.ccx, altern)]);
-
-        /* Be sure to set the bit for the check condition here,
-         so that it's *not* set in the alternative. */
-        alt chck {
-          if_check {
-            let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec);
-            gen(fcx, antec.id, c.node);
-          }
-          _ { }
-        }
-        let precond_true_case =
-            seq_preconds(fcx,
-                         [expr_pp(fcx.ccx, antec),
-                          block_pp(fcx.ccx, conseq)]);
-        let postcond_true_case =
-            seq_postconds(fcx,
-                          [expr_postcond(fcx.ccx, antec),
-                           block_postcond(fcx.ccx, conseq)]);
-
-        let precond_res =
-            seq_postconds(fcx, [precond_true_case, precond_false_case]);
-        let postcond_res =
-            intersect_states(postcond_true_case, postcond_false_case);
-        set_pre_and_post(fcx.ccx, id, precond_res, postcond_res);
-      }
-    }
-}
-
-fn gen_if_local(fcx: fn_ctxt, lhs: @expr, rhs: @expr, larger_id: node_id,
-                new_var: node_id) {
-    alt node_id_to_def(fcx.ccx, new_var) {
-      some(d) {
-        alt d {
-          def_local(nid, _) {
-            find_pre_post_expr(fcx, rhs);
-            let p = expr_pp(fcx.ccx, rhs);
-            set_pre_and_post(fcx.ccx, larger_id, p.precondition,
-                             p.postcondition);
-          }
-          _ { find_pre_post_exprs(fcx, [lhs, rhs], larger_id); }
-        }
-      }
-      _ { find_pre_post_exprs(fcx, [lhs, rhs], larger_id); }
-    }
-}
-
-fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr,
-                 ty: oper_type) {
-    find_pre_post_expr(fcx, rhs);
-    alt lhs.node {
-      expr_path(p) {
-        let post = expr_postcond(fcx.ccx, parent);
-        let tmp = tritv_clone(post);
-
-        alt ty {
-          oper_move {
-            if is_path(rhs) { forget_in_postcond(fcx, parent.id, rhs.id); }
-          }
-          oper_swap {
-            forget_in_postcond(fcx, parent.id, lhs.id);
-            forget_in_postcond(fcx, parent.id, rhs.id);
-          }
-          oper_assign {
-            forget_in_postcond(fcx, parent.id, lhs.id);
-          }
-          _ { }
-        }
-
-        gen_if_local(fcx, lhs, rhs, parent.id, lhs.id);
-        alt rhs.node {
-          expr_path(p1) {
-            let d = local_node_id_to_local_def_id(fcx, lhs.id);
-            let d1 = local_node_id_to_local_def_id(fcx, rhs.id);
-            alt d {
-              some(id) {
-                alt d1 {
-                  some(id1) {
-                    let instlhs =
-                        {ident: path_to_ident(p), node: id};
-                    let instrhs =
-                        {ident: path_to_ident(p1), node: id1};
-                    copy_in_poststate_two(fcx, tmp, post, instlhs, instrhs,
-                                          ty);
-                  }
-                  _ { }
-                }
-              }
-              _ { }
-            }
-          }
-          _ {/* do nothing */ }
-        }
-      }
-      _ { find_pre_post_expr(fcx, lhs); }
-    }
-}
-
-fn forget_args_moved_in(fcx: fn_ctxt, parent: @expr, modes: [mode],
-                        operands: [@expr]) {
-    vec::iteri(modes) {|i,mode|
-        alt ty::resolved_mode(fcx.ccx.tcx, mode) {
-          by_move { forget_in_postcond(fcx, parent.id, operands[i].id); }
-          by_ref | by_val | by_mutbl_ref | by_copy { }
-        }
-    }
-}
-
-fn find_pre_post_expr_fn_upvars(fcx: fn_ctxt, e: @expr) {
-    let rslt = expr_pp(fcx.ccx, e);
-    clear_pp(rslt);
-}
-
-/* Fills in annotations as a side effect. Does not rebuild the expr */
-fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
-    let enclosing = fcx.enclosing;
-    let num_local_vars = num_constraints(enclosing);
-    fn do_rand_(fcx: fn_ctxt, e: @expr) { find_pre_post_expr(fcx, e); }
-
-
-    alt e.node {
-      expr_call(operator, operands, _) {
-        /* copy */
-
-        let mut args = operands;
-        args += [operator];
-
-        find_pre_post_exprs(fcx, args, e.id);
-        /* see if the call has any constraints on its type */
-        for constraints_expr(fcx.ccx.tcx, operator).each {|c|
-            let i =
-                bit_num(fcx, substitute_constr_args(fcx.ccx.tcx, args, c));
-            require(i, expr_pp(fcx.ccx, e));
-        }
-
-        forget_args_moved_in(fcx, e, callee_modes(fcx, operator.id),
-                             operands);
-
-        /* if this is a failing call, its postcondition sets everything */
-        alt controlflow_expr(fcx.ccx, operator) {
-          noreturn { set_postcond_false(fcx.ccx, e.id); }
-          _ { }
-        }
-      }
-      expr_vstore(ee, _) {
-        find_pre_post_expr(fcx, ee);
-        let p = expr_pp(fcx.ccx, ee);
-        set_pre_and_post(fcx.ccx, e.id, p.precondition, p.postcondition);
-      }
-      expr_vec(args, _) {
-        find_pre_post_exprs(fcx, args, e.id);
-      }
-      expr_path(p) {
-        let rslt = expr_pp(fcx.ccx, e);
-        clear_pp(rslt);
-      }
-      expr_new(p, _, v) {
-        find_pre_post_exprs(fcx, [p, v], e.id);
-      }
-      expr_log(_, lvl, arg) {
-        find_pre_post_exprs(fcx, [lvl, arg], e.id);
-      }
-      expr_fn(_, _, _, cap_clause) | expr_fn_block(_, _, cap_clause) {
-        find_pre_post_expr_fn_upvars(fcx, e);
-
-        for (*cap_clause).each { |cap_item|
-            let d = local_node_id_to_local_def_id(fcx, cap_item.id);
-            option::iter(d, { |id| use_var(fcx, id) });
-        }
-
-        for (*cap_clause).each { |cap_item|
-            if cap_item.is_move {
-                log(debug, ("forget_in_postcond: ", cap_item));
-                forget_in_postcond(fcx, e.id, cap_item.id);
-            }
-        }
-      }
-      expr_block(b) {
-        find_pre_post_block(fcx, b);
-        let p = block_pp(fcx.ccx, b);
-        set_pre_and_post(fcx.ccx, e.id, p.precondition, p.postcondition);
-      }
-      expr_rec(fields, maybe_base) {
-        let mut es = field_exprs(fields);
-        alt maybe_base { none {/* no-op */ } some(b) { es += [b]; } }
-        find_pre_post_exprs(fcx, es, e.id);
-      }
-      expr_tup(elts) { find_pre_post_exprs(fcx, elts, e.id); }
-      expr_move(lhs, rhs) { handle_update(fcx, e, lhs, rhs, oper_move); }
-      expr_swap(lhs, rhs) { handle_update(fcx, e, lhs, rhs, oper_swap); }
-      expr_assign(lhs, rhs) { handle_update(fcx, e, lhs, rhs, oper_assign); }
-      expr_assign_op(_, lhs, rhs) {
-        /* Different from expr_assign in that the lhs *must*
-           already be initialized */
-
-        find_pre_post_exprs(fcx, [lhs, rhs], e.id);
-        forget_in_postcond(fcx, e.id, lhs.id);
-      }
-      expr_lit(_) { clear_pp(expr_pp(fcx.ccx, e)); }
-      expr_ret(maybe_val) {
-        alt maybe_val {
-          none {
-            clear_precond(fcx.ccx, e.id);
-            set_postcond_false(fcx.ccx, e.id);
-          }
-          some(ret_val) {
-            find_pre_post_expr(fcx, ret_val);
-            set_precondition(node_id_to_ts_ann(fcx.ccx, e.id),
-                             expr_precond(fcx.ccx, ret_val));
-            set_postcond_false(fcx.ccx, e.id);
-          }
-        }
-      }
-      expr_if(antec, conseq, maybe_alt) {
-        join_then_else(fcx, antec, conseq, maybe_alt, e.id, plain_if);
-      }
-      expr_binary(bop, l, r) {
-        if lazy_binop(bop) {
-            find_pre_post_expr(fcx, l);
-            find_pre_post_expr(fcx, r);
-            let overall_pre =
-                seq_preconds(fcx, [expr_pp(fcx.ccx, l), expr_pp(fcx.ccx, r)]);
-            set_precondition(node_id_to_ts_ann(fcx.ccx, e.id), overall_pre);
-            set_postcondition(node_id_to_ts_ann(fcx.ccx, e.id),
-                              expr_postcond(fcx.ccx, l));
-        } else { find_pre_post_exprs(fcx, [l, r], e.id); }
-      }
-      expr_addr_of(_, x) | expr_cast(x, _) | expr_unary(_, x) |
-      expr_loop_body(x) | expr_assert(x) | expr_copy(x) {
-        find_pre_post_expr(fcx, x);
-        copy_pre_post(fcx.ccx, e.id, x);
-      }
-      expr_while(test, body) {
-        find_pre_post_expr(fcx, test);
-        find_pre_post_block(fcx, body);
-        set_pre_and_post(fcx.ccx, e.id,
-                         seq_preconds(fcx,
-                                      [expr_pp(fcx.ccx, test),
-                                       block_pp(fcx.ccx, body)]),
-                         intersect_states(expr_postcond(fcx.ccx, test),
-                                          block_postcond(fcx.ccx, body)));
-      }
-      expr_loop(body) {
-        find_pre_post_block(fcx, body);
-        /* Infinite loop: if control passes it, everything is true. */
-        let mut loop_postcond = false_postcond(num_local_vars);
-        /* Conservative approximation: if the body has any nonlocal exits,
-         the poststate is blank since we don't know what parts of it
-          execute. */
-        if has_nonlocal_exits(body) {
-            loop_postcond = empty_poststate(num_local_vars);
-        }
-        set_pre_and_post(fcx.ccx, e.id, block_precond(fcx.ccx, body),
-                         loop_postcond);
-      }
-      expr_index(val, sub) { find_pre_post_exprs(fcx, [val, sub], e.id); }
-      expr_alt(ex, alts, _) {
-        find_pre_post_expr(fcx, ex);
-        fn do_an_alt(fcx: fn_ctxt, an_alt: arm) -> pre_and_post {
-            alt an_alt.guard {
-              some(e) { find_pre_post_expr(fcx, e); }
-              _ {}
-            }
-            find_pre_post_block(fcx, an_alt.body);
-            ret block_pp(fcx.ccx, an_alt.body);
-        }
-        let mut alt_pps = [];
-        for alts.each {|a| alt_pps += [do_an_alt(fcx, a)]; }
-        fn combine_pp(antec: pre_and_post, fcx: fn_ctxt, &&pp: pre_and_post,
-                      &&next: pre_and_post) -> pre_and_post {
-            union(pp.precondition, seq_preconds(fcx, [antec, next]));
-            intersect(pp.postcondition, next.postcondition);
-            ret pp;
-        }
-        let antec_pp = pp_clone(expr_pp(fcx.ccx, ex));
-        let e_pp =
-            {precondition: empty_prestate(num_local_vars),
-             postcondition: false_postcond(num_local_vars)};
-        let g = bind combine_pp(antec_pp, fcx, _, _);
-        let alts_overall_pp =
-            vec::foldl(e_pp, alt_pps, g);
-        set_pre_and_post(fcx.ccx, e.id, alts_overall_pp.precondition,
-                         alts_overall_pp.postcondition);
-      }
-      expr_field(operator, _, _) {
-        find_pre_post_expr(fcx, operator);
-        copy_pre_post(fcx.ccx, e.id, operator);
-      }
-      expr_fail(maybe_val) {
-        let mut prestate;
-        alt maybe_val {
-          none { prestate = empty_prestate(num_local_vars); }
-          some(fail_val) {
-            find_pre_post_expr(fcx, fail_val);
-            prestate = expr_precond(fcx.ccx, fail_val);
-          }
-        }
-        set_pre_and_post(fcx.ccx, e.id,
-                         /* if execution continues after fail,
-                            then everything is true! */
-                         prestate, false_postcond(num_local_vars));
-      }
-      expr_check(_, p) {
-        find_pre_post_expr(fcx, p);
-        copy_pre_post(fcx.ccx, e.id, p);
-        /* predicate p holds after this expression executes */
-
-        let c: sp_constr = expr_to_constr(fcx.ccx.tcx, p);
-        gen(fcx, e.id, c.node);
-      }
-      expr_if_check(p, conseq, maybe_alt) {
-        join_then_else(fcx, p, conseq, maybe_alt, e.id, if_check);
-      }
-      expr_bind(operator, maybe_args) {
-        let mut args = [];
-        let mut cmodes = callee_modes(fcx, operator.id);
-        let mut modes = [];
-        let mut i = 0;
-        for maybe_args.each {|expr_opt|
-            alt expr_opt {
-              none {/* no-op */ }
-              some(expr) { modes += [cmodes[i]]; args += [expr]; }
-            }
-            i += 1;
-        }
-        args += [operator]; /* ??? order of eval? */
-        forget_args_moved_in(fcx, e, modes, args);
-        find_pre_post_exprs(fcx, args, e.id);
-      }
-      expr_break { clear_pp(expr_pp(fcx.ccx, e)); }
-      expr_cont { clear_pp(expr_pp(fcx.ccx, e)); }
-      expr_mac(_) { fcx.ccx.tcx.sess.bug("unexpanded macro"); }
-    }
-}
-
-fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) {
-    #debug["stmt = %s", stmt_to_str(s)];
-    alt s.node {
-      stmt_decl(adecl, id) {
-        alt adecl.node {
-          decl_local(alocals) {
-            let prev_pp = empty_pre_post(num_constraints(fcx.enclosing));
-            for alocals.each {|alocal|
-                alt alocal.node.init {
-                  some(an_init) {
-                    /* LHS always becomes initialized,
-                     whether or not this is a move */
-                    find_pre_post_expr(fcx, an_init.expr);
-                    pat_bindings(fcx.ccx.tcx.def_map, alocal.node.pat)
-                        {|p_id, _s, _n|
-                        copy_pre_post(fcx.ccx, p_id, an_init.expr);
-                    };
-                    /* Inherit ann from initializer, and add var being
-                       initialized to the postcondition */
-                    copy_pre_post(fcx.ccx, id, an_init.expr);
-
-                    let mut p = none;
-                    alt an_init.expr.node {
-                      expr_path(_p) { p = some(_p); }
-                      _ { }
-                    }
-
-                    pat_bindings(fcx.ccx.tcx.def_map, alocal.node.pat)
-                        {|p_id, _s, n|
-                        let ident = path_to_ident(n);
-                        alt p {
-                          some(p) {
-                            copy_in_postcond(fcx, id,
-                                             {ident: ident, node: p_id},
-                                             {ident:
-                                                  path_to_ident(p),
-                                              node: an_init.expr.id},
-                                             op_to_oper_ty(an_init.op));
-                          }
-                          none { }
-                        }
-                    };
-
-                    /* Clear out anything that the previous initializer
-                    guaranteed */
-                    let e_pp = expr_pp(fcx.ccx, an_init.expr);
-                    tritv_copy(prev_pp.precondition,
-                               seq_preconds(fcx, [prev_pp, e_pp]));
-
-                    /* Include the LHSs too, since those aren't in the
-                     postconds of the RHSs themselves */
-                    copy_pre_post_(fcx.ccx, id, prev_pp.precondition,
-                                   prev_pp.postcondition);
-                  }
-                  none {
-                    pat_bindings(fcx.ccx.tcx.def_map, alocal.node.pat)
-                        {|p_id, _s, _n|
-                        clear_pp(node_id_to_ts_ann(fcx.ccx, p_id).conditions);
-                    };
-                    clear_pp(node_id_to_ts_ann(fcx.ccx, id).conditions);
-                  }
-                }
-            }
-          }
-          decl_item(anitem) {
-            clear_pp(node_id_to_ts_ann(fcx.ccx, id).conditions);
-            find_pre_post_item(fcx.ccx, *anitem);
-          }
-        }
-      }
-      stmt_expr(e, id) | stmt_semi(e, id) {
-        find_pre_post_expr(fcx, e);
-        copy_pre_post(fcx.ccx, id, e);
-      }
-    }
-}
-
-fn find_pre_post_block(fcx: fn_ctxt, b: blk) {
-    /* Want to say that if there is a break or cont in this
-     block, then that invalidates the poststate upheld by
-    any of the stmts after it.
-    Given that the typechecker has run, we know any break will be in
-    a block that forms a loop body. So that's ok. There'll never be an
-    expr_break outside a loop body, therefore, no expr_break outside a block.
-    */
-
-    /* Conservative approximation for now: This says that if a block contains
-     *any* breaks or conts, then its postcondition doesn't promise anything.
-     This will mean that:
-     x = 0;
-     break;
-
-     won't have a postcondition that says x is initialized, but that's ok.
-     */
-
-    let nv = num_constraints(fcx.enclosing);
-    fn do_one_(fcx: fn_ctxt, s: @stmt) {
-        find_pre_post_stmt(fcx, *s);
-    }
-    for b.node.stmts.each {|s| do_one_(fcx, s); }
-    fn do_inner_(fcx: fn_ctxt, &&e: @expr) { find_pre_post_expr(fcx, e); }
-    let do_inner = bind do_inner_(fcx, _);
-    option::map::<@expr, ()>(b.node.expr, do_inner);
-
-    let mut pps: [pre_and_post] = [];
-    for b.node.stmts.each {|s| pps += [stmt_pp(fcx.ccx, *s)]; }
-    alt b.node.expr {
-      none {/* no-op */ }
-      some(e) { pps += [expr_pp(fcx.ccx, e)]; }
-    }
-
-    let block_precond = seq_preconds(fcx, pps);
-
-    let mut postconds = [];
-    for pps.each {|pp| postconds += [get_post(pp)]; }
-
-    /* A block may be empty, so this next line ensures that the postconds
-       vector is non-empty. */
-    postconds += [block_precond];
-
-    let mut block_postcond = empty_poststate(nv);
-    /* conservative approximation */
-
-    if !has_nonlocal_exits(b) {
-        block_postcond = seq_postconds(fcx, postconds);
-    }
-    set_pre_and_post(fcx.ccx, b.node.id, block_precond, block_postcond);
-}
-
-fn find_pre_post_fn(fcx: fn_ctxt, body: blk) {
-    find_pre_post_block(fcx, body);
-
-    // Treat the tail expression as a return statement
-    alt body.node.expr {
-      some(tailexpr) { set_postcond_false(fcx.ccx, tailexpr.id); }
-      none {/* fallthrough */ }
-    }
-}
-
-fn fn_pre_post(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
-               id: node_id,
-               ccx: crate_ctxt, v: visit::vt) {
-
-    visit::visit_fn(fk, decl, body, sp, id, ccx, v);
-    assert (ccx.fm.contains_key(id));
-    if !ccx.fm.get(id).ignore {
-        let fcx =
-            {enclosing: ccx.fm.get(id),
-             id: id,
-             name: visit::name_of_fn(fk),
-             ccx: ccx};
-        find_pre_post_fn(fcx, body);
-    }
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/tstate/states.rs b/src/rustc/middle/tstate/states.rs
deleted file mode 100644
index 2b39288152b17..0000000000000
--- a/src/rustc/middle/tstate/states.rs
+++ /dev/null
@@ -1,631 +0,0 @@
-import ann::*;
-import aux::*;
-import tritv::{tritv_clone, tritv_set, ttrue};
-
-import syntax::print::pprust::block_to_str;
-import bitvectors::*;
-import pat_util::*;
-import syntax::ast::*;
-import syntax::ast_util::*;
-import syntax::print::pprust::{expr_to_str, stmt_to_str};
-import syntax::codemap::span;
-import middle::ty::{expr_ty, type_is_bot};
-import util::common::{field_exprs, has_nonlocal_exits, may_break};
-import driver::session::session;
-import std::map::hashmap;
-
-fn forbid_upvar(fcx: fn_ctxt, rhs_id: node_id, sp: span, t: oper_type) {
-    alt t {
-      oper_move {
-        alt local_node_id_to_def(fcx, rhs_id) {
-          some(def_upvar(_, _, _)) {
-            fcx.ccx.tcx.sess.span_err(sp,
-                                      "tried to deinitialize a variable \
-              declared in a different scope");
-          }
-          _ { }
-        }
-      }
-      _ {/* do nothing */ }
-    }
-}
-
-fn handle_move_or_copy(fcx: fn_ctxt, post: poststate, rhs_path: @path,
-                       rhs_id: node_id, destlhs: dest, init_op: init_op) {
-    forbid_upvar(fcx, rhs_id, rhs_path.span, op_to_oper_ty(init_op));
-
-    let rhs_d_id = local_node_id_to_def_id(fcx, rhs_id);
-    alt rhs_d_id {
-      some(rhsid) {
-        // RHS is a local var
-        let instrhs =
-            {ident: path_to_ident(rhs_path), node: rhsid.node};
-        alt destlhs {
-          local_dest(instlhs) {
-             copy_in_poststate(fcx, post, instlhs, instrhs,
-                               op_to_oper_ty(init_op));
-          }
-          _ {}
-        }
-      }
-      _ {
-        // not a local -- do nothing
-      }
-    }
-}
-
-fn seq_states(fcx: fn_ctxt, pres: prestate, bindings: [binding]) ->
-   {changed: bool, post: poststate} {
-    let mut changed = false;
-    let mut post = tritv_clone(pres);
-    for bindings.each {|b|
-        alt b.rhs {
-          some(an_init) {
-            // an expression, with or without a destination
-            changed |=
-                find_pre_post_state_expr(fcx, post, an_init.expr) || changed;
-            post = tritv_clone(expr_poststate(fcx.ccx, an_init.expr));
-            for b.lhs.each {|d|
-                alt an_init.expr.node {
-                  expr_path(p) {
-                    handle_move_or_copy(fcx, post, p, an_init.expr.id, d,
-                                        an_init.op);
-                  }
-                  _ { }
-                }
-            }
-
-            // Forget the RHS if we just moved it.
-            if an_init.op == init_move {
-                forget_in_poststate(fcx, post, an_init.expr.id);
-            }
-          }
-          none {
-          }
-        }
-    }
-    ret {changed: changed, post: post};
-}
-
-fn find_pre_post_state_sub(fcx: fn_ctxt, pres: prestate, e: @expr,
-                           parent: node_id, c: option) -> bool {
-    let mut changed = find_pre_post_state_expr(fcx, pres, e);
-
-    changed = set_prestate_ann(fcx.ccx, parent, pres) || changed;
-
-    let post = tritv_clone(expr_poststate(fcx.ccx, e));
-    alt c {
-      none { }
-      some(c1) { set_in_poststate_(bit_num(fcx, c1), post); }
-    }
-
-    changed = set_poststate_ann(fcx.ccx, parent, post) || changed;
-    ret changed;
-}
-
-fn find_pre_post_state_two(fcx: fn_ctxt, pres: prestate, lhs: @expr,
-                           rhs: @expr, parent: node_id, ty: oper_type) ->
-   bool {
-    let mut changed = set_prestate_ann(fcx.ccx, parent, pres);
-    changed = find_pre_post_state_expr(fcx, pres, lhs) || changed;
-    changed =
-        find_pre_post_state_expr(fcx, expr_poststate(fcx.ccx, lhs), rhs) ||
-            changed;
-    forbid_upvar(fcx, rhs.id, rhs.span, ty);
-
-    let post = tritv_clone(expr_poststate(fcx.ccx, rhs));
-
-    alt lhs.node {
-      expr_path(p) {
-        // for termination, need to make sure intermediate changes don't set
-        // changed flag
-        // tmp remembers "old" constraints we'd otherwise forget,
-        // for substitution purposes
-        let tmp = tritv_clone(post);
-
-        alt ty {
-          oper_move {
-            if is_path(rhs) { forget_in_poststate(fcx, post, rhs.id); }
-            forget_in_poststate(fcx, post, lhs.id);
-          }
-          oper_swap {
-            forget_in_poststate(fcx, post, lhs.id);
-            forget_in_poststate(fcx, post, rhs.id);
-          }
-          _ { forget_in_poststate(fcx, post, lhs.id); }
-        }
-
-        alt rhs.node {
-          expr_path(p1) {
-            let d = local_node_id_to_local_def_id(fcx, lhs.id);
-            let d1 = local_node_id_to_local_def_id(fcx, rhs.id);
-            alt d {
-              some(id) {
-                alt d1 {
-                  some(id1) {
-                    let instlhs =
-                        {ident: path_to_ident(p), node: id};
-                    let instrhs =
-                        {ident: path_to_ident(p1), node: id1};
-                    copy_in_poststate_two(fcx, tmp, post, instlhs, instrhs,
-                                          ty);
-                  }
-                  _ { }
-                }
-              }
-              _ { }
-            }
-          }
-          _ {/* do nothing */ }
-        }
-      }
-      _ { }
-    }
-    changed = set_poststate_ann(fcx.ccx, parent, post) || changed;
-    ret changed;
-}
-
-fn find_pre_post_state_call(fcx: fn_ctxt, pres: prestate, a: @expr,
-                            id: node_id, ops: [init_op], bs: [@expr],
-                            cf: ret_style) -> bool {
-    let mut changed = find_pre_post_state_expr(fcx, pres, a);
-    // FIXME: This could be a typestate constraint (except we're
-    // not using them inside the compiler, I guess... see
-    // discussion at #2178)
-    if vec::len(bs) != vec::len(ops) {
-        fcx.ccx.tcx.sess.span_bug(a.span,
-                                  #fmt["mismatched arg lengths: \
-                                        %u exprs vs. %u ops",
-                                       vec::len(bs), vec::len(ops)]);
-    }
-    ret find_pre_post_state_exprs(fcx, pres, id, ops,
-                                   bs, cf) || changed;
-}
-
-fn find_pre_post_state_exprs(fcx: fn_ctxt, pres: prestate, id: node_id,
-                             ops: [init_op], es: [@expr], cf: ret_style) ->
-   bool {
-    let rs = seq_states(fcx, pres, arg_bindings(ops, es));
-    let mut changed = rs.changed | set_prestate_ann(fcx.ccx, id, pres);
-    /* if this is a failing call, it sets everything as initialized */
-    alt cf {
-      noreturn {
-        let post = false_postcond(num_constraints(fcx.enclosing));
-        changed |= set_poststate_ann(fcx.ccx, id, post);
-      }
-      _ { changed |= set_poststate_ann(fcx.ccx, id, rs.post); }
-    }
-    ret changed;
-}
-
-fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk,
-                  maybe_alt: option<@expr>, id: node_id, chk: if_ty,
-                  pres: prestate) -> bool {
-    let mut changed =
-        set_prestate_ann(fcx.ccx, id, pres) |
-            find_pre_post_state_expr(fcx, pres, antec);
-
-    alt maybe_alt {
-      none {
-        alt chk {
-          if_check {
-            let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec);
-            let conseq_prestate = tritv_clone(expr_poststate(fcx.ccx, antec));
-            tritv_set(bit_num(fcx, c.node), conseq_prestate, ttrue);
-            changed |=
-                find_pre_post_state_block(fcx, conseq_prestate, conseq) |
-                    set_poststate_ann(fcx.ccx, id,
-                                      expr_poststate(fcx.ccx, antec));
-          }
-          _ {
-            changed |=
-                find_pre_post_state_block(fcx, expr_poststate(fcx.ccx, antec),
-                                          conseq) |
-                    set_poststate_ann(fcx.ccx, id,
-                                      expr_poststate(fcx.ccx, antec));
-          }
-        }
-      }
-      some(altern) {
-        changed |=
-            find_pre_post_state_expr(fcx, expr_poststate(fcx.ccx, antec),
-                                     altern);
-
-        let mut conseq_prestate = expr_poststate(fcx.ccx, antec);
-        alt chk {
-          if_check {
-            let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec);
-            conseq_prestate = tritv_clone(conseq_prestate);
-            tritv_set(bit_num(fcx, c.node), conseq_prestate, ttrue);
-          }
-          _ { }
-        }
-
-
-        changed |= find_pre_post_state_block(fcx, conseq_prestate, conseq);
-
-        let poststate_res =
-            intersect_states(block_poststate(fcx.ccx, conseq),
-                             expr_poststate(fcx.ccx, altern));
-        /*
-           fcx.ccx.tcx.sess.span_note(antec.span,
-           "poststate_res = " + aux::tritv_to_str(fcx, poststate_res));
-        fcx.ccx.tcx.sess.span_note(antec.span,
-           "altern poststate = " +
-            aux::tritv_to_str(fcx, expr_poststate(fcx.ccx, altern)));
-        fcx.ccx.tcx.sess.span_note(antec.span,
-        "conseq poststate = " + aux::tritv_to_str(fcx,
-           block_poststate(fcx.ccx, conseq)));
-        */
-
-        changed |= set_poststate_ann(fcx.ccx, id, poststate_res);
-      }
-    }
-    ret changed;
-}
-
-fn find_pre_post_state_cap_clause(fcx: fn_ctxt, e_id: node_id,
-                                  pres: prestate, cap_clause: capture_clause)
-    -> bool
-{
-    let ccx = fcx.ccx;
-    let pres_changed = set_prestate_ann(ccx, e_id, pres);
-    let post = tritv_clone(pres);
-    for (*cap_clause).each { |cap_item|
-        if cap_item.is_move {
-            forget_in_poststate(fcx, post, cap_item.id);
-        }
-    }
-    ret set_poststate_ann(ccx, e_id, post) || pres_changed;
-}
-
-fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
-    let num_constrs = num_constraints(fcx.enclosing);
-
-    alt e.node {
-      expr_new(p, _, v) {
-        ret find_pre_post_state_two(fcx, pres, p, v, e.id, oper_pure);
-      }
-      expr_vstore(ee, _) {
-        let mut changed = find_pre_post_state_expr(fcx, pres, ee);
-        set_prestate_ann(fcx.ccx, e.id, expr_prestate(fcx.ccx, ee));
-        set_poststate_ann(fcx.ccx, e.id, expr_poststate(fcx.ccx, ee));
-        ret changed;
-      }
-      expr_vec(elts, _) {
-        ret find_pre_post_state_exprs(fcx, pres, e.id,
-                                      vec::from_elem(vec::len(elts),
-                                                    init_assign), elts,
-                                      return_val);
-      }
-      expr_call(operator, operands, _) {
-        #debug["hey it's a call: %s", expr_to_str(e)];
-        ret find_pre_post_state_call(fcx, pres, operator, e.id,
-                                     callee_arg_init_ops(fcx, operator.id),
-                                     operands,
-                                     controlflow_expr(fcx.ccx, operator));
-      }
-      expr_bind(operator, maybe_args) {
-        let mut args = [];
-        let callee_ops = callee_arg_init_ops(fcx, operator.id);
-        let mut ops = [];
-        let mut i = 0;
-        for maybe_args.each {|a_opt|
-            alt a_opt {
-              none {/* no-op */ }
-              some(a) { ops += [callee_ops[i]]; args += [a]; }
-            }
-            i += 1;
-        }
-        ret find_pre_post_state_call(fcx, pres, operator, e.id, ops, args,
-                                     return_val);
-      }
-      expr_path(_) { ret pure_exp(fcx.ccx, e.id, pres); }
-      expr_log(_, lvl, ex) {
-        ret find_pre_post_state_two(fcx, pres, lvl, ex, e.id, oper_pure);
-      }
-      expr_mac(_) { fcx.ccx.tcx.sess.bug("unexpanded macro"); }
-      expr_lit(l) { ret pure_exp(fcx.ccx, e.id, pres); }
-      expr_fn(_, _, _, cap_clause) {
-        ret find_pre_post_state_cap_clause(fcx, e.id, pres, cap_clause);
-      }
-      expr_fn_block(_, _, cap_clause) {
-        ret find_pre_post_state_cap_clause(fcx, e.id, pres, cap_clause);
-      }
-      expr_block(b) {
-        ret find_pre_post_state_block(fcx, pres, b) |
-                set_prestate_ann(fcx.ccx, e.id, pres) |
-                set_poststate_ann(fcx.ccx, e.id, block_poststate(fcx.ccx, b));
-      }
-      expr_rec(fields, maybe_base) {
-        let exs = field_exprs(fields);
-        let mut changed =
-            find_pre_post_state_exprs(fcx, pres, e.id,
-                                      vec::from_elem(vec::len(fields),
-                                                    init_assign),
-                                      exs, return_val);
-
-        let base_pres = alt vec::last_opt(exs) { none { pres }
-                          some(f) { expr_poststate(fcx.ccx, f) }};
-        option::iter(maybe_base, {|base|
-            changed |= find_pre_post_state_expr(fcx, base_pres, base) |
-              set_poststate_ann(fcx.ccx, e.id,
-                                expr_poststate(fcx.ccx, base))});
-        ret changed;
-      }
-      expr_tup(elts) {
-        ret find_pre_post_state_exprs(fcx, pres, e.id,
-                                      vec::from_elem(vec::len(elts),
-                                                    init_assign), elts,
-                                      return_val);
-      }
-      expr_move(lhs, rhs) {
-        ret find_pre_post_state_two(fcx, pres, lhs, rhs, e.id, oper_move);
-      }
-      expr_assign(lhs, rhs) {
-        ret find_pre_post_state_two(fcx, pres, lhs, rhs, e.id, oper_assign);
-      }
-      expr_swap(lhs, rhs) {
-        ret find_pre_post_state_two(fcx, pres, lhs, rhs, e.id, oper_swap);
-        // Could be more precise and actually swap the role of
-        // lhs and rhs in constraints
-      }
-      expr_ret(maybe_ret_val) {
-        let mut changed = set_prestate_ann(fcx.ccx, e.id, pres);
-        /* everything is true if execution continues after
-           a ret expression (since execution never continues locally
-           after a ret expression */
-        let post = false_postcond(num_constrs);
-
-        set_poststate_ann(fcx.ccx, e.id, post);
-
-        alt maybe_ret_val {
-          none {/* do nothing */ }
-          some(ret_val) {
-            changed |= find_pre_post_state_expr(fcx, pres, ret_val);
-          }
-        }
-        ret changed;
-      }
-      expr_if(antec, conseq, maybe_alt) {
-        ret join_then_else(fcx, antec, conseq, maybe_alt, e.id, plain_if,
-                           pres);
-      }
-      expr_binary(bop, l, r) {
-        if lazy_binop(bop) {
-            let mut changed = find_pre_post_state_expr(fcx, pres, l);
-            changed |=
-                find_pre_post_state_expr(fcx, expr_poststate(fcx.ccx, l), r);
-            ret changed | set_prestate_ann(fcx.ccx, e.id, pres) |
-                    set_poststate_ann(fcx.ccx, e.id,
-                                      expr_poststate(fcx.ccx, l));
-        } else {
-            ret find_pre_post_state_two(fcx, pres, l, r, e.id, oper_pure);
-        }
-      }
-      expr_assign_op(op, lhs, rhs) {
-        ret find_pre_post_state_two(fcx, pres, lhs, rhs, e.id,
-                                    oper_assign_op);
-      }
-      expr_while(test, body) {
-        let loop_pres =
-            intersect_states(block_poststate(fcx.ccx, body), pres);
-
-        let mut changed =
-            set_prestate_ann(fcx.ccx, e.id, loop_pres) |
-                find_pre_post_state_expr(fcx, loop_pres, test) |
-                find_pre_post_state_block(fcx, expr_poststate(fcx.ccx, test),
-                                          body);
-
-        /* conservative approximation: if a loop contains a break
-           or cont, we assume nothing about the poststate */
-        /* which is still unsound -- see [Break-unsound] */
-        if has_nonlocal_exits(body) {
-            ret changed | set_poststate_ann(fcx.ccx, e.id, pres);
-        } else {
-            let e_post = expr_poststate(fcx.ccx, test);
-            let b_post = block_poststate(fcx.ccx, body);
-            ret changed |
-                    set_poststate_ann(fcx.ccx, e.id,
-                                      intersect_states(e_post, b_post));
-        }
-      }
-      expr_loop(body) {
-        let loop_pres =
-            intersect_states(block_poststate(fcx.ccx, body), pres);
-        let mut changed = set_prestate_ann(fcx.ccx, e.id, loop_pres)
-              | find_pre_post_state_block(fcx, loop_pres, body);
-        /* conservative approximation: if a loop contains a break
-           or cont, we assume nothing about the poststate (so, we
-           set all predicates to "don't know" */
-        /* which is still unsound -- see [Break-unsound] */
-        if may_break(body) {
-                /* Only do this if there are *breaks* not conts.
-                 An infinite loop with conts is still an infinite loop.
-                We assume all preds are FALSE, not '?' -- because in the
-                worst case, the body could invalidate all preds and
-                deinitialize everything before breaking */
-            let post = empty_poststate(num_constrs);
-            tritv::tritv_kill(post);
-            ret changed | set_poststate_ann(fcx.ccx, e.id, post);
-        } else {
-            ret changed | set_poststate_ann(fcx.ccx, e.id,
-                                            false_postcond(num_constrs));
-        }
-      }
-      expr_index(val, sub) {
-        ret find_pre_post_state_two(fcx, pres, val, sub, e.id, oper_pure);
-      }
-      expr_alt(val, alts, _) {
-        let mut changed =
-            set_prestate_ann(fcx.ccx, e.id, pres) |
-                find_pre_post_state_expr(fcx, pres, val);
-        let e_post = expr_poststate(fcx.ccx, val);
-        let mut a_post;
-        if vec::len(alts) > 0u {
-            a_post = false_postcond(num_constrs);
-            for alts.each {|an_alt|
-                alt an_alt.guard {
-                  some(e) {
-                    changed |= find_pre_post_state_expr(fcx, e_post, e);
-                  }
-                  _ {}
-                }
-                changed |=
-                    find_pre_post_state_block(fcx, e_post, an_alt.body);
-                intersect(a_post, block_poststate(fcx.ccx, an_alt.body));
-                // We deliberately do *not* update changed here, because
-                // we'd go into an infinite loop that way, and the change
-                // gets made after the if expression.
-
-            }
-        } else {
-            // No alts; poststate is the poststate of the test
-
-            a_post = e_post;
-        }
-        ret changed | set_poststate_ann(fcx.ccx, e.id, a_post);
-      }
-      expr_field(x, _, _) | expr_loop_body(x) | expr_unary(_, x) |
-      expr_addr_of(_, x) | expr_assert(x) | expr_cast(x, _) |
-      expr_copy(x) {
-        ret find_pre_post_state_sub(fcx, pres, x, e.id, none);
-      }
-      expr_fail(maybe_fail_val) {
-        /* if execution continues after fail, then everything is true!
-        woo! */
-        let post = false_postcond(num_constrs);
-        ret set_prestate_ann(fcx.ccx, e.id, pres) |
-                set_poststate_ann(fcx.ccx, e.id, post) |
-                option::map_default(maybe_fail_val, false, {|fail_val|
-                        find_pre_post_state_expr(fcx, pres, fail_val)});
-      }
-      expr_check(_, p) {
-        /* predicate p holds after this expression executes */
-        let c: sp_constr = expr_to_constr(fcx.ccx.tcx, p);
-        ret find_pre_post_state_sub(fcx, pres, p, e.id, some(c.node));
-      }
-      expr_if_check(p, conseq, maybe_alt) {
-        ret join_then_else(fcx, p, conseq, maybe_alt, e.id, if_check, pres);
-      }
-      expr_break { ret pure_exp(fcx.ccx, e.id, pres); }
-      expr_cont { ret pure_exp(fcx.ccx, e.id, pres); }
-    }
-}
-
-fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
-    let stmt_ann = stmt_to_ann(fcx.ccx, *s);
-
-    #debug["[ %s ]", *fcx.name];
-    #debug["*At beginning: stmt = %s", stmt_to_str(*s)];
-    #debug["*prestate = %s", tritv::to_str(stmt_ann.states.prestate)];
-    #debug["*poststate = %s", tritv::to_str(stmt_ann.states.prestate)];
-
-    alt s.node {
-      stmt_decl(adecl, id) {
-        alt adecl.node {
-          decl_local(alocals) {
-            set_prestate(stmt_ann, pres);
-            let c_and_p = seq_states(fcx, pres,
-                  locals_to_bindings(fcx.ccx.tcx, alocals));
-            /* important to do this in one step to ensure
-            termination (don't want to set changed to true
-            for intermediate changes) */
-
-            let mut changed =
-                set_poststate(stmt_ann, c_and_p.post) | c_and_p.changed;
-
-            #debug["Summary: stmt = %s", stmt_to_str(*s)];
-            #debug["prestate = %s", tritv::to_str(stmt_ann.states.prestate)];
-            #debug["poststate = %s",tritv::to_str(stmt_ann.states.poststate)];
-            #debug["changed = %s", bool::to_str(changed)];
-
-            ret changed;
-          }
-          decl_item(an_item) {
-            ret set_prestate(stmt_ann, pres) | set_poststate(stmt_ann, pres);
-            /* the outer visitor will recurse into the item */
-          }
-        }
-      }
-      stmt_expr(ex, _) | stmt_semi(ex, _) {
-        let mut changed =
-            find_pre_post_state_expr(fcx, pres, ex) |
-                set_prestate(stmt_ann, expr_prestate(fcx.ccx, ex)) |
-                set_poststate(stmt_ann, expr_poststate(fcx.ccx, ex));
-
-
-        #debug["Finally: %s", stmt_to_str(*s)];
-        #debug["prestate = %s", tritv::to_str(stmt_ann.states.prestate)];
-        #debug["poststate = %s", tritv::to_str(stmt_ann.states.poststate)];
-        #debug["changed = %s", bool::to_str(changed)];
-
-        ret changed;
-      }
-    }
-}
-
-
-/* Updates the pre- and post-states of statements in the block,
-   returns a boolean flag saying whether any pre- or poststates changed */
-fn find_pre_post_state_block(fcx: fn_ctxt, pres0: prestate, b: blk) -> bool {
-    /* First, set the pre-states and post-states for every expression */
-
-    let mut pres = pres0;
-    /* Iterate over each stmt. The new prestate is . The poststate
-     consist of improving  with whatever variables this stmt
-     initializes.  Then  becomes the new poststate. */
-
-    let mut changed = false;
-    for b.node.stmts.each {|s|
-        changed |= find_pre_post_state_stmt(fcx, pres, s);
-        pres = stmt_poststate(fcx.ccx, *s);
-    }
-    let mut post = pres;
-    alt b.node.expr {
-      none { }
-      some(e) {
-        changed |= find_pre_post_state_expr(fcx, pres, e);
-        post = expr_poststate(fcx.ccx, e);
-      }
-    }
-
-    set_prestate_ann(fcx.ccx, b.node.id, pres0);
-    set_poststate_ann(fcx.ccx, b.node.id, post);
-
-    ret changed;
-}
-
-fn find_pre_post_state_fn(fcx: fn_ctxt,
-                          f_decl: fn_decl,
-                          f_body: blk) -> bool {
-    // All constraints are considered false until proven otherwise.
-    // This ensures that intersect works correctly.
-    kill_all_prestate(fcx, f_body.node.id);
-
-    // Instantiate any constraints on the arguments so we can use them
-    let block_pre = block_prestate(fcx.ccx, f_body);
-    for f_decl.constraints.each {|c|
-        let tsc = ast_constr_to_ts_constr(fcx.ccx.tcx, f_decl.inputs, c);
-        set_in_prestate_constr(fcx, tsc, block_pre);
-    }
-
-    let mut changed = find_pre_post_state_block(fcx, block_pre, f_body);
-
-    /*
-        #error("find_pre_post_state_fn");
-        log(error, changed);
-        fcx.ccx.tcx.sess.span_note(f_body.span, fcx.name);
-    */
-
-    ret changed;
-}
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/tstate/tritv.rs b/src/rustc/middle/tstate/tritv.rs
deleted file mode 100644
index 546a8ae7deb0a..0000000000000
--- a/src/rustc/middle/tstate/tritv.rs
+++ /dev/null
@@ -1,291 +0,0 @@
-import std::bitv;
-
-export t;
-export create_tritv;
-export tritv_clone;
-export tritv_set;
-export to_vec;
-export trit;
-export dont_care;
-export ttrue;
-export tfalse;
-export tritv_get;
-export tritv_set_all;
-export tritv_difference;
-export tritv_union;
-export tritv_intersect;
-export tritv_copy;
-export tritv_clear;
-export tritv_kill;
-export tritv_doesntcare;
-export to_str;
-
-/* for a fixed index:
-   10 = "this constraint may or may not be true after execution"
-   01 = "this constraint is definitely true"
-   00 = "this constraint is definitely false"
-   11 should never appear
- FIXME: typestate precondition (uncertain and val must
- have the same length; 11 should never appear in a given position)
- (except we're not putting typestate constraints in the compiler, as
- per discussion at #2178).
-*/
-
-type t = {uncertain: bitv::bitv, val: bitv::bitv, nbits: uint};
-enum trit { ttrue, tfalse, dont_care, }
-
-fn create_tritv(len: uint) -> t {
-    ret {uncertain: bitv::bitv(len, true),
-         val: bitv::bitv(len, false),
-         nbits: len};
-}
-
-
-fn trit_minus(a: trit, b: trit) -> trit {
-
-    /*   2 - anything = 2
-         1 - 1 = 2
-         1 - 0 is an error
-         1 - 2 = 1
-         0 - 1 is an error
-         0 - anything else - 0
-     */
-    alt a {
-      dont_care { dont_care }
-      ttrue {
-        alt b {
-          ttrue { dont_care }
-          tfalse { ttrue }
-
-
-
-
-          /* internally contradictory, but
-             I guess it'll get flagged? */
-          dont_care {
-            ttrue
-          }
-        }
-      }
-      tfalse {
-        alt b {
-          ttrue { tfalse }
-
-
-
-
-          /* see above comment */
-          _ {
-            tfalse
-          }
-        }
-      }
-    }
-}
-
-fn trit_or(a: trit, b: trit) -> trit {
-    alt a {
-      dont_care { b }
-      ttrue { ttrue }
-      tfalse {
-        alt b {
-          ttrue { dont_care }
-          /* FIXME: ??????
-             Again, unit tests would help here -- #2538
-           */
-          _ {
-            tfalse
-          }
-        }
-      }
-    }
-}
-
-// FIXME: This still seems kind of dodgy to me (that is,
-// that 1 + ? = 1. But it might work out given that
-// all variables start out in a 0 state. Probably I need
-// to make it so that all constraints start out in a 0 state
-// (we consider a constraint false until proven true), too.
-// #2538 would help.
-fn trit_and(a: trit, b: trit) -> trit {
-    alt a {
-      dont_care { b }
-      // also seems wrong for case b = ttrue
-      ttrue {
-        alt b {
-          dont_care { ttrue }
-          // ??? Seems wrong
-          ttrue {
-            ttrue
-          }
-          // false wins, since if something is uninit
-          // on one path, we care
-          // (Rationale: it's always safe to assume that
-          // a var is uninitialized or that a constraint
-          // needs to be re-established)
-          tfalse {
-            tfalse
-          }
-        }
-      }
-      // Rationale: if it's uninit on one path,
-      // we can consider it as uninit on all paths
-      tfalse {
-        tfalse
-      }
-    }
-    // if the result is dont_care, that means
-    // a and b were both dont_care
-}
-
-fn change(changed: bool, old: trit, newv: trit) -> bool {
-    changed || newv != old
-}
-
-fn tritv_difference(p1: t, p2: t) -> bool {
-    let mut i: uint = 0u;
-    assert (p1.nbits == p2.nbits);
-    let sz: uint = p1.nbits;
-    let mut changed = false;
-    while i < sz {
-        let old = tritv_get(p1, i);
-        let newv = trit_minus(old, tritv_get(p2, i));
-        changed = change(changed, old, newv);
-        tritv_set(i, p1, newv);
-        i += 1u;
-    }
-    ret changed;
-}
-
-fn tritv_union(p1: t, p2: t) -> bool {
-    let mut i: uint = 0u;
-    assert (p1.nbits == p2.nbits);
-    let sz: uint = p1.nbits;
-    let mut changed = false;
-    while i < sz {
-        let old = tritv_get(p1, i);
-        let newv = trit_or(old, tritv_get(p2, i));
-        changed = change(changed, old, newv);
-        tritv_set(i, p1, newv);
-        i += 1u;
-    }
-    ret changed;
-}
-
-fn tritv_intersect(p1: t, p2: t) -> bool {
-    let mut i: uint = 0u;
-    assert (p1.nbits == p2.nbits);
-    let sz: uint = p1.nbits;
-    let mut changed = false;
-    while i < sz {
-        let old = tritv_get(p1, i);
-        let newv = trit_and(old, tritv_get(p2, i));
-        changed = change(changed, old, newv);
-        tritv_set(i, p1, newv);
-        i += 1u;
-    }
-    ret changed;
-}
-
-fn tritv_get(v: t, i: uint) -> trit {
-    let b1 = bitv::get(v.uncertain, i);
-    let b2 = bitv::get(v.val, i);
-    assert (!(b1 && b2));
-    if b1 { dont_care } else if b2 { ttrue } else { tfalse }
-}
-
-fn tritv_set(i: uint, v: t, t: trit) -> bool {
-    let old = tritv_get(v, i);
-    alt t {
-      dont_care {
-        bitv::set(v.uncertain, i, true);
-        bitv::set(v.val, i, false);
-      }
-      ttrue { bitv::set(v.uncertain, i, false); bitv::set(v.val, i, true); }
-      tfalse {
-        bitv::set(v.uncertain, i, false);
-        bitv::set(v.val, i, false);
-      }
-    }
-    ret change(false, old, t);
-}
-
-fn tritv_copy(target: t, source: t) -> bool {
-    assert (target.nbits == source.nbits);
-    let changed =
-        !bitv::equal(target.uncertain, source.uncertain) ||
-            !bitv::equal(target.val, source.val);
-    bitv::assign(target.uncertain, source.uncertain);
-    bitv::assign(target.val, source.val);
-    ret changed;
-}
-
-fn tritv_set_all(v: t) {
-    let mut i: uint = 0u;
-    while i < v.nbits { tritv_set(i, v, ttrue); i += 1u; }
-}
-
-fn tritv_clear(v: t) {
-    let mut i: uint = 0u;
-    while i < v.nbits { tritv_set(i, v, dont_care); i += 1u; }
-}
-
-fn tritv_kill(v: t) {
-    let mut i: uint = 0u;
-    while i < v.nbits { tritv_set(i, v, tfalse); i += 1u; }
-}
-
-fn tritv_clone(v: t) -> t {
-    ret {uncertain: bitv::clone(v.uncertain),
-         val: bitv::clone(v.val),
-         nbits: v.nbits};
-}
-
-fn tritv_doesntcare(v: t) -> bool {
-    let mut i: uint = 0u;
-    while i < v.nbits {
-        if tritv_get(v, i) != dont_care { ret false; }
-        i += 1u;
-    }
-    ret true;
-}
-
-fn to_vec(v: t) -> [uint] {
-    let mut i: uint = 0u;
-    let mut rslt: [uint] = [];
-    while i < v.nbits {
-        rslt +=
-            [alt tritv_get(v, i) {
-               dont_care { 2u }
-               ttrue { 1u }
-               tfalse { 0u }
-             }];
-        i += 1u;
-    }
-    ret rslt;
-}
-
-fn to_str(v: t) -> str {
-    let mut i: uint = 0u;
-    let mut rs: str = "";
-    while i < v.nbits {
-        rs +=
-            alt tritv_get(v, i) {
-              dont_care { "?" }
-              ttrue { "1" }
-              tfalse { "0" }
-            };
-        i += 1u;
-    }
-    ret rs;
-}
-
-//
-// Local Variables:
-// mode: rust
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs
index 02e683f4cbc73..a36a5864b6b5e 100644
--- a/src/rustc/middle/ty.rs
+++ b/src/rustc/middle/ty.rs
@@ -11,7 +11,7 @@ import syntax::codemap::span;
 import metadata::csearch;
 import util::ppaux::region_to_str;
 import util::ppaux::vstore_to_str;
-import util::ppaux::{ty_to_str, tys_to_str, ty_constr_to_str};
+import util::ppaux::{ty_to_str, tys_to_str};
 import middle::lint::{get_warning_level, vecs_not_implicitly_copyable,
                       ignore};
 import syntax::ast::*;
@@ -23,13 +23,8 @@ export is_instantiable;
 export node_id_to_type;
 export node_id_to_type_params;
 export arg;
-export args_eq;
-export ast_constr_to_constr;
 export block_ty;
 export class_items_as_fields, class_items_as_mutable_fields;
-export constr;
-export constr_general;
-export constr_table;
 export ctxt;
 export deref, deref_sty;
 export index, index_sty;
@@ -76,10 +71,8 @@ export ty_param_bounds_and_ty;
 export ty_bool, mk_bool, type_is_bool;
 export ty_bot, mk_bot, type_is_bot;
 export ty_box, mk_box, mk_imm_box, type_is_box, type_is_boxed;
-export ty_constr, mk_constr;
 export ty_opaque_closure_ptr, mk_opaque_closure_ptr;
 export ty_opaque_box, mk_opaque_box;
-export ty_constr_arg;
 export ty_float, mk_float, mk_mach_float, type_is_fp;
 export ty_fn, fn_ty, mk_fn;
 export ty_fn_proto, ty_fn_ret, ty_fn_ret_style, tys_in_fn_ty;
@@ -112,7 +105,6 @@ export tbox_has_flag;
 export ty_var_id;
 export ty_to_def_id;
 export ty_fn_args;
-export type_constr;
 export kind, kind_implicitly_copyable, kind_sendable, kind_copyable;
 export kind_noncopyable, kind_const;
 export kind_can_be_copied, kind_can_be_sent, kind_can_be_implicitly_copied;
@@ -180,8 +172,6 @@ type method = {ident: ast::ident,
                purity: ast::purity,
                vis: ast::visibility};
 
-type constr_table = hashmap;
-
 type mt = {ty: t, mutbl: ast::mutability};
 
 enum vstore {
@@ -307,8 +297,7 @@ type fn_ty = {purity: ast::purity,
               proto: ast::proto,
               inputs: [arg],
               output: t,
-              ret_style: ret_style,
-              constraints: [@constr]};
+              ret_style: ret_style};
 
 // See discussion at head of region.rs
 enum region {
@@ -373,7 +362,6 @@ enum sty {
                               // integral types only
     ty_param(uint, def_id), // type parameter
     ty_self, // special, implicit `self` type parameter
-    ty_constr(t, [@type_constr]),
 
     // "Fake" types, used for trans purposes
     ty_type, // type_desc*
@@ -382,12 +370,6 @@ enum sty {
     ty_unboxed_vec(mt),
 }
 
-// In the middle end, constraints have a def_id attached, referring
-// to the definition of the operator in the constraint.
-type constr_general = spanned>;
-type type_constr = constr_general<@path>;
-type constr = constr_general;
-
 enum terr_vstore_kind {
     terr_vec, terr_str
 }
@@ -410,8 +392,6 @@ enum type_err {
     terr_record_fields(ast::ident, ast::ident),
     terr_arg_count,
     terr_mode_mismatch(mode, mode),
-    terr_constr_len(uint, uint),
-    terr_constr_mismatch(@type_constr, @type_constr),
     terr_regions_differ(region, region),
     terr_vstores_differ(terr_vstore_kind, vstore, vstore),
     terr_in_field(@type_err, ast::ident),
@@ -601,9 +581,6 @@ fn mk_t_with_id(cx: ctxt, st: sty, o_def_id: option) -> t {
         flags |= get(tt).flags;
         flags |= sflags(substs);
       }
-      ty_constr(tt, _) {
-        flags |= get(tt).flags;
-      }
     }
     let t = @{struct: st, id: cx.next_id, flags: flags, o_def_id: o_def_id};
     cx.interner.insert(key, t);
@@ -684,10 +661,6 @@ fn mk_mut_unboxed_vec(cx: ctxt, ty: t) -> t {
 
 fn mk_rec(cx: ctxt, fs: [field]) -> t { mk_t(cx, ty_rec(fs)) }
 
-fn mk_constr(cx: ctxt, t: t, cs: [@type_constr]) -> t {
-    mk_t(cx, ty_constr(t, cs))
-}
-
 fn mk_tup(cx: ctxt, ts: [t]) -> t { mk_t(cx, ty_tup(ts)) }
 
 fn mk_fn(cx: ctxt, fty: fn_ty) -> t { mk_t(cx, ty_fn(fty)) }
@@ -783,7 +756,6 @@ fn maybe_walk_ty(ty: t, f: fn(t) -> bool) {
         maybe_walk_ty(sub, f);
         for substs.tps.each {|tp| maybe_walk_ty(tp, f); }
       }
-      ty_constr(sub, _) { maybe_walk_ty(sub, f); }
       ty_uniq(tm) { maybe_walk_ty(tm.ty, f); }
     }
 }
@@ -851,9 +823,6 @@ fn fold_sty(sty: sty, fldop: fn(t) -> t) -> sty {
       ty_rptr(r, tm) {
         ty_rptr(r, {ty: fldop(tm.ty), mutbl: tm.mutbl})
       }
-      ty_constr(subty, cs) {
-        ty_constr(fldop(subty), cs)
-      }
       ty_class(did, substs) {
         ty_class(did, fold_substs(substs, fldop))
       }
@@ -1601,7 +1570,6 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
         if kind_can_be_copied(k)
             { raise_kind(k, kind_implicitly_copyable()) } else { k }
       }
-      ty_constr(t, _) { type_kind(cx, t) }
       // FIXME: is self ever const?
       ty_self { kind_noncopyable() }
       ty_var(_) | ty_var_integral(_) {
@@ -1666,10 +1634,6 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
             false
           }
 
-          ty_constr(t, _) {
-            type_requires(cx, seen, r_ty, t)
-          }
-
           ty_box(mt) |
           ty_uniq(mt) |
           ty_rptr(_, mt) {
@@ -1885,7 +1849,6 @@ fn type_is_pod(cx: ctxt, ty: t) -> bool {
       ty_res(_, inner, substs) {
         result = type_is_pod(cx, subst(cx, substs, inner));
       }
-      ty_constr(subt, _) { result = type_is_pod(cx, subt); }
       ty_param(_, _) { result = false; }
       ty_opaque_closure_ptr(_) { result = true; }
       ty_class(did, substs) {
@@ -2014,19 +1977,6 @@ fn hash_type_structure(st: sty) -> uint {
         for subtys.each {|s| h = (h << 2u) + type_id(s) }
         h
     }
-    fn hash_type_constr(id: uint, c: @type_constr) -> uint {
-        let mut h = id;
-        h = (h << 2u) + hash_def(h, c.node.id);
-        // FIXME this makes little sense
-        for c.node.args.each {|a|
-            alt a.node {
-              carg_base { h += h << 2u; }
-              carg_lit(_) { fail "lit args not implemented yet"; }
-              carg_ident(p) { h += h << 2u; }
-            }
-        }
-        h
-    }
     fn hash_region(r: region) -> uint {
         alt r { // no idea if this is any good
           re_bound(br) { (hash_bound_region(br)) << 2u | 0u }
@@ -2086,11 +2036,6 @@ fn hash_type_structure(st: sty) -> uint {
       ty_type { 32u }
       ty_bot { 34u }
       ty_ptr(mt) { hash_subty(35u, mt.ty) }
-      ty_constr(t, cs) {
-        let mut h = hash_subty(36u, t);
-        for cs.each {|c| h = (h << 2u) + hash_type_constr(h, c); }
-        h
-      }
       ty_uniq(mt) { hash_subty(37u, mt.ty) }
       ty_res(did, sub, substs) {
         let mut h = hash_subty(hash_def(38u, did), sub);
@@ -2115,50 +2060,6 @@ fn hash_type_structure(st: sty) -> uint {
     }
 }
 
-fn arg_eq(eq: fn(T, T) -> bool,
-             a: @sp_constr_arg,
-             b: @sp_constr_arg)
-   -> bool {
-    alt a.node {
-      ast::carg_base {
-        alt b.node { ast::carg_base { ret true; } _ { ret false; } }
-      }
-      ast::carg_ident(s) {
-        alt b.node { ast::carg_ident(t) { ret eq(s, t); } _ { ret false; } }
-      }
-      ast::carg_lit(l) {
-        alt b.node {
-          ast::carg_lit(m) { ret const_eval::lit_eq(l, m); } _ { ret false; }
-        }
-      }
-    }
-}
-
-fn args_eq(eq: fn(T, T) -> bool,
-              a: [@sp_constr_arg],
-              b: [@sp_constr_arg]) -> bool {
-    let mut i: uint = 0u;
-    for a.each {|arg|
-        if !arg_eq(eq, arg, b[i]) { ret false; }
-        i += 1u;
-    }
-    ret true;
-}
-
-fn constr_eq(c: @constr, d: @constr) -> bool {
-    fn eq_int(&&x: uint, &&y: uint) -> bool { ret x == y; }
-    ret path_to_str(c.node.path) == path_to_str(d.node.path) &&
-            // FIXME: hack
-            args_eq(eq_int, c.node.args, d.node.args);
-}
-
-fn constrs_eq(cs: [@constr], ds: [@constr]) -> bool {
-    if vec::len(cs) != vec::len(ds) { ret false; }
-    let mut i = 0u;
-    for cs.each {|c| if !constr_eq(c, ds[i]) { ret false; } i += 1u; }
-    ret true;
-}
-
 fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
     alt smallintmap::find(*cx.node_types, id as uint) {
        some(t) { t }
@@ -2440,7 +2341,6 @@ fn ty_sort_str(cx: ctxt, t: t) -> str {
       ty_var_integral(_) { "integral variable" }
       ty_param(_, _) { "type parameter" }
       ty_self { "self" }
-      ty_constr(t, _) { ty_sort_str(cx, t) }
     }
 }
 
@@ -2498,16 +2398,6 @@ fn type_err_to_str(cx: ctxt, err: type_err) -> str {
         ret "expected argument mode " + mode_to_str(e_mode) + " but found " +
                 mode_to_str(a_mode);
       }
-      terr_constr_len(e_len, a_len) {
-        ret "expected a type with " + uint::str(e_len) +
-                " constraints, but found one with " + uint::str(a_len) +
-                " constraints";
-      }
-      terr_constr_mismatch(e_constr, a_constr) {
-        ret "expected a type with constraint " + ty_constr_to_str(e_constr) +
-                " but found one with constraint " +
-                ty_constr_to_str(a_constr);
-      }
       terr_regions_differ(subregion, superregion) {
         ret #fmt("references with lifetime %s do not necessarily \
                   outlive references with lifetime %s",
@@ -2833,7 +2723,8 @@ pure fn is_public(f: field_ty) -> bool {
 // Look up the list of method names and IDs for a given class
 // Fails if the id is not bound to a class.
 fn lookup_class_method_ids(cx: ctxt, did: ast::def_id)
-    : is_local(did) -> [{name: ident, id: node_id, vis: visibility}] {
+    -> [{name: ident, id: node_id, vis: visibility}] {
+    assert is_local(did);
     alt cx.items.find(did.node) {
        some(ast_map::node_item(@{node: item_class(_,_,items,_,_,_), _}, _)) {
          let (_,ms) = split_class_items(items);
@@ -2853,7 +2744,7 @@ fn lookup_class_method_ids(cx: ctxt, did: ast::def_id)
 */
 fn lookup_class_method_by_name(cx:ctxt, did: ast::def_id, name: ident,
                                sp: span) -> def_id {
-    if check is_local(did) {
+    if is_local(did) {
        let ms = lookup_class_method_ids(cx, did);
        for ms.each {|m|
          if m.name == name {
@@ -2994,24 +2885,6 @@ fn is_binopable(_cx: ctxt, ty: t, op: ast::binop) -> bool {
     ret tbl[tycat(ty)][opcat(op)];
 }
 
-fn ast_constr_to_constr(tcx: ctxt, c: @ast::constr_general) ->
-   @constr_general {
-    alt tcx.def_map.find(c.node.id) {
-      some(ast::def_fn(pred_id, ast::pure_fn)) {
-        ret @ast_util::respan(c.span,
-                              {path: c.node.path,
-                               args: c.node.args,
-                               id: pred_id});
-      }
-      _ {
-        tcx.sess.span_fatal(c.span,
-                            "predicate " + path_to_str(c.node.path) +
-                            " is unbound or bound to a non-function or an \
-            impure function");
-      }
-    }
-}
-
 fn ty_params_to_tys(tcx: ty::ctxt, tps: [ast::ty_param]) -> [t] {
     vec::from_fn(tps.len(), {|i|
                 ty::mk_param(tcx, i, ast_util::local_def(tps[i].id))
diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs
index f8b24d004b75d..650cfaae94398 100644
--- a/src/rustc/middle/typeck.rs
+++ b/src/rustc/middle/typeck.rs
@@ -197,7 +197,7 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
     let main_t = ty::node_id_to_type(tcx, main_id);
     alt ty::get(main_t).struct {
       ty::ty_fn({purity: ast::impure_fn, proto: ast::proto_bare,
-                 inputs, output, ret_style: ast::return_val, constraints}) {
+                 inputs, output, ret_style: ast::return_val}) {
         alt tcx.items.find(main_id) {
          some(ast_map::node_item(it,_)) {
              alt it.node {
@@ -211,7 +211,7 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
          }
          _ {}
         }
-        let mut ok = vec::len(constraints) == 0u;
+        let mut ok = true;
         ok &= ty::type_is_nil(output);
         let num_args = vec::len(inputs);
         ok &= num_args == 0u || num_args == 1u &&
diff --git a/src/rustc/middle/typeck/astconv.rs b/src/rustc/middle/typeck/astconv.rs
index 476ef9d3ba551..8652256c69384 100644
--- a/src/rustc/middle/typeck/astconv.rs
+++ b/src/rustc/middle/typeck/astconv.rs
@@ -330,13 +330,6 @@ fn ast_ty_to_ty(
             ast_ty.span,
             "implied fixed length for bound");
       }
-      ast::ty_constr(t, cs) {
-        let mut out_cs = [];
-        for cs.each {|constr|
-            out_cs += [ty::ast_constr_to_constr(tcx, constr)];
-        }
-        ty::mk_constr(tcx, ast_ty_to_ty(self, rscope, t), out_cs)
-      }
       ast::ty_infer {
         // ty_infer should only appear as the type of arguments or return
         // values in a fn_expr, or as the type of local variables.  Both of
@@ -427,12 +420,8 @@ fn ty_of_fn_decl(
           _ {ast_ty_to_ty(self, rb, decl.output)}
         };
 
-        let out_constrs = vec::map(decl.constraints) {|constr|
-            ty::ast_constr_to_constr(self.tcx(), constr)
-        };
-
         {purity: decl.purity, proto: proto, inputs: input_tys,
-         output: output_ty, ret_style: decl.cf, constraints: out_constrs}
+         output: output_ty, ret_style: decl.cf}
     }
 }
 
diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs
index 079228ada78f1..00320ddd4ebe8 100644
--- a/src/rustc/middle/typeck/check.rs
+++ b/src/rustc/middle/typeck/check.rs
@@ -210,7 +210,6 @@ fn check_fn(ccx: @crate_ctxt,
     };
 
     gather_locals(fcx, decl, body, arg_tys);
-    check_constraints(fcx, decl.constraints, decl.inputs);
     check_block(fcx, body);
 
     // We unify the tail expr's type with the
@@ -1291,15 +1290,6 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
         check_expr(fcx, e, none);
         fcx.write_nil(id);
       }
-      ast::expr_check(_, e) {
-        bot = check_pred_expr(fcx, e);
-        fcx.write_nil(id);
-      }
-      ast::expr_if_check(cond, thn, elsopt) {
-        bot =
-            check_pred_expr(fcx, cond) |
-                check_then_else(fcx, thn, elsopt, id, expr.span);
-      }
       ast::expr_assert(e) {
         bot = check_expr_with(fcx, e, ty::mk_bool(tcx));
         fcx.write_nil(id);
@@ -1411,17 +1401,13 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
         // TODO: Perform substitutions on the return type.
 
         // Pull the argument and return types out.
-        let mut proto, arg_tys, rt, cf, constrs;
+        let mut proto, arg_tys, rt, cf;
         alt structure_of(fcx, expr.span, fty) {
-          // FIXME:
-          // probably need to munge the constrs to drop constraints
-          // for any bound args
           ty::ty_fn(f) {
             proto = f.proto;
             arg_tys = f.inputs;
             rt = f.output;
             cf = f.ret_style;
-            constrs = f.constraints;
           }
           _ { fail "LHS of bind expr didn't have a function type?!"; }
         }
@@ -1452,7 +1438,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
 
         let ft = ty::mk_fn(tcx, {purity: ast::impure_fn, proto: proto,
                                  inputs: out_args, output: rt,
-                                 ret_style: cf, constraints: constrs});
+                                 ret_style: cf});
         fcx.write_ty(id, ft);
       }
       ast::expr_call(f, args, _) {
@@ -1710,8 +1696,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
                                 inputs: [{mode: m, ty: ty_uint},
                                          {mode: m, ty: ty_uint}],
                                 output: ty_nilp,
-                                ret_style: ast::return_val,
-                                constraints: []})
+                                ret_style: ast::return_val})
             };
 
             demand::suptype(fcx, expr.span,
@@ -2022,65 +2007,6 @@ fn check_pred_expr(fcx: @fn_ctxt, e: @ast::expr) -> bool {
     ret bot;
 }
 
-fn check_constraints(fcx: @fn_ctxt, cs: [@ast::constr], args: [ast::arg]) {
-    let num_args = vec::len(args);
-    for cs.each {|c|
-        let mut c_args = [];
-        for c.node.args.each {|a|
-            c_args += [
-                 // "base" should not occur in a fn type thing, as of
-                 // yet, b/c we don't allow constraints on the return type
-
-                 // Works b/c no higher-order polymorphism
-                 /*
-                 This is kludgy, and we probably shouldn't be assigning
-                 node IDs here, but we're creating exprs that are
-                 ephemeral, just for the purposes of typechecking. So
-                 that's my justification.
-                 */
-                 @alt a.node {
-                    ast::carg_base {
-                      fcx.ccx.tcx.sess.span_bug(a.span,
-                                                "check_constraints:\
-                    unexpected carg_base");
-                    }
-                    ast::carg_lit(l) {
-                      let tmp_node_id = fcx.ccx.tcx.sess.next_node_id();
-                      {id: tmp_node_id, node: ast::expr_lit(l), span: a.span}
-                    }
-                    ast::carg_ident(i) {
-                      if i < num_args {
-                          let p = @{span: a.span, global: false,
-                                    idents: [args[i].ident],
-                                    rp: none, types: []};
-                          let arg_occ_node_id =
-                              fcx.ccx.tcx.sess.next_node_id();
-                          fcx.ccx.tcx.def_map.insert
-                              (arg_occ_node_id,
-                               ast::def_arg(args[i].id, args[i].mode));
-                          {id: arg_occ_node_id,
-                           node: ast::expr_path(p),
-                           span: a.span}
-                      } else {
-                          fcx.ccx.tcx.sess.span_bug(
-                              a.span, "check_constraints:\
-                                       carg_ident index out of bounds");
-                      }
-                    }
-                  }];
-        }
-        let p_op: ast::expr_ = ast::expr_path(c.node.path);
-        let oper: @ast::expr = @{id: c.node.id, node: p_op, span: c.span};
-        // Another ephemeral expr
-        let call_expr_id = fcx.ccx.tcx.sess.next_node_id();
-        let call_expr =
-            @{id: call_expr_id,
-              node: ast::expr_call(oper, c_args, false),
-              span: c.span};
-        check_pred_expr(fcx, call_expr);
-    }
-}
-
 // Determines whether the given node ID is a use of the def of
 // the self ID for the current method, if there is one
 // self IDs in an outer scope count. so that means that you can
@@ -2352,8 +2278,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) {
                     ty::mk_mach_uint(ccx.tcx, ast::ty_u8))
             }],
             output: ty::mk_nil(ccx.tcx),
-            ret_style: ast::return_val,
-            constraints: []
+            ret_style: ast::return_val
         });
         (0u, [arg(ast::by_ref, fty)], ty::mk_nil(tcx))
       }
@@ -2366,8 +2291,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) {
     let fty = ty::mk_fn(tcx, {purity: ast::impure_fn,
                               proto: ast::proto_bare,
                               inputs: inputs, output: output,
-                              ret_style: ast::return_val,
-                              constraints: []});
+                              ret_style: ast::return_val});
     let i_ty = ty::lookup_item_type(ccx.tcx, local_def(it.id));
     let i_n_tps = (*i_ty.bounds).len();
     if i_n_tps != n_tps {
diff --git a/src/rustc/middle/typeck/collect.rs b/src/rustc/middle/typeck/collect.rs
index afc79b52428be..145d5654af814 100644
--- a/src/rustc/middle/typeck/collect.rs
+++ b/src/rustc/middle/typeck/collect.rs
@@ -117,8 +117,7 @@ fn get_enum_variant_types(ccx: @crate_ctxt,
                             proto: ast::proto_box,
                             inputs: args,
                             output: enum_ty,
-                            ret_style: ast::return_val,
-                            constraints: []})
+                            ret_style: ast::return_val})
         };
         let tpt = {bounds: ty_param_bounds(ccx, ty_params),
                    rp: rp,
@@ -334,13 +333,13 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
             proto: ast::proto_box,
             inputs: [{mode: ast::expl(ast::by_copy), ty: t_arg.ty}],
             output: t_res,
-            ret_style: ast::return_val, constraints: []
+            ret_style: ast::return_val
         });
         let t_dtor = ty::mk_fn(tcx, {
             purity: ast::impure_fn,
             proto: ast::proto_box,
             inputs: [t_arg], output: ty::mk_nil(tcx),
-            ret_style: ast::return_val, constraints: []
+            ret_style: ast::return_val
         });
         write_ty_to_tcx(tcx, it.id, t_res);
         write_ty_to_tcx(tcx, ctor_id, t_ctor);
@@ -637,8 +636,7 @@ fn ty_of_native_fn_decl(ccx: @crate_ctxt,
                                    proto: ast::proto_bare,
                                    inputs: input_tys,
                                    output: output_ty,
-                                   ret_style: ast::return_val,
-                                   constraints: []});
+                                   ret_style: ast::return_val});
     let tpt = {bounds: bounds, rp: ast::rp_none, ty: t_fn};
     ccx.tcx.tcache.insert(def_id, tpt);
     ret tpt;
diff --git a/src/rustc/middle/typeck/infer.rs b/src/rustc/middle/typeck/infer.rs
index a67f515f058e7..9ebecb59255fb 100644
--- a/src/rustc/middle/typeck/infer.rs
+++ b/src/rustc/middle/typeck/infer.rs
@@ -816,49 +816,6 @@ impl unify_methods for infer_ctxt {
         uok()
     }
 
-    fn constrs(
-        expected: @ty::type_constr,
-        actual_constr: @ty::type_constr) -> ures {
-
-        let err_res =
-            err(ty::terr_constr_mismatch(expected, actual_constr));
-
-        if expected.node.id != actual_constr.node.id { ret err_res; }
-        let expected_arg_len = vec::len(expected.node.args);
-        let actual_arg_len = vec::len(actual_constr.node.args);
-        if expected_arg_len != actual_arg_len { ret err_res; }
-        let mut i = 0u;
-        for expected.node.args.each {|a|
-            let actual = actual_constr.node.args[i];
-            alt a.node {
-              ast::carg_base {
-                alt actual.node {
-                  ast::carg_base { }
-                  _ { ret err_res; }
-                }
-              }
-              ast::carg_lit(l) {
-                alt actual.node {
-                  ast::carg_lit(m) {
-                    if l != m { ret err_res; }
-                  }
-                  _ { ret err_res; }
-                }
-              }
-              ast::carg_ident(p) {
-                alt actual.node {
-                  ast::carg_ident(q) {
-                    if p.idents != q.idents { ret err_res; }
-                  }
-                  _ { ret err_res; }
-                }
-              }
-            }
-            i += 1u;
-        }
-        ret uok();
-    }
-
     fn bnds(
         a: bound, b: bound) -> ures {
 
@@ -877,18 +834,6 @@ impl unify_methods for infer_ctxt {
         }
     }
 
-    fn constrvecs(
-        as: [@ty::type_constr], bs: [@ty::type_constr]) -> ures {
-
-        if check vec::same_length(as, bs) {
-            iter_vec2(as, bs) {|a,b|
-                self.constrs(a, b)
-            }
-        } else {
-            err(ty::terr_constr_len(bs.len(), as.len()))
-        }
-    }
-
     fn sub_tys(a: ty::t, b: ty::t) -> ures {
         sub(self).tys(a, b).chain {|_t| ok(()) }
     }
@@ -1391,7 +1336,7 @@ fn super_tps(
     // future we could allow type parameters to declare a
     // variance.
 
-    if check vec::same_length(as, bs) {
+    if vec::same_length(as, bs) {
         iter_vec2(as, bs) {|a, b|
             self.infcx().eq_tys(a, b)
         }.then {||
@@ -1487,7 +1432,7 @@ fn super_fns(
     fn argvecs(
         self: C, a_args: [ty::arg], b_args: [ty::arg]) -> cres<[ty::arg]> {
 
-        if check vec::same_length(a_args, b_args) {
+        if vec::same_length(a_args, b_args) {
             map_vec2(a_args, b_args) {|a, b| self.args(a, b) }
         } else {
             err(ty::terr_arg_count)
@@ -1505,8 +1450,7 @@ fn super_fns(
                             proto: p,
                             inputs: inputs,
                             output: output,
-                            ret_style: rs,
-                            constraints: a_f.constraints})
+                            ret_style: rs})
                     //FIXME }
                     }
                 }
@@ -1643,7 +1587,7 @@ fn super_tys(
       }
 
       (ty::ty_rec(as), ty::ty_rec(bs)) {
-        if check vec::same_length(as, bs) {
+        if vec::same_length(as, bs) {
             map_vec2(as, bs) {|a,b|
                 self.flds(a, b)
             }.chain {|flds|
@@ -1655,7 +1599,7 @@ fn super_tys(
       }
 
       (ty::ty_tup(as), ty::ty_tup(bs)) {
-        if check vec::same_length(as, bs) {
+        if vec::same_length(as, bs) {
             map_vec2(as, bs) {|a, b| self.tys(a, b) }.chain {|ts|
                 ok(ty::mk_tup(tcx, ts))
             }
@@ -1670,14 +1614,6 @@ fn super_tys(
         }
       }
 
-      (ty::ty_constr(a_t, a_constrs), ty::ty_constr(b_t, b_constrs)) {
-        self.tys(a_t, b_t).chain {|t|
-            self.infcx().constrvecs(a_constrs, b_constrs).then {||
-                ok(ty::mk_constr(tcx, t, a_constrs))
-            }
-        }
-      }
-
       _ { err(ty::terr_sorts(b, a)) }
     }
 }
diff --git a/src/rustc/rustc.rc b/src/rustc/rustc.rc
index 7d112ae71467c..4c2c7970fa757 100644
--- a/src/rustc/rustc.rc
+++ b/src/rustc/rustc.rc
@@ -87,19 +87,6 @@ mod middle {
     mod region;
     mod const_eval;
     mod astencode;
-
-    mod tstate {
-        mod ck;
-        mod annotate;
-        #[path = "auxiliary.rs"]
-        mod aux;
-        mod bitvectors;
-        mod collect_locals;
-        mod pre_post_conditions;
-        mod states;
-        mod ann;
-        mod tritv;
-    }
 }
 
 mod front {
diff --git a/src/rustc/util/ppaux.rs b/src/rustc/util/ppaux.rs
index 431eb8b0aea6a..a4042b740672a 100644
--- a/src/rustc/util/ppaux.rs
+++ b/src/rustc/util/ppaux.rs
@@ -1,9 +1,9 @@
 import std::map::hashmap;
 import middle::ty;
 import middle::ty::{arg, bound_region, br_anon, br_named, canon_mode};
-import middle::ty::{ck_block, ck_box, ck_uniq, constr, ctxt, field, method};
+import middle::ty::{ck_block, ck_box, ck_uniq, ctxt, field, method};
 import middle::ty::{mt, re_bound, re_free, re_scope, re_var, region, t};
-import middle::ty::{ty_bool, ty_bot, ty_box, ty_class, ty_constr, ty_enum};
+import middle::ty::{ty_bool, ty_bot, ty_box, ty_class, ty_enum};
 import middle::ty::{ty_estr, ty_evec, ty_float, ty_fn, ty_iface, ty_int};
 import middle::ty::{ty_nil, ty_opaque_box, ty_opaque_closure_ptr, ty_param};
 import middle::ty::{ty_ptr, ty_rec, ty_res, ty_rptr, ty_self, ty_str, ty_tup};
@@ -12,7 +12,7 @@ import middle::ty::{ty_vec, ty_unboxed_vec, vid};
 import metadata::encoder;
 import syntax::codemap;
 import syntax::print::pprust;
-import syntax::print::pprust::{path_to_str, constr_args_to_str, proto_to_str,
+import syntax::print::pprust::{path_to_str, proto_to_str,
                                mode_to_str, purity_to_str};
 import syntax::{ast, ast_util};
 import syntax::ast_map;
@@ -121,8 +121,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
     }
     fn fn_to_str(cx: ctxt, purity: ast::purity, proto: ast::proto,
                  ident: option,
-                 inputs: [arg], output: t, cf: ast::ret_style,
-                 constrs: [@constr]) -> str {
+                 inputs: [arg], output: t, cf: ast::ret_style) -> str {
         let mut s;
 
         s = alt purity {
@@ -143,13 +142,12 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
               ast::return_val { s += ty_to_str(cx, output); }
             }
         }
-        s += constrs_str(constrs);
         ret s;
     }
     fn method_to_str(cx: ctxt, m: method) -> str {
         ret fn_to_str(
             cx, m.fty.purity, m.fty.proto, some(m.ident), m.fty.inputs,
-            m.fty.output, m.fty.ret_style, m.fty.constraints) + ";";
+            m.fty.output, m.fty.ret_style) + ";";
     }
     fn field_to_str(cx: ctxt, f: field) -> str {
         ret *f.ident + ": " + mt_to_str(cx, f.mt);
@@ -200,7 +198,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
       }
       ty_fn(f) {
         fn_to_str(cx, f.purity, f.proto, none, f.inputs,
-                  f.output, f.ret_style, f.constraints)
+                  f.output, f.ret_style)
       }
       ty_var(v) { v.to_str() }
       ty_var_integral(v) { v.to_str() }
@@ -224,7 +222,6 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
       }
       ty_estr(vs) { #fmt["str/%s", vstore_to_str(cx, vs)] }
       ty_opaque_box { "@?" }
-      ty_constr(t, _) { "@?" }
       ty_opaque_closure_ptr(ck_block) { "closure&" }
       ty_opaque_closure_ptr(ck_box) { "closure@" }
       ty_opaque_closure_ptr(ck_uniq) { "closure~" }
@@ -257,26 +254,6 @@ fn ty_to_short_str(cx: ctxt, typ: t) -> str {
     ret s;
 }
 
-fn constr_to_str(c: @constr) -> str {
-    ret path_to_str(c.node.path) +
-            pprust::constr_args_to_str(pprust::uint_to_str, c.node.args);
-}
-
-fn constrs_str(constrs: [@constr]) -> str {
-    let mut s = "";
-    let mut colon = true;
-    for constrs.each {|c|
-        if colon { s += " : "; colon = false; } else { s += ", "; }
-        s += constr_to_str(c);
-    }
-    ret s;
-}
-
-fn ty_constr_to_str(c: @ast::spanned>)
-   -> str {
-    ret path_to_str(c.node.path) +
-            constr_args_to_str::<@ast::path>(path_to_str, c.node.args);
-}
 
 // Local Variables:
 // mode: rust
diff --git a/src/rustdoc/unindent_pass.rs b/src/rustdoc/unindent_pass.rs
index 342e0914647a7..5f3b43985d408 100644
--- a/src/rustdoc/unindent_pass.rs
+++ b/src/rustdoc/unindent_pass.rs
@@ -61,7 +61,7 @@ fn unindent(s: str) -> str {
         }
     };
 
-    if check vec::is_not_empty(lines) {
+    if vec::is_not_empty(lines) {
         let unindented = [str::trim(vec::head(lines))]
             + par::anymap(vec::tail(lines)) {|line|
             if str::is_whitespace(line) {
diff --git a/src/test/compile-fail/fn-constraint.rs b/src/test/compile-fail/fn-constraint.rs
deleted file mode 100644
index 2843ef93ea6c0..0000000000000
--- a/src/test/compile-fail/fn-constraint.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// error-pattern:precondition constraint (for example, uint::le(a, b)
-use std;
-import str::*;
-
-fn main() unsafe {
-    fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}
-    let a: uint = 4u;
-    let b: uint = 1u;
-    log(error, foo(a, b));
-}
diff --git a/src/test/compile-fail/if-check-precond-fail.rs b/src/test/compile-fail/if-check-precond-fail.rs
deleted file mode 100644
index 4545277e18d69..0000000000000
--- a/src/test/compile-fail/if-check-precond-fail.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// error-pattern:unsatisfied precondition constraint
-pure fn even(x: uint) -> bool {
-    if x < 2u {
-        ret false;
-    } else if x == 2u { ret true; } else { ret even(x - 2u); }
-}
-
-fn print_even(x: uint) : even(x) { log(debug, x); }
-
-fn foo(x: uint) { if check even(x) { fail; } else { print_even(x); } }
-
-fn main() { foo(3u); }
diff --git a/src/test/compile-fail/impure-pred.rs b/src/test/compile-fail/impure-pred.rs
index 41990fe167c15..f0dd5ed81c136 100644
--- a/src/test/compile-fail/impure-pred.rs
+++ b/src/test/compile-fail/impure-pred.rs
@@ -8,7 +8,4 @@ pure fn f(_q: int) -> bool {
 }
 
 fn main() {
-    let x = 0;
-
-    check (f(x));
 }
diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs
index a1ad07f6ecb95..c4943b8f5a100 100644
--- a/src/test/compile-fail/liveness-unused.rs
+++ b/src/test/compile-fail/liveness-unused.rs
@@ -35,10 +35,7 @@ fn f4() {
 }
 
 // leave this in here just to trigger compile-fail:
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
 fn main() {
-    let i: int = 4;
-    log(debug, false && { check is_even(i); true });
-    even(i); //! ERROR unsatisfied precondition
+    let mut i = ();
+    {|| i }(); //! ERROR mutable variables cannot be implic
 }
diff --git a/src/test/compile-fail/loop-pred-constraints.rs b/src/test/compile-fail/loop-pred-constraints.rs
deleted file mode 100644
index a55fe477ba796..0000000000000
--- a/src/test/compile-fail/loop-pred-constraints.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// https://github.com/mozilla/rust/issues/2374
-// error-pattern:unsatisfied precondition constraint (for example, even(y
-
-
-fn print_even(y: int) : even(y) { log(debug, y); }
-
-pure fn even(y: int) -> bool { true }
-
-fn main() {
-    let mut y = 42;
-    check (even(y));
-    loop {
-        print_even(y);
-        loop { y += 1; break; }
-    }
-}
diff --git a/src/test/compile-fail/no-constraint-prop.rs b/src/test/compile-fail/no-constraint-prop.rs
deleted file mode 100644
index f1c02bd406f7f..0000000000000
--- a/src/test/compile-fail/no-constraint-prop.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// error-pattern:unsatisfied precondition constraint (for example, uint::le
-
-fn main() unsafe {
-    fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}
-    let mut a: uint = 1u;
-    let mut b: uint = 4u;
-    let mut c: uint = 5u;
-    // make sure that the constraint le(b, a) exists...
-    check (uint::le(b, a));
-    // ...invalidate it...
-    b += 1u;
-    check (uint::le(c, a));
-    // ...and check that it doesn't get set in the poststate of
-    // the next statement, since it's not true in the
-    // prestate.
-    let d <- a;
-    log(debug, foo(b, d));
-}
diff --git a/src/test/compile-fail/nonsense-constraints.rs b/src/test/compile-fail/nonsense-constraints.rs
deleted file mode 100644
index b3ac40be24a12..0000000000000
--- a/src/test/compile-fail/nonsense-constraints.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Tests that the typechecker checks constraints
-// error-pattern:mismatched types: expected `uint` but found `u8`
-use std;
-import uint;
-
-fn enum_chars(start: u8, end: u8) : uint::le(start, end) -> [char] {
-    let i = start;
-    let r = [];
-    while i <= end { r += [i as char]; i += 1u as u8; }
-    ret r;
-}
-
-fn main() { log(debug, enum_chars('a' as u8, 'z' as u8)); }
diff --git a/src/test/compile-fail/not-a-pred-2.rs b/src/test/compile-fail/not-a-pred-2.rs
deleted file mode 100644
index 3bac354fb246a..0000000000000
--- a/src/test/compile-fail/not-a-pred-2.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// -*- rust -*-
-
-// error-pattern: non-predicate
-
-fn main() {
-    check (1 ==
-               2); // should fail to typecheck, as (a == b)
-                   // is not a manifest call
-
-
-
-
-
-}
diff --git a/src/test/compile-fail/not-a-pred-check.rs b/src/test/compile-fail/not-a-pred-check.rs
deleted file mode 100644
index 24016a70b2d5d..0000000000000
--- a/src/test/compile-fail/not-a-pred-check.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// -*- rust -*-
-// error-pattern:impure function as operator
-
-fn f(q: int) -> bool { ret true; }
-
-fn main() {
-    let x = 0;
-
-    check (f(x));
-}
diff --git a/src/test/compile-fail/not-a-pred.rs b/src/test/compile-fail/not-a-pred.rs
deleted file mode 100644
index 0766a8d1feed4..0000000000000
--- a/src/test/compile-fail/not-a-pred.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// -*- rust -*-
-// error-pattern: lt is not declared pure
-
-fn f(a: int, b: int) : lt(a, b) { }
-
-fn lt(a: int, b: int) { }
-
-fn main() { let a: int = 10; let b: int = 23; check (lt(a, b)); f(a, b); }
diff --git a/src/test/compile-fail/not-pred-args.rs b/src/test/compile-fail/not-pred-args.rs
deleted file mode 100644
index 6fb5273e1e76d..0000000000000
--- a/src/test/compile-fail/not-pred-args.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// -*- rust -*-
-
-// error-pattern:constraint args must be
-
-pure fn f(q: int) -> bool { ret true; }
-
-fn main() {
-    // should fail to typecheck, as pred args must be slot variables
-    // or literals
-    check (f(42 * 17));
-}
diff --git a/src/test/compile-fail/pred-assign.rs b/src/test/compile-fail/pred-assign.rs
deleted file mode 100644
index 19a7105098636..0000000000000
--- a/src/test/compile-fail/pred-assign.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// -*- rust -*-
-
-// error-pattern:unsatisfied precondition constraint (for example, lt(a, b)
-
-fn f(a: int, b: int) : lt(a, b) { }
-
-pure fn lt(a: int, b: int) -> bool { ret a < b; }
-
-fn main() {
-    let mut a: int = 10;
-    let mut b: int = 23;
-    let mut c: int = 77;
-    check (lt(a, b));
-    a = 24;
-    f(a, b);
-}
diff --git a/src/test/compile-fail/pred-on-wrong-slots.rs b/src/test/compile-fail/pred-on-wrong-slots.rs
deleted file mode 100644
index 3d887e8d6ef66..0000000000000
--- a/src/test/compile-fail/pred-on-wrong-slots.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// -*- rust -*-
-
-// error-pattern: lt(a, c)
-
-fn f(a: int, b: int) : lt(a, b) { }
-
-pure fn lt(a: int, b: int) -> bool { ret a < b; }
-
-fn main() {
-    let a: int = 10;
-    let b: int = 23;
-    let c: int = 77;
-    check (lt(a, b));
-    check (lt(b, c));
-    f(a, b);
-    f(a, c);
-}
diff --git a/src/test/compile-fail/pred-swap.rs b/src/test/compile-fail/pred-swap.rs
deleted file mode 100644
index b62f5a942f7ca..0000000000000
--- a/src/test/compile-fail/pred-swap.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// -*- rust -*-
-
-// error-pattern:unsatisfied precondition constraint (for example, lt(a, b)
-
-fn f(a: int, b: int) : lt(a, b) { }
-
-pure fn lt(a: int, b: int) -> bool { ret a < b; }
-
-fn main() {
-    let mut a: int = 10;
-    let mut b: int = 23;
-    let mut c: int = 77;
-    check (lt(a, b));
-    b <-> a;
-    f(a, b);
-}
diff --git a/src/test/compile-fail/slot-as-pred.rs b/src/test/compile-fail/slot-as-pred.rs
deleted file mode 100644
index 820ebd655f51d..0000000000000
--- a/src/test/compile-fail/slot-as-pred.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// -*- rust -*-
-// error-pattern: unresolved name: lt
-
-fn f(a: int, b: int) : lt(a, b) { }
-
-fn main() {
-    let lt: int;
-    let a: int = 10;
-    let b: int = 23;
-    check (lt(a, b));
-    f(a, b);
-}
diff --git a/src/test/compile-fail/tstate-and-init.rs b/src/test/compile-fail/tstate-and-init.rs
deleted file mode 100644
index 7b254fe2e19e1..0000000000000
--- a/src/test/compile-fail/tstate-and-init.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-fn main() {
-    let i: int = 4;
-    log(debug, false && { check is_even(i); true });
-    even(i); //! ERROR unsatisfied precondition
-}
diff --git a/src/test/compile-fail/tstate-block-uninit.rs b/src/test/compile-fail/tstate-block-uninit.rs
deleted file mode 100644
index 3fbf812a9dcbf..0000000000000
--- a/src/test/compile-fail/tstate-block-uninit.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn force(f: fn()) { f(); }
-
-fn main() {
-    let x: int = 4;
-    force(fn&() {
-        even(x); //! ERROR unsatisfied precondition
-    });
-}
diff --git a/src/test/compile-fail/tstate-break-uninit-2.rs b/src/test/compile-fail/tstate-break-uninit-2.rs
deleted file mode 100644
index 8ea5446c8090b..0000000000000
--- a/src/test/compile-fail/tstate-break-uninit-2.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn foo() -> int {
-    let x: int = 4;
-
-    while 1 != 2 {
-        break;
-        check is_even(x); //! WARNING unreachable statement
-    }
-
-    even(x); //! ERROR unsatisfied precondition
-    ret 17;
-}
-
-fn main() { log(debug, foo()); }
diff --git a/src/test/compile-fail/tstate-break-uninit.rs b/src/test/compile-fail/tstate-break-uninit.rs
deleted file mode 100644
index 55146447b4484..0000000000000
--- a/src/test/compile-fail/tstate-break-uninit.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn foo() -> int {
-    let x: int = 4;
-
-    loop {
-        break;
-        check is_even(x); //! WARNING unreachable statement
-    }
-
-    even(x); //! ERROR unsatisfied precondition
-    ret 17;
-}
-
-fn main() { log(debug, foo()); }
diff --git a/src/test/compile-fail/tstate-ctor-unsat.rs b/src/test/compile-fail/tstate-ctor-unsat.rs
deleted file mode 100644
index d249865cd497d..0000000000000
--- a/src/test/compile-fail/tstate-ctor-unsat.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-class cat {
-  priv {
-    let mut meows : uint;
-  }
-
-  let how_hungry : int;
-
-  fn eat() {
-    self.how_hungry -= 5;
-  }
-
-  new(in_x : uint, in_y : int) {
-    let foo = 3;
-    self.meows = in_x + (in_y as uint);
-    self.how_hungry = even(foo); //! ERROR unsatisfied precondition
-  }
-}
-
-fn main() {
-  let nyan : cat = cat(52u, 99);
-  nyan.eat();
-}
diff --git a/src/test/compile-fail/tstate-fru.rs b/src/test/compile-fail/tstate-fru.rs
deleted file mode 100644
index 70c39d434ff94..0000000000000
--- a/src/test/compile-fail/tstate-fru.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// -*- rust -*-
-
-type point = {x: int, y: int};
-
-pure fn test(_p: point) -> bool { true }
-fn tested(p: point) : test(p) -> point { p }
-
-fn main() {
-    let origin: point;
-    origin = {x: 0, y: 0};
-    let right: point = {x: 10 with tested(origin)};
-        //!^ ERROR precondition
-    copy right;
-}
diff --git a/src/test/compile-fail/tstate-if-no-else.rs b/src/test/compile-fail/tstate-if-no-else.rs
deleted file mode 100644
index fbc02bf591a0e..0000000000000
--- a/src/test/compile-fail/tstate-if-no-else.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn foo(x: int) { log(debug, x); }
-
-fn main() {
-	let x: int = 10;
-        if 1 > 2 { check is_even(x); }
-        even(x); //! ERROR unsatisfied precondition
-}
diff --git a/src/test/compile-fail/tstate-if-with-else.rs b/src/test/compile-fail/tstate-if-with-else.rs
deleted file mode 100644
index 74edb4b8d8b72..0000000000000
--- a/src/test/compile-fail/tstate-if-with-else.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn foo(x: int) { log(debug, x); }
-
-fn main() {
-    let x: int = 10;
-    if 1 > 2 {
-        #debug("whoops");
-    } else {
-        check is_even(x);
-    }
-    even(x); //! ERROR unsatisfied precondition
-}
diff --git a/src/test/compile-fail/tstate-loop-constraints.rs b/src/test/compile-fail/tstate-loop-constraints.rs
deleted file mode 100644
index 34ff0753d86ad..0000000000000
--- a/src/test/compile-fail/tstate-loop-constraints.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn main() {
-
-    let mut x: int = 42;
-    loop {
-        loop {
-            loop {
-                check is_even(x);
-                even(x); // OK
-                loop {
-                    even(x); //! ERROR unsatisfied precondition
-                    x = 11; 
-                }
-            }
-        }
-    }
-}
diff --git a/src/test/compile-fail/tstate-or-init.rs b/src/test/compile-fail/tstate-or-init.rs
deleted file mode 100644
index c26925929a6aa..0000000000000
--- a/src/test/compile-fail/tstate-or-init.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-fn main() {
-    let i: int = 4;
-    log(debug, false || { check is_even(i); true });
-    even(i); //! ERROR unsatisfied precondition
-}
diff --git a/src/test/compile-fail/tstate-return.rs b/src/test/compile-fail/tstate-return.rs
deleted file mode 100644
index 6d786bacd7be3..0000000000000
--- a/src/test/compile-fail/tstate-return.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn f() -> int {
-	let x: int = 4;
-	ret even(x); //! ERROR unsatisfied precondition
-}
-
-fn main() { f(); }
diff --git a/src/test/compile-fail/tstate-unsat-after-item.rs b/src/test/compile-fail/tstate-unsat-after-item.rs
deleted file mode 100644
index b82df3a8657b8..0000000000000
--- a/src/test/compile-fail/tstate-unsat-after-item.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn main() {
-    let x = 4;
-    fn baz(_x: int) { }
-    bind baz(even(x)); //! ERROR unsatisfied precondition
-}
-
diff --git a/src/test/compile-fail/tstate-unsat-in-called-fn-expr.rs b/src/test/compile-fail/tstate-unsat-in-called-fn-expr.rs
deleted file mode 100644
index 010ac92f7b02e..0000000000000
--- a/src/test/compile-fail/tstate-unsat-in-called-fn-expr.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-fn foo(v: [int]) : vec::is_empty(v) { #debug("%d", v[0]); }
-
-fn main() {
-    let f = fn@() {
-        let v = [1];
-        foo(v); //! ERROR unsatisfied precondition constraint
-    }();
-    log(error, f);
-}
diff --git a/src/test/compile-fail/tstate-unsat-in-fn-expr.rs b/src/test/compile-fail/tstate-unsat-in-fn-expr.rs
deleted file mode 100644
index b9cd25825378c..0000000000000
--- a/src/test/compile-fail/tstate-unsat-in-fn-expr.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-fn foo(v: [int]) : vec::is_empty(v) { #debug("%d", v[0]); }
-
-fn main() {
-    let f = fn@() {
-        let v = [1];
-        foo(v); //! ERROR unsatisfied precondition constraint
-    };
-    log(error, f());
-}
diff --git a/src/test/compile-fail/tstate-unsat.rs b/src/test/compile-fail/tstate-unsat.rs
deleted file mode 100644
index 44a3e88fdee76..0000000000000
--- a/src/test/compile-fail/tstate-unsat.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn main() {
-    let x: int = 4;
-    even(x); //! ERROR unsatisfied precondition
-}
diff --git a/src/test/compile-fail/tstate-while-break.rs b/src/test/compile-fail/tstate-while-break.rs
deleted file mode 100644
index 6a25929a85b3b..0000000000000
--- a/src/test/compile-fail/tstate-while-break.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn test(cond: bool) {
-    let v = 4;
-    while cond {
-        check is_even(v);
-        break;
-    }
-    even(v); //! ERROR unsatisfied precondition
-}
-
-fn main() {
-    test(true);
-}
diff --git a/src/test/compile-fail/tstate-while-cond.rs b/src/test/compile-fail/tstate-while-cond.rs
deleted file mode 100644
index ae5436aa4e841..0000000000000
--- a/src/test/compile-fail/tstate-while-cond.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn main() {
-    let x: int = 4;
-    while even(x) != 0 { } //! ERROR unsatisfied precondition
-}
diff --git a/src/test/compile-fail/tstate-while-loop-unsat-constriants.rs b/src/test/compile-fail/tstate-while-loop-unsat-constriants.rs
deleted file mode 100644
index 5fff9aa9cb50c..0000000000000
--- a/src/test/compile-fail/tstate-while-loop-unsat-constriants.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// error-pattern:unsatisfied precondition constraint (for example, even(y
-
-fn print_even(y: int) : even(y) { log(debug, y); }
-
-pure fn even(y: int) -> bool { true }
-
-fn main() {
-
-    let mut y: int = 42;
-    let mut x: int = 1;
-    check (even(y));
-    loop {
-        print_even(y);
-        while true { while true { while true { y += x; } } }
-    }
-}
diff --git a/src/test/compile-fail/tstate-while.rs b/src/test/compile-fail/tstate-while.rs
deleted file mode 100644
index 6091a0237a259..0000000000000
--- a/src/test/compile-fail/tstate-while.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-pure fn is_even(i: int) -> bool { (i%2) == 0 }
-fn even(i: int) : is_even(i) -> int { i }
-
-fn f() {
-    let mut x: int = 10;
-    while 1 == 1 { x = 10; }
-    even(x); //! ERROR unsatisfied precondition
-}
-
-fn main() { f(); }
diff --git a/src/test/run-fail/fn-constraint-claim.rs b/src/test/run-fail/fn-constraint-claim.rs
deleted file mode 100644
index 5a5fa5ea81c2d..0000000000000
--- a/src/test/run-fail/fn-constraint-claim.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// error-pattern:quux
-use std;
-import uint::*;
-
-fn nop(a: uint, b: uint) : le(a, b) { fail "quux"; }
-
-fn main() { let a: uint = 5u; let b: uint = 4u; claim (le(a, b)); nop(a, b); }
diff --git a/src/test/run-fail/fn-constraint.rs b/src/test/run-fail/fn-constraint.rs
deleted file mode 100644
index f24d96e13cc96..0000000000000
--- a/src/test/run-fail/fn-constraint.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// error-pattern:Predicate uint::le(a, b) failed
-
-fn main() unsafe {
-    fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}
-    let a: uint = 4u;
-    let b: uint = 1u;
-    check (uint::le(a, b));
-    log(error, foo(a, b));
-}
diff --git a/src/test/run-fail/if-check-fail.rs b/src/test/run-fail/if-check-fail.rs
deleted file mode 100644
index 31e95d5c385df..0000000000000
--- a/src/test/run-fail/if-check-fail.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// error-pattern:Number is odd
-pure fn even(x: uint) -> bool {
-    if x < 2u {
-        ret false;
-    } else if x == 2u { ret true; } else { ret even(x - 2u); }
-}
-
-fn foo(x: uint) {
-    if check even(x) {
-        log(debug, x);
-    } else {
-        fail "Number is odd";
-    }
-}
-
-fn main() { foo(3u); }
diff --git a/src/test/run-fail/pred.rs b/src/test/run-fail/pred.rs
deleted file mode 100644
index 494bee968f1a4..0000000000000
--- a/src/test/run-fail/pred.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- rust -*-
-// error-pattern:Predicate lt(b, a) failed
-fn f(a: int, b: int) { }
-
-pure fn lt(a: int, b: int) -> bool { ret a < b; }
-
-fn main() { let a: int = 10; let b: int = 23; check (lt(b, a)); f(b, a); }
diff --git a/src/test/run-fail/unwind-check.rs b/src/test/run-fail/unwind-check.rs
deleted file mode 100644
index e01cc969cea61..0000000000000
--- a/src/test/run-fail/unwind-check.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// error-pattern:fail
-
-pure fn p(a: @int) -> bool { false }
-
-fn main() {
-    let a = @0;
-    check p(a);
-}
\ No newline at end of file
diff --git a/src/test/run-fail/zip-different-lengths.rs b/src/test/run-fail/zip-different-lengths.rs
deleted file mode 100644
index 4a5ac59efd294..0000000000000
--- a/src/test/run-fail/zip-different-lengths.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// In this case, the code should compile but
-// the check should fail at runtime
-// error-pattern:Predicate same_length
-use std;
-import uint;
-import u8;
-import vec::*;
-
-fn enum_chars(start: u8, end: u8) -> [char] {
-    assert start < end;
-    let mut i = start;
-    let mut r = [];
-    while i <= end { r += [i as char]; i += 1u as u8; }
-    ret r;
-}
-
-fn enum_uints(start: uint, end: uint) -> [uint] {
-    assert start < end;
-    let mut i = start;
-    let mut r = [];
-    while i <= end { r += [i]; i += 1u; }
-    ret r;
-}
-
-fn main() {
-    let a = 'a' as u8, j = 'j' as u8, k = 1u, l = 9u;
-    // Silly, but necessary
-    check (u8::le(a, j));
-    check (uint::le(k, l));
-    let chars = enum_chars(a, j);
-    let ints = enum_uints(k, l);
-
-    check (same_length(chars, ints));
-    let ps = zip(chars, ints);
-    fail "the impossible happened";
-}
diff --git a/src/test/run-pass/bug-862.rs b/src/test/run-pass/bug-862.rs
deleted file mode 100644
index 8172cae6b47e0..0000000000000
--- a/src/test/run-pass/bug-862.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pure fn p(j: int) -> bool { true }
-
-fn f(i: int, j: int) : p(j) -> int { j }
-
-fn g(i: int, j: int) : p(j) -> int { f(i, j) }
-
-fn main() { let x = 1; check (p(x)); log(debug, g(x, x)); }
diff --git a/src/test/run-pass/check-pattern-bound.rs b/src/test/run-pass/check-pattern-bound.rs
deleted file mode 100644
index fe8a650afe216..0000000000000
--- a/src/test/run-pass/check-pattern-bound.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-use std;
-
-pure fn p(x: int) -> bool { true }
-
-fn f(x: int) : p(x) { }
-
-fn main() {
-    alt some(5) { some(y) { check (p(y)); f(y); } _ { fail "yuck"; } }
-}
diff --git a/src/test/run-pass/claim-nonterm.rs b/src/test/run-pass/claim-nonterm.rs
deleted file mode 100644
index 5f427d185ebf3..0000000000000
--- a/src/test/run-pass/claim-nonterm.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-// tests that the pred in a claim isn't actually eval'd
-use std;
-import uint::*;
-
-pure fn fails(a: uint) -> bool { fail; }
-
-fn main() { let b: uint = 4u; claim (fails(b)); }
diff --git a/src/test/run-pass/constrained-type.rs b/src/test/run-pass/constrained-type.rs
deleted file mode 100644
index c29bcbdfee28e..0000000000000
--- a/src/test/run-pass/constrained-type.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// -*- rust -*-
-
-enum list { cons(int, @list), nil, }
-
-type bubu = {x: int, y: int};
-
-pure fn less_than(x: int, y: int) -> bool { ret x < y; }
-
-type ordered_range = {low: int, high: int}  : less_than(*.low, *.high);
-
-fn main() { }
diff --git a/src/test/run-pass/constraint-prop-expr-move.rs b/src/test/run-pass/constraint-prop-expr-move.rs
deleted file mode 100644
index a2550197d0eb3..0000000000000
--- a/src/test/run-pass/constraint-prop-expr-move.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-
-fn main() unsafe {
-    fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}
-    let a: uint = 1u;
-    let b: uint = 4u;
-    let mut c: uint = 17u;
-    check (uint::le(a, b));
-    c <- a;
-    log(debug, foo(c, b));
-}
diff --git a/src/test/run-pass/constraint-prop-move.rs b/src/test/run-pass/constraint-prop-move.rs
deleted file mode 100644
index a07b60799e887..0000000000000
--- a/src/test/run-pass/constraint-prop-move.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-fn main() unsafe {
-    fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}
-    let a: uint = 1u;
-    let b: uint = 4u;
-    check (uint::le(a, b));
-    let c <- a;
-    log(debug, foo(c, b));
-}
diff --git a/src/test/run-pass/constraint-prop-swap.rs b/src/test/run-pass/constraint-prop-swap.rs
deleted file mode 100644
index 76d6a733e98c0..0000000000000
--- a/src/test/run-pass/constraint-prop-swap.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-fn main() unsafe {
-    fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}
-    let mut a: uint = 4u;
-    let mut b: uint = 1u;
-    check (uint::le(b, a));
-    b <-> a;
-    log(debug, foo(a, b));
-}
diff --git a/src/test/run-pass/constraint-prop.rs b/src/test/run-pass/constraint-prop.rs
deleted file mode 100644
index 6d5808be3d175..0000000000000
--- a/src/test/run-pass/constraint-prop.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-fn main() unsafe {
-    fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}
-    let a: uint = 1u;
-    let b: uint = 4u;
-    check uint::le(a, b);
-    let c = b;
-    log(debug, foo(a, c));
-}
diff --git a/src/test/run-pass/fn-constraint.rs b/src/test/run-pass/fn-constraint.rs
deleted file mode 100644
index 476a6b74a3d83..0000000000000
--- a/src/test/run-pass/fn-constraint.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() unsafe {
-    fn foo(_a: uint, _b: uint) : uint::le(_a, _b) {}
-    let a: uint = 1u;
-    let b: uint = 4u;
-    check (uint::le(a, b));
-    log(debug, foo(a, b));
-}
diff --git a/src/test/run-pass/if-check-precond.rs b/src/test/run-pass/if-check-precond.rs
deleted file mode 100644
index f3d35f52a3aa4..0000000000000
--- a/src/test/run-pass/if-check-precond.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-pure fn even(x: uint) -> bool {
-    if x < 2u {
-        ret false;
-    } else if x == 2u { ret true; } else { ret even(x - 2u); }
-}
-
-fn print_even(x: uint) : even(x) { log(debug, x); }
-
-fn foo(x: uint) { if check even(x) { print_even(x); } else { fail; } }
-
-fn main() { foo(2u); }
diff --git a/src/test/run-pass/if-check.rs b/src/test/run-pass/if-check.rs
deleted file mode 100644
index 5976616401840..0000000000000
--- a/src/test/run-pass/if-check.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-pure fn even(x: uint) -> bool {
-    if x < 2u {
-        ret false;
-    } else if x == 2u { ret true; } else { ret even(x - 2u); }
-}
-
-fn foo(x: uint) {
-    if check even(x) {
-        log(debug, x);
-    } else {
-        fail;
-    }
-}
-
-fn main() { foo(2u); }
diff --git a/src/test/run-pass/issue-933.rs b/src/test/run-pass/issue-933.rs
deleted file mode 100644
index 53d94d3150654..0000000000000
--- a/src/test/run-pass/issue-933.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-pure fn c() -> bool { check c(); true }
-fn main() {}
diff --git a/src/test/run-pass/issue-970.rs b/src/test/run-pass/issue-970.rs
deleted file mode 100644
index 17fa82980a99f..0000000000000
--- a/src/test/run-pass/issue-970.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-enum maybe_ordered_pair {
-    yes({low: int, high: int} : less_than(*.low, *.high)),
-    no
-}
-pure fn less_than(x: int, y: int) -> bool { ret x < y; }
-fn main() { }
diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs
index 86a06ab5aa510..92c9f2d9674bc 100644
--- a/src/test/run-pass/non-boolean-pure-fns.rs
+++ b/src/test/run-pass/non-boolean-pure-fns.rs
@@ -14,15 +14,13 @@ pure fn nonempty_list(ls: @list) -> bool { pure_length(ls) > 0u }
 // knowledge that ls is a cons node. Future work.
 // Also, this is pretty contrived since nonempty_list
 // could be a "enum refinement", if we implement those.
-fn safe_head(ls: @list) : nonempty_list(ls) -> T {
-    check is_not_empty(ls);
+fn safe_head(ls: @list) -> T {
+    assert is_not_empty(ls);
     ret head(ls);
 }
 
 fn main() {
     let mylist = @cons(@1u, @nil);
-    // Again, a way to eliminate such "obvious" checks seems
-    // desirable. (Tags could have postconditions.)
-    check (nonempty_list(mylist));
+    assert (nonempty_list(mylist));
     assert (*safe_head(mylist) == 1u);
 }
diff --git a/src/test/run-pass/pred-check.rs b/src/test/run-pass/pred-check.rs
deleted file mode 100644
index 588288cea2f4f..0000000000000
--- a/src/test/run-pass/pred-check.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-// -*- rust -*-
-pure fn f(q: int) -> bool { ret true; }
-
-fn main() { let x = 0; check (f(x)); }
diff --git a/src/test/run-pass/pred.rs b/src/test/run-pass/pred.rs
deleted file mode 100644
index 212e77cbdc1c3..0000000000000
--- a/src/test/run-pass/pred.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// -*- rust -*-
-fn f(a: int, b: int) { }
-
-pure fn lt(a: int, b: int) -> bool { ret a < b; }
-
-fn main() {
-    let a: int = 10;
-    let b: int = 23;
-    let c: int = 77;
-    check (lt(a, b));
-    check (lt(a, c));
-    f(a, b);
-    f(a, c);
-}
diff --git a/src/test/run-pass/typestate-transitive.rs b/src/test/run-pass/typestate-transitive.rs
deleted file mode 100644
index 632aec5c4d14e..0000000000000
--- a/src/test/run-pass/typestate-transitive.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pure fn p(i: int) -> bool { true }
-
-fn f(i: int) : p(i) -> int { i }
-
-fn g(i: int) : p(i) -> int { f(i) }
-
-fn main() { }
diff --git a/src/test/run-pass/unchecked-predicates.rs b/src/test/run-pass/unchecked-predicates.rs
deleted file mode 100644
index 157a7aca6eaf9..0000000000000
--- a/src/test/run-pass/unchecked-predicates.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Uses foldl to exhibit the unchecked block syntax.
-// TODO: since list's head/tail require the predicate "is_not_empty" now and
-// we have unit tests for list, this test might me not necessary anymore?
-use std;
-
-import std::list::*;
-
-// Can't easily be written as a "pure fn" because there's
-// no syntax for specifying that f is pure.
-fn pure_foldl(ls: @list, u: U, f: fn(T, U) -> U) -> U {
-    alt *ls {
-        nil { u }
-        cons(hd, tl) { f(hd, pure_foldl(tl, f(hd, u), f)) }
-    }
-}
-
-// Shows how to use an "unchecked" block to call a general
-// fn from a pure fn
-pure fn pure_length(ls: @list) -> uint {
-    fn count(_t: T, &&u: uint) -> uint { u + 1u }
-    unchecked{ pure_foldl(ls, 0u, count(_, _)) }
-}
-
-pure fn nonempty_list(ls: @list) -> bool { pure_length(ls) > 0u }
-
-// Of course, the compiler can't take advantage of the
-// knowledge that ls is a cons node. Future work.
-// Also, this is pretty contrived since nonempty_list
-// could be a "enum refinement", if we implement those.
-fn safe_head(ls: @list) : nonempty_list(ls) -> T {
-    check is_not_empty(ls);
-    ret head(ls)
-}
-
-fn main() {
-    let mylist = @cons(@1u, @nil);
-    // Again, a way to eliminate such "obvious" checks seems
-    // desirable. (Tags could have postconditions.)
-    check (nonempty_list(mylist));
-    assert (*safe_head(mylist) == 1u);
-}
diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs
index 0b4e90ae1dfe9..35bdec00e65cb 100644
--- a/src/test/run-pass/weird-exprs.rs
+++ b/src/test/run-pass/weird-exprs.rs
@@ -51,8 +51,8 @@ fn hammertime() -> int {
 
 fn canttouchthis() -> uint {
     pure fn p() -> bool { true }
-    let _a = (assert (true)) == (check (p()));
-    let _c = (check (p())) == ();
+    let _a = (assert (true)) == (assert (p()));
+    let _c = (assert (p())) == ();
     let _b: bool = (log(debug, 0) == (ret 0u));
 }
 
diff --git a/src/test/run-pass/zip-same-length.rs b/src/test/run-pass/zip-same-length.rs
deleted file mode 100644
index 73a0f66d382ea..0000000000000
--- a/src/test/run-pass/zip-same-length.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// In this case, the code should compile and should
-// succeed at runtime
-use std;
-import uint;
-import u8;
-
-import vec::*;
-
-fn enum_chars(start: u8, end: u8) -> [char] {
-    assert start < end;
-    let mut i = start;
-    let mut r = [];
-    while i <= end { r += [i as char]; i += 1u as u8; }
-    ret r;
-}
-
-fn enum_uints(start: uint, end: uint) -> [uint] {
-    assert start < end;
-    let mut i = start;
-    let mut r = [];
-    while i <= end { r += [i]; i += 1u; }
-    ret r;
-}
-
-fn main() {
-    let a = 'a' as u8, j = 'j' as u8, k = 1u, l = 10u;
-    // Silly, but necessary
-    check (u8::le(a, j));
-    check (uint::le(k, l));
-    let chars = enum_chars(a, j);
-    let ints = enum_uints(k, l);
-
-    check (same_length(chars, ints));
-    let ps = zip(chars, ints);
-
-    check (is_not_empty(ps));
-    assert (head(ps) == ('a', 1u));
-    assert (last(ps) == (j as char, 10u));
-}