rustc: de-mode + fallout from libsyntax changes
This commit is contained in:
parent
3c7aea3a6a
commit
1e4a439f7f
@ -48,7 +48,7 @@ pub enum output_type {
|
||||
output_type_exe,
|
||||
}
|
||||
|
||||
pub fn llvm_err(sess: Session, +msg: ~str) -> ! {
|
||||
pub fn llvm_err(sess: Session, msg: ~str) -> ! {
|
||||
unsafe {
|
||||
let cstr = llvm::LLVMRustGetLastError();
|
||||
if cstr == ptr::null() {
|
||||
@ -153,7 +153,7 @@ pub mod jit {
|
||||
code: entry,
|
||||
env: ptr::null()
|
||||
};
|
||||
let func: &fn(++argv: ~[@~str]) = cast::transmute(closure);
|
||||
let func: &fn(argv: ~[@~str]) = cast::transmute(closure);
|
||||
|
||||
func(~[sess.opts.binary]);
|
||||
}
|
||||
@ -519,7 +519,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
|
||||
|
||||
// This calculates CMH as defined above
|
||||
fn crate_meta_extras_hash(symbol_hasher: &hash::State,
|
||||
+cmh_items: ~[@ast::meta_item],
|
||||
cmh_items: ~[@ast::meta_item],
|
||||
dep_hashes: ~[~str]) -> @str {
|
||||
fn len_and_str(s: &str) -> ~str {
|
||||
fmt!("%u_%s", s.len(), s)
|
||||
@ -568,7 +568,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
|
||||
name, default));
|
||||
}
|
||||
|
||||
fn crate_meta_name(sess: Session, output: &Path, +opt_name: Option<@str>)
|
||||
fn crate_meta_name(sess: Session, output: &Path, opt_name: Option<@str>)
|
||||
-> @str {
|
||||
return match opt_name {
|
||||
Some(v) => v,
|
||||
@ -703,7 +703,7 @@ pub fn mangle(sess: Session, ss: path) -> ~str {
|
||||
}
|
||||
|
||||
pub fn exported_name(sess: Session,
|
||||
+path: path,
|
||||
path: path,
|
||||
hash: &str,
|
||||
vers: &str) -> ~str {
|
||||
return mangle(sess,
|
||||
@ -713,7 +713,7 @@ pub fn exported_name(sess: Session,
|
||||
}
|
||||
|
||||
pub fn mangle_exported_name(ccx: @CrateContext,
|
||||
+path: path,
|
||||
path: path,
|
||||
t: ty::t) -> ~str {
|
||||
let hash = get_symbol_hash(ccx, t);
|
||||
return exported_name(ccx.sess, path,
|
||||
@ -733,17 +733,17 @@ pub fn mangle_internal_name_by_type_only(ccx: @CrateContext,
|
||||
}
|
||||
|
||||
pub fn mangle_internal_name_by_path_and_seq(ccx: @CrateContext,
|
||||
+path: path,
|
||||
+flav: ~str) -> ~str {
|
||||
path: path,
|
||||
flav: ~str) -> ~str {
|
||||
return mangle(ccx.sess,
|
||||
vec::append_one(path, path_name((ccx.names)(flav))));
|
||||
}
|
||||
|
||||
pub fn mangle_internal_name_by_path(ccx: @CrateContext, +path: path) -> ~str {
|
||||
pub fn mangle_internal_name_by_path(ccx: @CrateContext, path: path) -> ~str {
|
||||
return mangle(ccx.sess, path);
|
||||
}
|
||||
|
||||
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, +flav: ~str) -> ~str {
|
||||
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, flav: ~str) -> ~str {
|
||||
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
|
||||
}
|
||||
|
||||
@ -768,7 +768,7 @@ pub fn link_binary(sess: Session,
|
||||
out_filename: &Path,
|
||||
lm: LinkMeta) {
|
||||
// Converts a library file-stem into a cc -l argument
|
||||
fn unlib(config: @session::config, +stem: ~str) -> ~str {
|
||||
fn unlib(config: @session::config, stem: ~str) -> ~str {
|
||||
if stem.starts_with("lib") &&
|
||||
config.os != session::os_win32 {
|
||||
stem.slice(3, stem.len()).to_owned()
|
||||
|
@ -55,14 +55,14 @@ pub enum pp_mode {
|
||||
*/
|
||||
pub fn anon_src() -> ~str { ~"<anon>" }
|
||||
|
||||
pub fn source_name(input: input) -> ~str {
|
||||
match input {
|
||||
pub fn source_name(input: &input) -> ~str {
|
||||
match *input {
|
||||
file_input(ref ifile) => ifile.to_str(),
|
||||
str_input(_) => anon_src()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_configuration(sess: Session, argv0: @~str, input: input) ->
|
||||
pub fn default_configuration(sess: Session, argv0: @~str, input: &input) ->
|
||||
ast::crate_cfg {
|
||||
let libc = match sess.targ_cfg.os {
|
||||
session::os_win32 => ~"msvcrt.dll",
|
||||
@ -105,7 +105,7 @@ pub fn default_configuration(sess: Session, argv0: @~str, input: input) ->
|
||||
mk(@~"build_input", @source_name(input))];
|
||||
}
|
||||
|
||||
pub fn append_configuration(+cfg: ast::crate_cfg, +name: ~str)
|
||||
pub fn append_configuration(cfg: ast::crate_cfg, name: ~str)
|
||||
-> ast::crate_cfg {
|
||||
if attr::contains_name(cfg, name) {
|
||||
cfg
|
||||
@ -114,7 +114,7 @@ pub fn append_configuration(+cfg: ast::crate_cfg, +name: ~str)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_configuration(sess: Session, argv0: @~str, input: input) ->
|
||||
pub fn build_configuration(sess: Session, argv0: @~str, input: &input) ->
|
||||
ast::crate_cfg {
|
||||
// Combine the configuration requested by the session (command line) with
|
||||
// some default and generated configuration items
|
||||
@ -132,7 +132,7 @@ pub fn build_configuration(sess: Session, argv0: @~str, input: input) ->
|
||||
}
|
||||
|
||||
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
|
||||
fn parse_cfgspecs(+cfgspecs: ~[~str],
|
||||
fn parse_cfgspecs(cfgspecs: ~[~str],
|
||||
demitter: diagnostic::Emitter) -> ast::crate_cfg {
|
||||
do vec::map_consume(cfgspecs) |s| {
|
||||
let sess = parse::new_parse_sess(Some(demitter));
|
||||
@ -147,9 +147,9 @@ pub enum input {
|
||||
str_input(~str)
|
||||
}
|
||||
|
||||
pub fn parse_input(sess: Session, +cfg: ast::crate_cfg, input: input)
|
||||
pub fn parse_input(sess: Session, cfg: ast::crate_cfg, input: &input)
|
||||
-> @ast::crate {
|
||||
match input {
|
||||
match *input {
|
||||
file_input(ref file) => {
|
||||
parse::parse_crate_from_file_using_tts(&(*file), cfg, sess.parse_sess)
|
||||
}
|
||||
@ -207,10 +207,10 @@ pub fn compile_rest(sess: Session,
|
||||
lint::build_settings_crate(sess, crate));
|
||||
|
||||
let ast_map = time(time_passes, ~"ast indexing", ||
|
||||
syntax::ast_map::map_crate(sess.diagnostic(), *crate));
|
||||
syntax::ast_map::map_crate(sess.diagnostic(), crate));
|
||||
|
||||
time(time_passes, ~"external crate/lib resolution", ||
|
||||
creader::read_crates(sess.diagnostic(), *crate, sess.cstore,
|
||||
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
|
||||
sess.filesearch,
|
||||
session::sess_os_to_meta_os(sess.targ_cfg.os),
|
||||
sess.opts.is_static,
|
||||
@ -344,8 +344,8 @@ pub fn compile_rest(sess: Session,
|
||||
return (crate, None);
|
||||
}
|
||||
|
||||
pub fn compile_upto(sess: Session, +cfg: ast::crate_cfg,
|
||||
input: input, upto: compile_upto,
|
||||
pub fn compile_upto(sess: Session, cfg: ast::crate_cfg,
|
||||
input: &input, upto: compile_upto,
|
||||
outputs: Option<@OutputFilenames>)
|
||||
-> (@ast::crate, Option<ty::ctxt>) {
|
||||
let time_passes = sess.time_passes();
|
||||
@ -356,7 +356,7 @@ pub fn compile_upto(sess: Session, +cfg: ast::crate_cfg,
|
||||
compile_rest(sess, cfg, upto, outputs, Some(crate))
|
||||
}
|
||||
|
||||
pub fn compile_input(sess: Session, +cfg: ast::crate_cfg, input: input,
|
||||
pub fn compile_input(sess: Session, cfg: ast::crate_cfg, input: &input,
|
||||
outdir: &Option<Path>, output: &Option<Path>) {
|
||||
let upto = if sess.opts.parse_only { cu_parse }
|
||||
else if sess.opts.no_trans { cu_no_trans }
|
||||
@ -365,7 +365,7 @@ pub fn compile_input(sess: Session, +cfg: ast::crate_cfg, input: input,
|
||||
compile_upto(sess, cfg, input, upto, Some(outputs));
|
||||
}
|
||||
|
||||
pub fn pretty_print_input(sess: Session, +cfg: ast::crate_cfg, input: input,
|
||||
pub fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: &input,
|
||||
ppm: pp_mode) {
|
||||
fn ann_paren_for_expr(node: pprust::ann_node) {
|
||||
match node {
|
||||
@ -690,7 +690,7 @@ pub fn build_session_(sopts: @session::options,
|
||||
cm);
|
||||
let cstore = @mut cstore::mk_cstore(p_s.interner);
|
||||
let filesearch = filesearch::mk_filesearch(
|
||||
sopts.maybe_sysroot,
|
||||
&sopts.maybe_sysroot,
|
||||
sopts.target_triple,
|
||||
/*bad*/copy sopts.addl_lib_search_paths);
|
||||
let lint_settings = lint::mk_lint_settings();
|
||||
@ -711,13 +711,13 @@ pub fn build_session_(sopts: @session::options,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_pretty(sess: Session, &&name: ~str) -> pp_mode {
|
||||
pub fn parse_pretty(sess: Session, name: &str) -> pp_mode {
|
||||
match name {
|
||||
~"normal" => ppm_normal,
|
||||
~"expanded" => ppm_expanded,
|
||||
~"typed" => ppm_typed,
|
||||
~"expanded,identified" => ppm_expanded_identified,
|
||||
~"identified" => ppm_identified,
|
||||
&"normal" => ppm_normal,
|
||||
&"expanded" => ppm_expanded,
|
||||
&"typed" => ppm_typed,
|
||||
&"expanded,identified" => ppm_expanded_identified,
|
||||
&"identified" => ppm_identified,
|
||||
_ => {
|
||||
sess.fatal(~"argument to `pretty` must be one of `normal`, \
|
||||
`expanded`, `typed`, `identified`, \
|
||||
@ -790,7 +790,7 @@ pub struct OutputFilenames {
|
||||
obj_filename: Path
|
||||
}
|
||||
|
||||
pub fn build_output_filenames(input: input,
|
||||
pub fn build_output_filenames(input: &input,
|
||||
odir: &Option<Path>,
|
||||
ofile: &Option<Path>,
|
||||
sess: Session)
|
||||
@ -820,13 +820,13 @@ pub fn build_output_filenames(input: input,
|
||||
// We want to toss everything after the final '.'
|
||||
let dirpath = match *odir {
|
||||
Some(ref d) => (/*bad*/copy *d),
|
||||
None => match input {
|
||||
None => match *input {
|
||||
str_input(_) => os::getcwd(),
|
||||
file_input(ref ifile) => (*ifile).dir_path()
|
||||
}
|
||||
};
|
||||
|
||||
let stem = match input {
|
||||
let stem = match *input {
|
||||
file_input(ref ifile) => (*ifile).filestem().get(),
|
||||
str_input(_) => ~"rust_out"
|
||||
};
|
||||
@ -903,7 +903,7 @@ mod test {
|
||||
let sessopts = build_session_options(
|
||||
@~"rustc", matches, diagnostic::emit);
|
||||
let sess = build_session(sessopts, diagnostic::emit);
|
||||
let cfg = build_configuration(sess, @~"whatever", str_input(~""));
|
||||
let cfg = build_configuration(sess, @~"whatever", &str_input(~""));
|
||||
assert!((attr::contains_name(cfg, ~"test")));
|
||||
}
|
||||
|
||||
@ -922,7 +922,7 @@ mod test {
|
||||
let sessopts = build_session_options(
|
||||
@~"rustc", matches, diagnostic::emit);
|
||||
let sess = build_session(sessopts, diagnostic::emit);
|
||||
let cfg = build_configuration(sess, @~"whatever", str_input(~""));
|
||||
let cfg = build_configuration(sess, @~"whatever", &str_input(~""));
|
||||
let test_items = attr::find_meta_items_by_name(cfg, ~"test");
|
||||
assert!((vec::len(test_items) == 1u));
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ pub impl Session_ {
|
||||
fn unimpl(@self, msg: ~str) -> ! {
|
||||
self.span_diagnostic.handler().unimpl(msg)
|
||||
}
|
||||
fn span_lint_level(@self, level: lint::level, sp: span, +msg: ~str) {
|
||||
fn span_lint_level(@self, level: lint::level, sp: span, msg: ~str) {
|
||||
match level {
|
||||
lint::allow => { },
|
||||
lint::warn => self.span_warn(sp, msg),
|
||||
@ -228,7 +228,7 @@ pub impl Session_ {
|
||||
expr_id: ast::node_id,
|
||||
item_id: ast::node_id,
|
||||
span: span,
|
||||
+msg: ~str) {
|
||||
msg: ~str) {
|
||||
let level = lint::get_lint_settings_level(
|
||||
self.lint_settings, lint_mode, expr_id, item_id);
|
||||
self.span_lint_level(level, span, msg);
|
||||
@ -278,7 +278,7 @@ pub impl Session_ {
|
||||
fn str_of(@self, id: ast::ident) -> @~str {
|
||||
self.parse_sess.interner.get(id)
|
||||
}
|
||||
fn ident_of(@self, +st: ~str) -> ast::ident {
|
||||
fn ident_of(@self, st: ~str) -> ast::ident {
|
||||
self.parse_sess.interner.intern(@st)
|
||||
}
|
||||
fn intr(@self) -> @syntax::parse::token::ident_interner {
|
||||
@ -361,7 +361,7 @@ mod test {
|
||||
use syntax::ast;
|
||||
use syntax::codemap;
|
||||
|
||||
fn make_crate_type_attr(+t: ~str) -> ast::attribute {
|
||||
fn make_crate_type_attr(t: ~str) -> ast::attribute {
|
||||
codemap::respan(codemap::dummy_sp(), ast::attribute_ {
|
||||
style: ast::attr_outer,
|
||||
value: @codemap::respan(codemap::dummy_sp(),
|
||||
|
@ -15,7 +15,7 @@ use syntax::{ast, fold, attr};
|
||||
use core::option;
|
||||
use core::vec;
|
||||
|
||||
type in_cfg_pred = @fn(+attrs: ~[ast::attribute]) -> bool;
|
||||
type in_cfg_pred = @fn(attrs: ~[ast::attribute]) -> bool;
|
||||
|
||||
struct Context {
|
||||
in_cfg: in_cfg_pred
|
||||
@ -49,12 +49,12 @@ pub fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
|
||||
return res;
|
||||
}
|
||||
|
||||
fn filter_item(cx: @Context, &&item: @ast::item) ->
|
||||
fn filter_item(cx: @Context, item: @ast::item) ->
|
||||
Option<@ast::item> {
|
||||
if item_in_cfg(cx, item) { option::Some(item) } else { option::None }
|
||||
}
|
||||
|
||||
fn filter_view_item(cx: @Context, &&view_item: @ast::view_item
|
||||
fn filter_view_item(cx: @Context, view_item: @ast::view_item
|
||||
)-> Option<@ast::view_item> {
|
||||
if view_item_in_cfg(cx, view_item) {
|
||||
option::Some(view_item)
|
||||
@ -74,7 +74,7 @@ fn fold_mod(cx: @Context, m: &ast::_mod, fld: @fold::ast_fold) -> ast::_mod {
|
||||
}
|
||||
}
|
||||
|
||||
fn filter_foreign_item(cx: @Context, &&item: @ast::foreign_item) ->
|
||||
fn filter_foreign_item(cx: @Context, item: @ast::foreign_item) ->
|
||||
Option<@ast::foreign_item> {
|
||||
if foreign_item_in_cfg(cx, item) {
|
||||
option::Some(item)
|
||||
@ -115,7 +115,7 @@ fn fold_item_underscore(cx: @Context, item: &ast::item_,
|
||||
fold::noop_fold_item_underscore(&item, fld)
|
||||
}
|
||||
|
||||
fn filter_stmt(cx: @Context, &&stmt: @ast::stmt) ->
|
||||
fn filter_stmt(cx: @Context, stmt: @ast::stmt) ->
|
||||
Option<@ast::stmt> {
|
||||
match stmt.node {
|
||||
ast::stmt_decl(decl, _) => {
|
||||
@ -173,12 +173,12 @@ fn trait_method_in_cfg(cx: @Context, meth: &ast::trait_method) -> bool {
|
||||
|
||||
// Determine if an item should be translated in the current crate
|
||||
// configuration based on the item's attributes
|
||||
fn in_cfg(+cfg: ast::crate_cfg, +attrs: ~[ast::attribute]) -> bool {
|
||||
fn in_cfg(cfg: ast::crate_cfg, attrs: ~[ast::attribute]) -> bool {
|
||||
metas_in_cfg(cfg, attr::attr_metas(attrs))
|
||||
}
|
||||
|
||||
pub fn metas_in_cfg(cfg: ast::crate_cfg,
|
||||
+metas: ~[@ast::meta_item]) -> bool {
|
||||
metas: ~[@ast::meta_item]) -> bool {
|
||||
// The "cfg" attributes on the item
|
||||
let cfg_metas = attr::find_meta_items_by_name(metas, ~"cfg");
|
||||
|
||||
|
@ -138,7 +138,7 @@ fn fold_crate(cx: @mut TestCtxt,
|
||||
}
|
||||
|
||||
|
||||
fn fold_item(cx: @mut TestCtxt, &&i: @ast::item, fld: @fold::ast_fold)
|
||||
fn fold_item(cx: @mut TestCtxt, i: @ast::item, fld: @fold::ast_fold)
|
||||
-> Option<@ast::item> {
|
||||
cx.path.push(i.ident);
|
||||
debug!("current path: %s",
|
||||
@ -336,7 +336,7 @@ fn nospan<T:Copy>(t: T) -> codemap::spanned<T> {
|
||||
codemap::spanned { node: t, span: dummy_sp() }
|
||||
}
|
||||
|
||||
fn path_node(+ids: ~[ast::ident]) -> @ast::Path {
|
||||
fn path_node(ids: ~[ast::ident]) -> @ast::Path {
|
||||
@ast::Path { span: dummy_sp(),
|
||||
global: false,
|
||||
idents: ids,
|
||||
@ -344,7 +344,7 @@ fn path_node(+ids: ~[ast::ident]) -> @ast::Path {
|
||||
types: ~[] }
|
||||
}
|
||||
|
||||
fn path_node_global(+ids: ~[ast::ident]) -> @ast::Path {
|
||||
fn path_node_global(ids: ~[ast::ident]) -> @ast::Path {
|
||||
@ast::Path { span: dummy_sp(),
|
||||
global: true,
|
||||
idents: ids,
|
||||
@ -381,7 +381,7 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::expr {
|
||||
debug!("building test vector from %u tests", cx.testfns.len());
|
||||
let mut descs = ~[];
|
||||
for cx.testfns.each |test| {
|
||||
descs.push(mk_test_desc_and_fn_rec(cx, *test));
|
||||
descs.push(mk_test_desc_and_fn_rec(cx, test));
|
||||
}
|
||||
|
||||
let sess = cx.sess;
|
||||
@ -400,7 +400,7 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::expr {
|
||||
}
|
||||
}
|
||||
|
||||
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: Test) -> @ast::expr {
|
||||
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
|
||||
let span = test.span;
|
||||
let path = /*bad*/copy test.path;
|
||||
|
||||
|
@ -1929,7 +1929,7 @@ pub fn type_to_str(names: @TypeNames, ty: TypeRef) -> @str {
|
||||
return type_to_str_inner(names, [], ty);
|
||||
}
|
||||
|
||||
pub fn type_to_str_inner(names: @TypeNames, +outer0: &[TypeRef], ty: TypeRef)
|
||||
pub fn type_to_str_inner(names: @TypeNames, outer0: &[TypeRef], ty: TypeRef)
|
||||
-> @str {
|
||||
unsafe {
|
||||
match type_has_name(names, ty) {
|
||||
|
@ -30,7 +30,7 @@ use syntax::ast;
|
||||
// Traverses an AST, reading all the information about use'd crates and extern
|
||||
// libraries necessary for later resolving, typechecking, linking, etc.
|
||||
pub fn read_crates(diag: @span_handler,
|
||||
crate: ast::crate,
|
||||
crate: @ast::crate,
|
||||
cstore: @mut cstore::CStore,
|
||||
filesearch: @FileSearch,
|
||||
os: loader::os,
|
||||
@ -126,7 +126,7 @@ struct Env {
|
||||
intr: @ident_interner
|
||||
}
|
||||
|
||||
fn visit_crate(e: @mut Env, c: ast::crate) {
|
||||
fn visit_crate(e: @mut Env, c: &ast::crate) {
|
||||
let cstore = e.cstore;
|
||||
let link_args = attr::find_attrs_by_name(c.node.attrs, "link_args");
|
||||
|
||||
@ -204,7 +204,7 @@ fn visit_item(e: @mut Env, i: @ast::item) {
|
||||
}
|
||||
}
|
||||
|
||||
fn metas_with(ident: @~str, key: @~str, +metas: ~[@ast::meta_item])
|
||||
fn metas_with(ident: @~str, key: @~str, metas: ~[@ast::meta_item])
|
||||
-> ~[@ast::meta_item] {
|
||||
let name_items = attr::find_meta_items_by_name(metas, *key);
|
||||
if name_items.is_empty() {
|
||||
@ -214,7 +214,7 @@ fn metas_with(ident: @~str, key: @~str, +metas: ~[@ast::meta_item])
|
||||
}
|
||||
}
|
||||
|
||||
fn metas_with_ident(ident: @~str, +metas: ~[@ast::meta_item])
|
||||
fn metas_with_ident(ident: @~str, metas: ~[@ast::meta_item])
|
||||
-> ~[@ast::meta_item] {
|
||||
metas_with(ident, @~"name", metas)
|
||||
}
|
||||
@ -232,7 +232,7 @@ fn existing_match(e: @mut Env, metas: &[@ast::meta_item], hash: @~str)
|
||||
|
||||
fn resolve_crate(e: @mut Env,
|
||||
ident: ast::ident,
|
||||
+metas: ~[@ast::meta_item],
|
||||
metas: ~[@ast::meta_item],
|
||||
hash: @~str,
|
||||
span: span)
|
||||
-> ast::crate_num {
|
||||
@ -251,7 +251,7 @@ fn resolve_crate(e: @mut Env,
|
||||
is_static: e.statik,
|
||||
intr: e.intr
|
||||
};
|
||||
let (lident, ldata) = loader::load_library_crate(load_ctxt);
|
||||
let (lident, ldata) = loader::load_library_crate(&load_ctxt);
|
||||
|
||||
let cfilename = Path(lident);
|
||||
let cdata = ldata;
|
||||
|
@ -53,7 +53,7 @@ use writer = std::ebml::writer;
|
||||
type abbrev_map = @mut HashMap<ty::t, tyencode::ty_abbrev>;
|
||||
|
||||
pub type encode_inlined_item = @fn(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
path: &[ast_map::path_elt],
|
||||
ii: ast::inlined_item);
|
||||
|
||||
@ -101,31 +101,31 @@ pub fn reachable(ecx: @EncodeContext, id: node_id) -> bool {
|
||||
ecx.reachable.contains(&id)
|
||||
}
|
||||
|
||||
fn encode_name(ecx: @EncodeContext, ebml_w: writer::Encoder, name: ident) {
|
||||
fn encode_name(ecx: @EncodeContext, ebml_w: &writer::Encoder, name: ident) {
|
||||
ebml_w.wr_tagged_str(tag_paths_data_name, *ecx.tcx.sess.str_of(name));
|
||||
}
|
||||
|
||||
fn encode_impl_type_basename(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_impl_type_basename(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
name: ident) {
|
||||
ebml_w.wr_tagged_str(tag_item_impl_type_basename,
|
||||
*ecx.tcx.sess.str_of(name));
|
||||
}
|
||||
|
||||
pub fn encode_def_id(ebml_w: writer::Encoder, id: def_id) {
|
||||
pub fn encode_def_id(ebml_w: &writer::Encoder, id: def_id) {
|
||||
ebml_w.wr_tagged_str(tag_def_id, def_to_str(id));
|
||||
}
|
||||
|
||||
fn encode_region_param(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_region_param(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
it: @ast::item) {
|
||||
let opt_rp = ecx.tcx.region_paramd_items.find(&it.id);
|
||||
for opt_rp.each |rp| {
|
||||
do ebml_w.wr_tag(tag_region_param) {
|
||||
(*rp).encode(&ebml_w);
|
||||
rp.encode(ebml_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_mutability(ebml_w: writer::Encoder, mt: struct_mutability) {
|
||||
fn encode_mutability(ebml_w: &writer::Encoder, mt: struct_mutability) {
|
||||
do ebml_w.wr_tag(tag_struct_mut) {
|
||||
let val = match mt {
|
||||
struct_immutable => 'a',
|
||||
@ -140,7 +140,7 @@ struct entry<T> {
|
||||
pos: uint
|
||||
}
|
||||
|
||||
fn add_to_index(ecx: @EncodeContext, ebml_w: writer::Encoder, path: &[ident],
|
||||
fn add_to_index(ecx: @EncodeContext, ebml_w: &writer::Encoder, path: &[ident],
|
||||
index: &mut ~[entry<~str>], name: ident) {
|
||||
let mut full_path = ~[];
|
||||
full_path.push_all(path);
|
||||
@ -153,7 +153,7 @@ fn add_to_index(ecx: @EncodeContext, ebml_w: writer::Encoder, path: &[ident],
|
||||
});
|
||||
}
|
||||
|
||||
fn encode_trait_ref(ebml_w: writer::Encoder,
|
||||
fn encode_trait_ref(ebml_w: &writer::Encoder,
|
||||
ecx: @EncodeContext,
|
||||
trait_ref: &ty::TraitRef,
|
||||
tag: uint)
|
||||
@ -171,7 +171,7 @@ fn encode_trait_ref(ebml_w: writer::Encoder,
|
||||
}
|
||||
|
||||
// Item info table encoding
|
||||
fn encode_family(ebml_w: writer::Encoder, c: char) {
|
||||
fn encode_family(ebml_w: &writer::Encoder, c: char) {
|
||||
ebml_w.start_tag(tag_items_data_item_family);
|
||||
ebml_w.writer.write(&[c as u8]);
|
||||
ebml_w.end_tag();
|
||||
@ -179,7 +179,7 @@ fn encode_family(ebml_w: writer::Encoder, c: char) {
|
||||
|
||||
pub fn def_to_str(did: def_id) -> ~str { fmt!("%d:%d", did.crate, did.node) }
|
||||
|
||||
fn encode_ty_type_param_defs(ebml_w: writer::Encoder,
|
||||
fn encode_ty_type_param_defs(ebml_w: &writer::Encoder,
|
||||
ecx: @EncodeContext,
|
||||
params: @~[ty::TypeParameterDef],
|
||||
tag: uint) {
|
||||
@ -196,7 +196,7 @@ fn encode_ty_type_param_defs(ebml_w: writer::Encoder,
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_type_param_bounds(ebml_w: writer::Encoder,
|
||||
fn encode_type_param_bounds(ebml_w: &writer::Encoder,
|
||||
ecx: @EncodeContext,
|
||||
params: &OptVec<TyParam>) {
|
||||
let ty_param_defs =
|
||||
@ -206,13 +206,13 @@ fn encode_type_param_bounds(ebml_w: writer::Encoder,
|
||||
}
|
||||
|
||||
|
||||
fn encode_variant_id(ebml_w: writer::Encoder, vid: def_id) {
|
||||
fn encode_variant_id(ebml_w: &writer::Encoder, vid: def_id) {
|
||||
ebml_w.start_tag(tag_items_data_item_variant);
|
||||
ebml_w.writer.write(str::to_bytes(def_to_str(vid)));
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
pub fn write_type(ecx: @EncodeContext, ebml_w: writer::Encoder, typ: ty::t) {
|
||||
pub fn write_type(ecx: @EncodeContext, ebml_w: &writer::Encoder, typ: ty::t) {
|
||||
let ty_str_ctxt = @tyencode::ctxt {
|
||||
diag: ecx.diag,
|
||||
ds: def_to_str,
|
||||
@ -222,7 +222,7 @@ pub fn write_type(ecx: @EncodeContext, ebml_w: writer::Encoder, typ: ty::t) {
|
||||
tyencode::enc_ty(ebml_w.writer, ty_str_ctxt, typ);
|
||||
}
|
||||
|
||||
pub fn write_vstore(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
pub fn write_vstore(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
vstore: ty::vstore) {
|
||||
let ty_str_ctxt = @tyencode::ctxt {
|
||||
diag: ecx.diag,
|
||||
@ -233,14 +233,14 @@ pub fn write_vstore(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
tyencode::enc_vstore(ebml_w.writer, ty_str_ctxt, vstore);
|
||||
}
|
||||
|
||||
fn encode_type(ecx: @EncodeContext, ebml_w: writer::Encoder, typ: ty::t) {
|
||||
fn encode_type(ecx: @EncodeContext, ebml_w: &writer::Encoder, typ: ty::t) {
|
||||
ebml_w.start_tag(tag_items_data_item_type);
|
||||
write_type(ecx, ebml_w, typ);
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_transformed_self_ty(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
opt_typ: Option<ty::t>)
|
||||
{
|
||||
for opt_typ.each |&typ| {
|
||||
@ -251,7 +251,7 @@ fn encode_transformed_self_ty(ecx: @EncodeContext,
|
||||
}
|
||||
|
||||
fn encode_method_fty(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
typ: &ty::BareFnTy)
|
||||
{
|
||||
ebml_w.start_tag(tag_item_method_fty);
|
||||
@ -267,7 +267,7 @@ fn encode_method_fty(ecx: @EncodeContext,
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_symbol(ecx: @EncodeContext, ebml_w: writer::Encoder, id: node_id) {
|
||||
fn encode_symbol(ecx: @EncodeContext, ebml_w: &writer::Encoder, id: node_id) {
|
||||
ebml_w.start_tag(tag_items_data_item_symbol);
|
||||
match ecx.item_symbols.find(&id) {
|
||||
Some(x) => {
|
||||
@ -282,27 +282,27 @@ fn encode_symbol(ecx: @EncodeContext, ebml_w: writer::Encoder, id: node_id) {
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_discriminant(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_discriminant(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
id: node_id) {
|
||||
ebml_w.start_tag(tag_items_data_item_symbol);
|
||||
ebml_w.writer.write(str::to_bytes(**ecx.discrim_symbols.get(&id)));
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_disr_val(_ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_disr_val(_ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
disr_val: int) {
|
||||
ebml_w.start_tag(tag_disr_val);
|
||||
ebml_w.writer.write(str::to_bytes(int::to_str(disr_val)));
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_parent_item(ebml_w: writer::Encoder, id: def_id) {
|
||||
fn encode_parent_item(ebml_w: &writer::Encoder, id: def_id) {
|
||||
ebml_w.start_tag(tag_items_data_parent_item);
|
||||
ebml_w.writer.write(str::to_bytes(def_to_str(id)));
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_enum_variant_info(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_enum_variant_info(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
id: node_id, variants: &[variant],
|
||||
path: &[ast_map::path_elt],
|
||||
index: @mut ~[entry<int>],
|
||||
@ -343,9 +343,9 @@ fn encode_enum_variant_info(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_path(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_path(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
path: &[ast_map::path_elt], name: ast_map::path_elt) {
|
||||
fn encode_path_elt(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_path_elt(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
elt: ast_map::path_elt) {
|
||||
let (tag, name) = match elt {
|
||||
ast_map::path_mod(name) => (tag_path_elt_mod, name),
|
||||
@ -364,7 +364,7 @@ fn encode_path(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_info_for_mod(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_info_for_mod(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
md: &_mod, id: node_id, path: &[ast_map::path_elt],
|
||||
name: ident) {
|
||||
ebml_w.start_tag(tag_items_data_item);
|
||||
@ -422,7 +422,7 @@ fn encode_info_for_mod(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_struct_field_family(ebml_w: writer::Encoder,
|
||||
fn encode_struct_field_family(ebml_w: &writer::Encoder,
|
||||
visibility: visibility) {
|
||||
encode_family(ebml_w, match visibility {
|
||||
public => 'g',
|
||||
@ -431,7 +431,7 @@ fn encode_struct_field_family(ebml_w: writer::Encoder,
|
||||
});
|
||||
}
|
||||
|
||||
fn encode_visibility(ebml_w: writer::Encoder, visibility: visibility) {
|
||||
fn encode_visibility(ebml_w: &writer::Encoder, visibility: visibility) {
|
||||
ebml_w.start_tag(tag_items_data_item_visibility);
|
||||
let ch = match visibility {
|
||||
public => 'y',
|
||||
@ -442,7 +442,7 @@ fn encode_visibility(ebml_w: writer::Encoder, visibility: visibility) {
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
|
||||
fn encode_self_type(ebml_w: &writer::Encoder, self_type: ast::self_ty_) {
|
||||
ebml_w.start_tag(tag_item_trait_method_self_ty);
|
||||
|
||||
// Encode the base self type.
|
||||
@ -470,7 +470,7 @@ fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
|
||||
|
||||
ebml_w.end_tag();
|
||||
|
||||
fn encode_mutability(ebml_w: writer::Encoder,
|
||||
fn encode_mutability(ebml_w: &writer::Encoder,
|
||||
m: ast::mutability) {
|
||||
match m {
|
||||
m_imm => {
|
||||
@ -486,14 +486,14 @@ fn encode_self_type(ebml_w: writer::Encoder, self_type: ast::self_ty_) {
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_method_sort(ebml_w: writer::Encoder, sort: char) {
|
||||
fn encode_method_sort(ebml_w: &writer::Encoder, sort: char) {
|
||||
ebml_w.start_tag(tag_item_trait_method_sort);
|
||||
ebml_w.writer.write(&[ sort as u8 ]);
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
/* Returns an index of items in this class */
|
||||
fn encode_info_for_struct(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_info_for_struct(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
path: &[ast_map::path_elt],
|
||||
fields: &[@struct_field],
|
||||
global_index: @mut~[entry<int>]) -> ~[entry<int>] {
|
||||
@ -532,7 +532,7 @@ fn encode_info_for_struct(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
|
||||
// This is for encoding info for ctors and dtors
|
||||
fn encode_info_for_ctor(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
id: node_id,
|
||||
ident: ident,
|
||||
path: &[ast_map::path_elt],
|
||||
@ -550,8 +550,8 @@ fn encode_info_for_ctor(ecx: @EncodeContext,
|
||||
encode_type(ecx, ebml_w, its_ty);
|
||||
encode_path(ecx, ebml_w, path, ast_map::path_name(ident));
|
||||
match item {
|
||||
Some(ref it) => {
|
||||
(ecx.encode_inlined_item)(ecx, ebml_w, path, (*it));
|
||||
Some(it) => {
|
||||
(ecx.encode_inlined_item)(ecx, ebml_w, path, it);
|
||||
}
|
||||
None => {
|
||||
encode_symbol(ecx, ebml_w, id);
|
||||
@ -561,7 +561,7 @@ fn encode_info_for_ctor(ecx: @EncodeContext,
|
||||
}
|
||||
|
||||
fn encode_info_for_struct_ctor(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
path: &[ast_map::path_elt],
|
||||
name: ast::ident,
|
||||
ctor_id: node_id,
|
||||
@ -583,7 +583,7 @@ fn encode_info_for_struct_ctor(ecx: @EncodeContext,
|
||||
}
|
||||
|
||||
fn encode_method_ty_fields(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
method_ty: &ty::method)
|
||||
{
|
||||
encode_def_id(ebml_w, method_ty.def_id);
|
||||
@ -598,7 +598,7 @@ fn encode_method_ty_fields(ecx: @EncodeContext,
|
||||
}
|
||||
|
||||
fn encode_info_for_method(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
impl_path: &[ast_map::path_elt],
|
||||
should_inline: bool,
|
||||
parent_id: node_id,
|
||||
@ -669,7 +669,7 @@ fn should_inline(attrs: &[attribute]) -> bool {
|
||||
}
|
||||
|
||||
|
||||
fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_info_for_item(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
item: @item, index: @mut ~[entry<int>],
|
||||
path: &[ast_map::path_elt]) {
|
||||
|
||||
@ -682,7 +682,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
};
|
||||
if !must_write && !reachable(ecx, item.id) { return; }
|
||||
|
||||
fn add_to_index_(item: @item, ebml_w: writer::Encoder,
|
||||
fn add_to_index_(item: @item, ebml_w: &writer::Encoder,
|
||||
index: @mut ~[entry<int>]) {
|
||||
index.push(entry { val: item.id, pos: ebml_w.writer.tell() });
|
||||
}
|
||||
@ -998,10 +998,10 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
}
|
||||
|
||||
fn encode_info_for_foreign_item(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
nitem: @foreign_item,
|
||||
index: @mut ~[entry<int>],
|
||||
+path: ast_map::path,
|
||||
path: ast_map::path,
|
||||
abi: AbiSet) {
|
||||
if !reachable(ecx, nitem.id) { return; }
|
||||
index.push(entry { val: nitem.id, pos: ebml_w.writer.tell() });
|
||||
@ -1031,7 +1031,7 @@ fn encode_info_for_foreign_item(ecx: @EncodeContext,
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_info_for_items(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_info_for_items(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
crate: &crate) -> ~[entry<int>] {
|
||||
let index = @mut ~[];
|
||||
ebml_w.start_tag(tag_items_data);
|
||||
@ -1039,15 +1039,15 @@ fn encode_info_for_items(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
encode_info_for_mod(ecx, ebml_w, &crate.node.module,
|
||||
crate_node_id, ~[],
|
||||
syntax::parse::token::special_idents::invalid);
|
||||
visit::visit_crate(*crate, (), visit::mk_vt(@visit::Visitor {
|
||||
visit::visit_crate(crate, (), visit::mk_vt(@visit::Visitor {
|
||||
visit_expr: |_e, _cx, _v| { },
|
||||
visit_item: {
|
||||
let ebml_w = copy ebml_w;
|
||||
let ebml_w = copy *ebml_w;
|
||||
|i, cx, v| {
|
||||
visit::visit_item(i, cx, v);
|
||||
match *ecx.tcx.items.get(&i.id) {
|
||||
ast_map::node_item(_, pt) => {
|
||||
encode_info_for_item(ecx, ebml_w, i,
|
||||
encode_info_for_item(ecx, &ebml_w, i,
|
||||
index, *pt);
|
||||
}
|
||||
_ => fail!(~"bad item")
|
||||
@ -1055,12 +1055,12 @@ fn encode_info_for_items(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
}
|
||||
},
|
||||
visit_foreign_item: {
|
||||
let ebml_w = copy ebml_w;
|
||||
let ebml_w = copy *ebml_w;
|
||||
|ni, cx, v| {
|
||||
visit::visit_foreign_item(ni, cx, v);
|
||||
match *ecx.tcx.items.get(&ni.id) {
|
||||
ast_map::node_foreign_item(_, abi, _, pt) => {
|
||||
encode_info_for_foreign_item(ecx, ebml_w, ni,
|
||||
encode_info_for_foreign_item(ecx, &ebml_w, ni,
|
||||
index, /*bad*/copy *pt,
|
||||
abi);
|
||||
}
|
||||
@ -1094,8 +1094,8 @@ fn create_index<T:Copy + Hash + IterBytes>(index: ~[entry<T>]) ->
|
||||
return buckets_frozen;
|
||||
}
|
||||
|
||||
fn encode_index<T>(ebml_w: writer::Encoder, buckets: ~[@~[entry<T>]],
|
||||
write_fn: &fn(@io::Writer, T)) {
|
||||
fn encode_index<T>(ebml_w: &writer::Encoder, buckets: ~[@~[entry<T>]],
|
||||
write_fn: &fn(@io::Writer, &T)) {
|
||||
let writer = ebml_w.writer;
|
||||
ebml_w.start_tag(tag_index);
|
||||
let mut bucket_locs: ~[uint] = ~[];
|
||||
@ -1107,7 +1107,7 @@ fn encode_index<T>(ebml_w: writer::Encoder, buckets: ~[@~[entry<T>]],
|
||||
ebml_w.start_tag(tag_index_buckets_bucket_elt);
|
||||
assert!(elt.pos < 0xffff_ffff);
|
||||
writer.write_be_u32(elt.pos as u32);
|
||||
write_fn(writer, elt.val);
|
||||
write_fn(writer, &elt.val);
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
ebml_w.end_tag();
|
||||
@ -1122,14 +1122,14 @@ fn encode_index<T>(ebml_w: writer::Encoder, buckets: ~[@~[entry<T>]],
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn write_str(writer: @io::Writer, &&s: ~str) { writer.write_str(s); }
|
||||
fn write_str(writer: @io::Writer, s: ~str) { writer.write_str(s); }
|
||||
|
||||
fn write_int(writer: @io::Writer, &&n: int) {
|
||||
fn write_int(writer: @io::Writer, &n: &int) {
|
||||
assert!(n < 0x7fff_ffff);
|
||||
writer.write_be_u32(n as u32);
|
||||
}
|
||||
|
||||
fn encode_meta_item(ebml_w: writer::Encoder, mi: @meta_item) {
|
||||
fn encode_meta_item(ebml_w: &writer::Encoder, mi: @meta_item) {
|
||||
match mi.node {
|
||||
meta_word(name) => {
|
||||
ebml_w.start_tag(tag_meta_item_word);
|
||||
@ -1166,7 +1166,7 @@ fn encode_meta_item(ebml_w: writer::Encoder, mi: @meta_item) {
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_attributes(ebml_w: writer::Encoder, attrs: &[attribute]) {
|
||||
fn encode_attributes(ebml_w: &writer::Encoder, attrs: &[attribute]) {
|
||||
ebml_w.start_tag(tag_attributes);
|
||||
for attrs.each |attr| {
|
||||
ebml_w.start_tag(tag_attribute);
|
||||
@ -1183,7 +1183,7 @@ fn encode_attributes(ebml_w: writer::Encoder, attrs: &[attribute]) {
|
||||
fn synthesize_crate_attrs(ecx: @EncodeContext,
|
||||
crate: &crate) -> ~[attribute] {
|
||||
|
||||
fn synthesize_link_attr(ecx: @EncodeContext, +items: ~[@meta_item]) ->
|
||||
fn synthesize_link_attr(ecx: @EncodeContext, items: ~[@meta_item]) ->
|
||||
attribute {
|
||||
|
||||
assert!(!ecx.link_meta.name.is_empty());
|
||||
@ -1231,7 +1231,7 @@ fn synthesize_crate_attrs(ecx: @EncodeContext,
|
||||
}
|
||||
|
||||
fn encode_crate_deps(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
cstore: @mut cstore::CStore) {
|
||||
fn get_ordered_deps(ecx: @EncodeContext, cstore: @mut cstore::CStore)
|
||||
-> ~[decoder::crate_dep] {
|
||||
@ -1272,7 +1272,7 @@ fn encode_crate_deps(ecx: @EncodeContext,
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_lang_items(ecx: @EncodeContext, ebml_w: writer::Encoder) {
|
||||
fn encode_lang_items(ecx: @EncodeContext, ebml_w: &writer::Encoder) {
|
||||
ebml_w.start_tag(tag_lang_items);
|
||||
|
||||
for ecx.tcx.lang_items.each_item |def_id, i| {
|
||||
@ -1297,7 +1297,7 @@ fn encode_lang_items(ecx: @EncodeContext, ebml_w: writer::Encoder) {
|
||||
}
|
||||
|
||||
fn encode_link_args(ecx: @EncodeContext,
|
||||
ebml_w: writer::Encoder) {
|
||||
ebml_w: &writer::Encoder) {
|
||||
ebml_w.start_tag(tag_link_args);
|
||||
|
||||
let link_args = cstore::get_used_link_args(ecx.cstore);
|
||||
@ -1310,7 +1310,7 @@ fn encode_link_args(ecx: @EncodeContext,
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_crate_dep(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
fn encode_crate_dep(ecx: @EncodeContext, ebml_w: &writer::Encoder,
|
||||
dep: decoder::crate_dep) {
|
||||
ebml_w.start_tag(tag_crate_dep);
|
||||
ebml_w.start_tag(tag_crate_dep_name);
|
||||
@ -1325,7 +1325,7 @@ fn encode_crate_dep(ecx: @EncodeContext, ebml_w: writer::Encoder,
|
||||
ebml_w.end_tag();
|
||||
}
|
||||
|
||||
fn encode_hash(ebml_w: writer::Encoder, hash: &str) {
|
||||
fn encode_hash(ebml_w: &writer::Encoder, hash: &str) {
|
||||
ebml_w.start_tag(tag_crate_hash);
|
||||
ebml_w.writer.write(str::to_bytes(hash));
|
||||
ebml_w.end_tag();
|
||||
@ -1339,7 +1339,7 @@ pub static metadata_encoding_version : &'static [u8] =
|
||||
0x74, //'t' as u8,
|
||||
0, 0, 0, 1 ];
|
||||
|
||||
pub fn encode_metadata(+parms: EncodeParams, crate: &crate) -> ~[u8] {
|
||||
pub fn encode_metadata(parms: EncodeParams, crate: &crate) -> ~[u8] {
|
||||
let wr = @io::BytesWriter();
|
||||
let mut stats = Stats {
|
||||
inline_bytes: 0,
|
||||
@ -1372,36 +1372,36 @@ pub fn encode_metadata(+parms: EncodeParams, crate: &crate) -> ~[u8] {
|
||||
|
||||
let ebml_w = writer::Encoder(wr as @io::Writer);
|
||||
|
||||
encode_hash(ebml_w, ecx.link_meta.extras_hash);
|
||||
encode_hash(&ebml_w, ecx.link_meta.extras_hash);
|
||||
|
||||
let mut i = wr.pos;
|
||||
let crate_attrs = synthesize_crate_attrs(ecx, crate);
|
||||
encode_attributes(ebml_w, crate_attrs);
|
||||
encode_attributes(&ebml_w, crate_attrs);
|
||||
ecx.stats.attr_bytes = wr.pos - i;
|
||||
|
||||
i = wr.pos;
|
||||
encode_crate_deps(ecx, ebml_w, ecx.cstore);
|
||||
encode_crate_deps(ecx, &ebml_w, ecx.cstore);
|
||||
ecx.stats.dep_bytes = wr.pos - i;
|
||||
|
||||
// Encode the language items.
|
||||
i = wr.pos;
|
||||
encode_lang_items(ecx, ebml_w);
|
||||
encode_lang_items(ecx, &ebml_w);
|
||||
ecx.stats.lang_item_bytes = wr.pos - i;
|
||||
|
||||
// Encode the link args.
|
||||
i = wr.pos;
|
||||
encode_link_args(ecx, ebml_w);
|
||||
encode_link_args(ecx, &ebml_w);
|
||||
ecx.stats.link_args_bytes = wr.pos - i;
|
||||
|
||||
// Encode and index the items.
|
||||
ebml_w.start_tag(tag_items);
|
||||
i = wr.pos;
|
||||
let items_index = encode_info_for_items(ecx, ebml_w, crate);
|
||||
let items_index = encode_info_for_items(ecx, &ebml_w, crate);
|
||||
ecx.stats.item_bytes = wr.pos - i;
|
||||
|
||||
i = wr.pos;
|
||||
let items_buckets = create_index(items_index);
|
||||
encode_index(ebml_w, items_buckets, write_int);
|
||||
encode_index(&ebml_w, items_buckets, write_int);
|
||||
ecx.stats.index_bytes = wr.pos - i;
|
||||
ebml_w.end_tag();
|
||||
|
||||
|
@ -35,9 +35,9 @@ pub trait FileSearch {
|
||||
fn get_target_lib_file_path(&self, file: &Path) -> Path;
|
||||
}
|
||||
|
||||
pub fn mk_filesearch(maybe_sysroot: Option<Path>,
|
||||
pub fn mk_filesearch(maybe_sysroot: &Option<Path>,
|
||||
target_triple: &str,
|
||||
+addl_lib_search_paths: ~[Path])
|
||||
addl_lib_search_paths: ~[Path])
|
||||
-> @FileSearch {
|
||||
struct FileSearchImpl {
|
||||
sysroot: Path,
|
||||
@ -117,8 +117,8 @@ fn get_or_default_sysroot() -> Path {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_sysroot(maybe_sysroot: Option<Path>) -> Path {
|
||||
match maybe_sysroot {
|
||||
fn get_sysroot(maybe_sysroot: &Option<Path>) -> Path {
|
||||
match *maybe_sysroot {
|
||||
option::Some(ref sr) => (/*bad*/copy *sr),
|
||||
option::None => get_or_default_sysroot()
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ pub struct Context {
|
||||
intr: @ident_interner
|
||||
}
|
||||
|
||||
pub fn load_library_crate(cx: Context) -> (~str, @~[u8]) {
|
||||
pub fn load_library_crate(cx: &Context) -> (~str, @~[u8]) {
|
||||
match find_library_crate(cx) {
|
||||
Some(ref t) => return (/*bad*/copy *t),
|
||||
None => {
|
||||
@ -66,12 +66,12 @@ pub fn load_library_crate(cx: Context) -> (~str, @~[u8]) {
|
||||
}
|
||||
}
|
||||
|
||||
fn find_library_crate(cx: Context) -> Option<(~str, @~[u8])> {
|
||||
fn find_library_crate(cx: &Context) -> Option<(~str, @~[u8])> {
|
||||
attr::require_unique_names(cx.diag, cx.metas);
|
||||
find_library_crate_aux(cx, libname(cx), cx.filesearch)
|
||||
}
|
||||
|
||||
fn libname(cx: Context) -> (~str, ~str) {
|
||||
fn libname(cx: &Context) -> (~str, ~str) {
|
||||
if cx.is_static { return (~"lib", ~".rlib"); }
|
||||
let (dll_prefix, dll_suffix) = match cx.os {
|
||||
os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
|
||||
@ -85,7 +85,7 @@ fn libname(cx: Context) -> (~str, ~str) {
|
||||
}
|
||||
|
||||
fn find_library_crate_aux(
|
||||
cx: Context,
|
||||
cx: &Context,
|
||||
(prefix, suffix): (~str, ~str),
|
||||
filesearch: @filesearch::FileSearch
|
||||
) -> Option<(~str, @~[u8])> {
|
||||
|
@ -116,16 +116,16 @@ fn enc_mt(w: @io::Writer, cx: @ctxt, mt: ty::mt) {
|
||||
}
|
||||
|
||||
fn enc_opt<T>(w: @io::Writer, t: Option<T>, enc_f: &fn(T)) {
|
||||
match &t {
|
||||
&None => w.write_char('n'),
|
||||
&Some(ref v) => {
|
||||
match t {
|
||||
None => w.write_char('n'),
|
||||
Some(v) => {
|
||||
w.write_char('s');
|
||||
enc_f((*v));
|
||||
enc_f(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn enc_substs(w: @io::Writer, cx: @ctxt, substs: ty::substs) {
|
||||
fn enc_substs(w: @io::Writer, cx: @ctxt, substs: &ty::substs) {
|
||||
do enc_opt(w, substs.self_r) |r| { enc_region(w, cx, r) }
|
||||
do enc_opt(w, substs.self_ty) |t| { enc_ty(w, cx, t) }
|
||||
w.write_char('[');
|
||||
@ -210,7 +210,7 @@ pub fn enc_vstore(w: @io::Writer, cx: @ctxt, v: ty::vstore) {
|
||||
pub fn enc_trait_ref(w: @io::Writer, cx: @ctxt, s: &ty::TraitRef) {
|
||||
w.write_str((cx.ds)(s.def_id));
|
||||
w.write_char('|');
|
||||
enc_substs(w, cx, s.substs);
|
||||
enc_substs(w, cx, &s.substs);
|
||||
}
|
||||
|
||||
pub fn enc_trait_store(w: @io::Writer, cx: @ctxt, s: ty::TraitStore) {
|
||||
@ -224,7 +224,7 @@ pub fn enc_trait_store(w: @io::Writer, cx: @ctxt, s: ty::TraitStore) {
|
||||
}
|
||||
}
|
||||
|
||||
fn enc_sty(w: @io::Writer, cx: @ctxt, +st: ty::sty) {
|
||||
fn enc_sty(w: @io::Writer, cx: @ctxt, st: ty::sty) {
|
||||
match st {
|
||||
ty::ty_nil => w.write_char('n'),
|
||||
ty::ty_bot => w.write_char('z'),
|
||||
@ -259,14 +259,14 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, +st: ty::sty) {
|
||||
w.write_str(&"t[");
|
||||
w.write_str((cx.ds)(def));
|
||||
w.write_char('|');
|
||||
enc_substs(w, cx, (*substs));
|
||||
enc_substs(w, cx, substs);
|
||||
w.write_char(']');
|
||||
}
|
||||
ty::ty_trait(def, ref substs, store, mt) => {
|
||||
w.write_str(&"x[");
|
||||
w.write_str((cx.ds)(def));
|
||||
w.write_char('|');
|
||||
enc_substs(w, cx, (*substs));
|
||||
enc_substs(w, cx, substs);
|
||||
enc_trait_store(w, cx, store);
|
||||
enc_mutability(w, mt);
|
||||
w.write_char(']');
|
||||
@ -330,7 +330,7 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, +st: ty::sty) {
|
||||
w.write_str(s);
|
||||
debug!("~~~~ %s", ~"|");
|
||||
w.write_char('|');
|
||||
enc_substs(w, cx, (*substs));
|
||||
enc_substs(w, cx, substs);
|
||||
debug!("~~~~ %s", ~"]");
|
||||
w.write_char(']');
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ trait tr_intern {
|
||||
// Top-level methods.
|
||||
|
||||
pub fn encode_inlined_item(ecx: @e::EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
path: &[ast_map::path_elt],
|
||||
ii: ast::inlined_item,
|
||||
maps: Maps) {
|
||||
@ -89,11 +89,11 @@ pub fn encode_inlined_item(ecx: @e::EncodeContext,
|
||||
*ecx.tcx.sess.str_of(ii.ident()),
|
||||
ebml_w.writer.tell());
|
||||
|
||||
let id_range = ast_util::compute_id_range_for_inlined_item(ii);
|
||||
let id_range = ast_util::compute_id_range_for_inlined_item(&ii);
|
||||
do ebml_w.wr_tag(c::tag_ast as uint) {
|
||||
id_range.encode(&ebml_w);
|
||||
encode_ast(ebml_w, simplify_ast(ii));
|
||||
encode_side_tables_for_ii(ecx, maps, ebml_w, ii);
|
||||
id_range.encode(ebml_w);
|
||||
encode_ast(ebml_w, simplify_ast(&ii));
|
||||
encode_side_tables_for_ii(ecx, maps, ebml_w, &ii);
|
||||
}
|
||||
|
||||
debug!("< Encoded inlined fn: %s::%s (%u)",
|
||||
@ -105,7 +105,7 @@ pub fn encode_inlined_item(ecx: @e::EncodeContext,
|
||||
pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
|
||||
tcx: ty::ctxt,
|
||||
maps: Maps,
|
||||
+path: ast_map::path,
|
||||
path: ast_map::path,
|
||||
par_doc: ebml::Doc)
|
||||
-> Option<ast::inlined_item> {
|
||||
let dcx = @DecodeContext {
|
||||
@ -133,7 +133,7 @@ pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
|
||||
ast_map::path_to_str(path, tcx.sess.parse_sess.interner),
|
||||
*tcx.sess.str_of(ii.ident()));
|
||||
ast_map::map_decoded_item(tcx.sess.diagnostic(),
|
||||
dcx.tcx.items, path, ii);
|
||||
dcx.tcx.items, path, &ii);
|
||||
decode_side_tables(xcx, ast_doc);
|
||||
match ii {
|
||||
ast::ii_item(i) => {
|
||||
@ -275,9 +275,9 @@ impl<D:serialize::Decoder> def_id_decoder_helpers for D {
|
||||
// We also have to adjust the spans: for now we just insert a dummy span,
|
||||
// but eventually we should add entries to the local codemap as required.
|
||||
|
||||
fn encode_ast(ebml_w: writer::Encoder, item: ast::inlined_item) {
|
||||
fn encode_ast(ebml_w: &writer::Encoder, item: ast::inlined_item) {
|
||||
do ebml_w.wr_tag(c::tag_tree as uint) {
|
||||
item.encode(&ebml_w)
|
||||
item.encode(ebml_w)
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ fn encode_ast(ebml_w: writer::Encoder, item: ast::inlined_item) {
|
||||
// As it happens, trans relies on the fact that we do not export
|
||||
// nested items, as otherwise it would get confused when translating
|
||||
// inlined items.
|
||||
fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
|
||||
fn simplify_ast(ii: &ast::inlined_item) -> ast::inlined_item {
|
||||
fn drop_nested_items(blk: &ast::blk_, fld: @fold::ast_fold) -> ast::blk_ {
|
||||
let stmts_sans_items = do blk.stmts.filtered |stmt| {
|
||||
match stmt.node {
|
||||
@ -319,7 +319,7 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
|
||||
.. *fold::default_ast_fold()
|
||||
});
|
||||
|
||||
match ii {
|
||||
match *ii {
|
||||
ast::ii_item(i) => {
|
||||
ast::ii_item(fld.fold_item(i).get()) //hack: we're not dropping items
|
||||
}
|
||||
@ -388,8 +388,8 @@ fn renumber_ast(xcx: @ExtendedDecodeContext, ii: ast::inlined_item)
|
||||
// ______________________________________________________________________
|
||||
// Encoding and decoding of ast::def
|
||||
|
||||
fn encode_def(ebml_w: writer::Encoder, def: ast::def) {
|
||||
def.encode(&ebml_w)
|
||||
fn encode_def(ebml_w: &writer::Encoder, def: ast::def) {
|
||||
def.encode(ebml_w)
|
||||
}
|
||||
|
||||
fn decode_def(xcx: @ExtendedDecodeContext, doc: ebml::Doc) -> ast::def {
|
||||
@ -499,8 +499,8 @@ impl tr for ty::bound_region {
|
||||
// ______________________________________________________________________
|
||||
// Encoding and decoding of freevar information
|
||||
|
||||
fn encode_freevar_entry(ebml_w: writer::Encoder, fv: @freevar_entry) {
|
||||
(*fv).encode(&ebml_w)
|
||||
fn encode_freevar_entry(ebml_w: &writer::Encoder, fv: @freevar_entry) {
|
||||
(*fv).encode(ebml_w)
|
||||
}
|
||||
|
||||
trait ebml_decoder_helper {
|
||||
@ -561,17 +561,17 @@ trait read_method_map_entry_helper {
|
||||
|
||||
#[cfg(stage0)]
|
||||
fn encode_method_map_entry(ecx: @e::EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
mme: method_map_entry) {
|
||||
do ebml_w.emit_struct("method_map_entry", 3) {
|
||||
do ebml_w.emit_field(~"self_arg", 0u) {
|
||||
ebml_w.emit_arg(ecx, mme.self_arg);
|
||||
}
|
||||
do ebml_w.emit_field(~"explicit_self", 2u) {
|
||||
mme.explicit_self.encode(&ebml_w);
|
||||
mme.explicit_self.encode(ebml_w);
|
||||
}
|
||||
do ebml_w.emit_field(~"origin", 1u) {
|
||||
mme.origin.encode(&ebml_w);
|
||||
mme.origin.encode(ebml_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -580,17 +580,17 @@ fn encode_method_map_entry(ecx: @e::EncodeContext,
|
||||
#[cfg(stage2)]
|
||||
#[cfg(stage3)]
|
||||
fn encode_method_map_entry(ecx: @e::EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
mme: method_map_entry) {
|
||||
do ebml_w.emit_struct("method_map_entry", 3) {
|
||||
do ebml_w.emit_struct_field("self_arg", 0u) {
|
||||
ebml_w.emit_arg(ecx, mme.self_arg);
|
||||
}
|
||||
do ebml_w.emit_struct_field("explicit_self", 2u) {
|
||||
mme.explicit_self.encode(&ebml_w);
|
||||
mme.explicit_self.encode(ebml_w);
|
||||
}
|
||||
do ebml_w.emit_struct_field("origin", 1u) {
|
||||
mme.origin.encode(&ebml_w);
|
||||
mme.origin.encode(ebml_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -672,22 +672,22 @@ impl tr for method_origin {
|
||||
// Encoding and decoding vtable_res
|
||||
|
||||
fn encode_vtable_res(ecx: @e::EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
dr: typeck::vtable_res) {
|
||||
// can't autogenerate this code because automatic code of
|
||||
// ty::t doesn't work, and there is no way (atm) to have
|
||||
// hand-written encoding routines combine with auto-generated
|
||||
// ones. perhaps we should fix this.
|
||||
do ebml_w.emit_from_vec(*dr) |vtable_origin| {
|
||||
encode_vtable_origin(ecx, ebml_w, *vtable_origin)
|
||||
encode_vtable_origin(ecx, ebml_w, vtable_origin)
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_vtable_origin(ecx: @e::EncodeContext,
|
||||
ebml_w: writer::Encoder,
|
||||
vtable_origin: typeck::vtable_origin) {
|
||||
ebml_w: &writer::Encoder,
|
||||
vtable_origin: &typeck::vtable_origin) {
|
||||
do ebml_w.emit_enum(~"vtable_origin") {
|
||||
match vtable_origin {
|
||||
match *vtable_origin {
|
||||
typeck::vtable_static(def_id, ref tys, vtable_res) => {
|
||||
do ebml_w.emit_enum_variant(~"vtable_static", 0u, 3u) {
|
||||
do ebml_w.emit_enum_variant_arg(0u) {
|
||||
@ -798,13 +798,13 @@ trait ebml_writer_helpers {
|
||||
impl ebml_writer_helpers for writer::Encoder {
|
||||
fn emit_ty(&self, ecx: @e::EncodeContext, ty: ty::t) {
|
||||
do self.emit_opaque {
|
||||
e::write_type(ecx, *self, ty)
|
||||
e::write_type(ecx, self, ty)
|
||||
}
|
||||
}
|
||||
|
||||
fn emit_vstore(&self, ecx: @e::EncodeContext, vstore: ty::vstore) {
|
||||
do self.emit_opaque {
|
||||
e::write_vstore(ecx, *self, vstore)
|
||||
e::write_vstore(ecx, self, vstore)
|
||||
}
|
||||
}
|
||||
|
||||
@ -897,24 +897,25 @@ impl write_tag_and_id for writer::Encoder {
|
||||
|
||||
fn encode_side_tables_for_ii(ecx: @e::EncodeContext,
|
||||
maps: Maps,
|
||||
ebml_w: writer::Encoder,
|
||||
ii: ast::inlined_item) {
|
||||
ebml_w: &writer::Encoder,
|
||||
ii: &ast::inlined_item) {
|
||||
do ebml_w.wr_tag(c::tag_table as uint) {
|
||||
let ebml_w = copy ebml_w;
|
||||
let ebml_w = copy *ebml_w;
|
||||
ast_util::visit_ids_for_inlined_item(
|
||||
ii,
|
||||
|id: ast::node_id| {
|
||||
// Note: this will cause a copy of ebml_w, which is bad as
|
||||
// it has mut fields. But I believe it's harmless since
|
||||
// we generate balanced EBML.
|
||||
encode_side_tables_for_id(ecx, maps, ebml_w, id)
|
||||
/*let ebml_w = copy ebml_w;*/
|
||||
encode_side_tables_for_id(ecx, maps, &ebml_w, id)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_side_tables_for_id(ecx: @e::EncodeContext,
|
||||
maps: Maps,
|
||||
ebml_w: writer::Encoder,
|
||||
ebml_w: &writer::Encoder,
|
||||
id: ast::node_id) {
|
||||
let tcx = ecx.tcx;
|
||||
|
||||
@ -924,7 +925,7 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
|
||||
do ebml_w.tag(c::tag_table_def) {
|
||||
ebml_w.id(id);
|
||||
do ebml_w.tag(c::tag_table_val) {
|
||||
(*def).encode(&ebml_w)
|
||||
(*def).encode(ebml_w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1004,7 +1005,7 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
|
||||
ebml_w.id(id);
|
||||
do ebml_w.tag(c::tag_table_val) {
|
||||
do ebml_w.emit_from_vec(/*bad*/ copy **m) |id| {
|
||||
id.encode(&ebml_w);
|
||||
id.encode(ebml_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1032,7 +1033,7 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
|
||||
do ebml_w.tag(c::tag_table_adjustments) {
|
||||
ebml_w.id(id);
|
||||
do ebml_w.tag(c::tag_table_val) {
|
||||
(**adj).encode(&ebml_w)
|
||||
(**adj).encode(ebml_w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1048,7 +1049,7 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
|
||||
ebml_w.id(id);
|
||||
do ebml_w.tag(c::tag_table_val) {
|
||||
do ebml_w.emit_from_vec(*cap_vars) |cap_var| {
|
||||
cap_var.encode(&ebml_w);
|
||||
cap_var.encode(ebml_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1279,9 +1280,9 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
|
||||
// Testing of astencode_gen
|
||||
|
||||
#[cfg(test)]
|
||||
fn encode_item_ast(ebml_w: writer::Encoder, item: @ast::item) {
|
||||
fn encode_item_ast(ebml_w: &writer::Encoder, item: @ast::item) {
|
||||
do ebml_w.wr_tag(c::tag_tree as uint) {
|
||||
(*item).encode(&ebml_w)
|
||||
(*item).encode(ebml_w)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1297,7 +1298,7 @@ trait fake_ext_ctxt {
|
||||
fn cfg(&self) -> ast::crate_cfg;
|
||||
fn parse_sess(&self) -> @mut parse::ParseSess;
|
||||
fn call_site(&self) -> span;
|
||||
fn ident_of(&self, +st: ~str) -> ast::ident;
|
||||
fn ident_of(&self, st: ~str) -> ast::ident;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@ -1314,7 +1315,7 @@ impl fake_ext_ctxt for fake_session {
|
||||
expn_info: None
|
||||
}
|
||||
}
|
||||
fn ident_of(&self, +st: ~str) -> ast::ident {
|
||||
fn ident_of(&self, st: ~str) -> ast::ident {
|
||||
self.interner.intern(@st)
|
||||
}
|
||||
}
|
||||
@ -1331,7 +1332,7 @@ fn roundtrip(in_item: Option<@ast::item>) {
|
||||
let in_item = in_item.get();
|
||||
let bytes = do io::with_bytes_writer |wr| {
|
||||
let ebml_w = writer::Encoder(wr);
|
||||
encode_item_ast(ebml_w, in_item);
|
||||
encode_item_ast(&ebml_w, in_item);
|
||||
};
|
||||
let ebml_doc = reader::Doc(@bytes);
|
||||
let out_item = decode_item_ast(ebml_doc);
|
||||
@ -1375,7 +1376,7 @@ fn test_simplification() {
|
||||
return alist {eq_fn: eq_int, data: ~[]};
|
||||
}
|
||||
).get());
|
||||
let item_out = simplify_ast(item_in);
|
||||
let item_out = simplify_ast(&item_in);
|
||||
let item_exp = ast::ii_item(quote_item!(
|
||||
fn new_int_alist<B:Copy>() -> alist<int, B> {
|
||||
return alist {eq_fn: eq_int, data: ~[]};
|
||||
|
@ -79,7 +79,7 @@ enum impurity_cause {
|
||||
}
|
||||
|
||||
pub fn check_loans(bccx: @BorrowckCtxt,
|
||||
+req_maps: ReqMaps,
|
||||
req_maps: ReqMaps,
|
||||
crate: @ast::crate) {
|
||||
let clcx = @mut CheckLoanCtxt {
|
||||
bccx: bccx,
|
||||
@ -94,7 +94,7 @@ pub fn check_loans(bccx: @BorrowckCtxt,
|
||||
visit_block: check_loans_in_block,
|
||||
visit_fn: check_loans_in_fn,
|
||||
.. *visit::default_visitor()});
|
||||
visit::visit_crate(*crate, clcx, vt);
|
||||
visit::visit_crate(crate, clcx, vt);
|
||||
}
|
||||
|
||||
#[deriving(Eq)]
|
||||
@ -619,7 +619,7 @@ fn check_loans_in_fn(fk: &visit::fn_kind,
|
||||
body: &ast::blk,
|
||||
sp: span,
|
||||
id: ast::node_id,
|
||||
&&self: @mut CheckLoanCtxt,
|
||||
self: @mut CheckLoanCtxt,
|
||||
visitor: visit::vt<@mut CheckLoanCtxt>) {
|
||||
let is_stack_closure = self.is_stack_closure(id);
|
||||
let fty = ty::node_id_to_type(self.tcx(), id);
|
||||
@ -726,13 +726,13 @@ fn check_loans_in_fn(fk: &visit::fn_kind,
|
||||
}
|
||||
|
||||
fn check_loans_in_local(local: @ast::local,
|
||||
&&self: @mut CheckLoanCtxt,
|
||||
self: @mut CheckLoanCtxt,
|
||||
vt: visit::vt<@mut CheckLoanCtxt>) {
|
||||
visit::visit_local(local, self, vt);
|
||||
}
|
||||
|
||||
fn check_loans_in_expr(expr: @ast::expr,
|
||||
&&self: @mut CheckLoanCtxt,
|
||||
self: @mut CheckLoanCtxt,
|
||||
vt: visit::vt<@mut CheckLoanCtxt>) {
|
||||
debug!("check_loans_in_expr(expr=%?/%s)",
|
||||
expr.id, pprust::expr_to_str(expr, self.tcx().sess.intr()));
|
||||
@ -794,7 +794,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
||||
}
|
||||
|
||||
fn check_loans_in_block(blk: &ast::blk,
|
||||
&&self: @mut CheckLoanCtxt,
|
||||
self: @mut CheckLoanCtxt,
|
||||
vt: visit::vt<@mut CheckLoanCtxt>) {
|
||||
do save_and_restore_managed(self.declared_purity) {
|
||||
self.check_for_conflicting_loans(blk.node.id);
|
||||
|
@ -88,7 +88,7 @@ pub fn gather_loans(bccx: @BorrowckCtxt, crate: @ast::crate) -> ReqMaps {
|
||||
visit_fn: req_loans_in_fn,
|
||||
visit_stmt: add_stmt_to_map,
|
||||
.. *visit::default_visitor()});
|
||||
visit::visit_crate(*crate, glcx, v);
|
||||
visit::visit_crate(crate, glcx, v);
|
||||
let @GatherLoanCtxt{req_maps, _} = glcx;
|
||||
return req_maps;
|
||||
}
|
||||
@ -98,7 +98,7 @@ fn req_loans_in_fn(fk: &visit::fn_kind,
|
||||
body: &ast::blk,
|
||||
sp: span,
|
||||
id: ast::node_id,
|
||||
&&self: @mut GatherLoanCtxt,
|
||||
self: @mut GatherLoanCtxt,
|
||||
v: visit::vt<@mut GatherLoanCtxt>) {
|
||||
// see explanation attached to the `root_ub` field:
|
||||
let old_item_id = self.item_ub;
|
||||
@ -119,7 +119,7 @@ fn req_loans_in_fn(fk: &visit::fn_kind,
|
||||
}
|
||||
|
||||
fn req_loans_in_expr(ex: @ast::expr,
|
||||
&&self: @mut GatherLoanCtxt,
|
||||
self: @mut GatherLoanCtxt,
|
||||
vt: visit::vt<@mut GatherLoanCtxt>) {
|
||||
let bccx = self.bccx;
|
||||
let tcx = bccx.tcx;
|
||||
@ -489,7 +489,7 @@ pub impl GatherLoanCtxt {
|
||||
cmt: cmt,
|
||||
loan_kind: LoanKind,
|
||||
scope_r: ty::Region,
|
||||
+loans: ~[Loan]) {
|
||||
loans: ~[Loan]) {
|
||||
if loans.len() == 0 {
|
||||
return;
|
||||
}
|
||||
@ -555,7 +555,7 @@ pub impl GatherLoanCtxt {
|
||||
|
||||
fn add_loans_to_scope_id(&mut self,
|
||||
scope_id: ast::node_id,
|
||||
+loans: ~[Loan]) {
|
||||
loans: ~[Loan]) {
|
||||
debug!("adding %u loans to scope_id %?: %s",
|
||||
loans.len(), scope_id,
|
||||
str::connect(loans.map(|l| self.bccx.loan_to_repr(l)), ", "));
|
||||
@ -665,7 +665,7 @@ pub impl GatherLoanCtxt {
|
||||
// Setting up info that preserve needs.
|
||||
// This is just the most convenient place to do it.
|
||||
fn add_stmt_to_map(stmt: @ast::stmt,
|
||||
&&self: @mut GatherLoanCtxt,
|
||||
self: @mut GatherLoanCtxt,
|
||||
vt: visit::vt<@mut GatherLoanCtxt>) {
|
||||
match stmt.node {
|
||||
ast::stmt_expr(_, id) | ast::stmt_semi(_, id) => {
|
||||
|
@ -257,10 +257,10 @@ pub impl LoanContext {
|
||||
}
|
||||
|
||||
fn issue_loan(&mut self,
|
||||
+cmt: cmt,
|
||||
+scope_ub: ty::Region,
|
||||
+loan_kind: LoanKind,
|
||||
+owns_lent_data: bool) -> bckres<()> {
|
||||
cmt: cmt,
|
||||
scope_ub: ty::Region,
|
||||
loan_kind: LoanKind,
|
||||
owns_lent_data: bool) -> bckres<()> {
|
||||
// Subtle: the `scope_ub` is the maximal lifetime of `cmt`.
|
||||
// Therefore, if `cmt` owns the data being lent, then the
|
||||
// scope of the loan must be less than `scope_ub`, or else the
|
||||
|
@ -443,7 +443,7 @@ pub impl LoanKind {
|
||||
/// Creates and returns a new root_map
|
||||
|
||||
impl to_bytes::IterBytes for root_map_key {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_2(&self.id, &self.derefs, lsb0, f);
|
||||
}
|
||||
}
|
||||
@ -529,11 +529,11 @@ pub impl BorrowckCtxt {
|
||||
self.note_and_explain_bckerr(err);
|
||||
}
|
||||
|
||||
fn span_err(&self, s: span, +m: ~str) {
|
||||
fn span_err(&self, s: span, m: ~str) {
|
||||
self.tcx.sess.span_err(s, m);
|
||||
}
|
||||
|
||||
fn span_note(&self, s: span, +m: ~str) {
|
||||
fn span_note(&self, s: span, m: ~str) {
|
||||
self.tcx.sess.span_note(s, m);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ pub fn check_crate(sess: Session,
|
||||
def_map: resolve::DefMap,
|
||||
method_map: typeck::method_map,
|
||||
tcx: ty::ctxt) {
|
||||
visit::visit_crate(*crate, false, visit::mk_vt(@visit::Visitor {
|
||||
visit::visit_crate(crate, false, visit::mk_vt(@visit::Visitor {
|
||||
visit_item: |a,b,c| check_item(sess, ast_map, def_map, a, b, c),
|
||||
visit_pat: check_pat,
|
||||
visit_expr: |a,b,c|
|
||||
@ -40,7 +40,7 @@ pub fn check_item(sess: Session,
|
||||
ast_map: ast_map::map,
|
||||
def_map: resolve::DefMap,
|
||||
it: @item,
|
||||
&&_is_const: bool,
|
||||
_is_const: bool,
|
||||
v: visit::vt<bool>) {
|
||||
match it.node {
|
||||
item_const(_, ex) => {
|
||||
@ -58,7 +58,7 @@ pub fn check_item(sess: Session,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_pat(p: @pat, &&_is_const: bool, v: visit::vt<bool>) {
|
||||
pub fn check_pat(p: @pat, _is_const: bool, v: visit::vt<bool>) {
|
||||
fn is_str(e: @expr) -> bool {
|
||||
match e.node {
|
||||
expr_vstore(
|
||||
@ -87,7 +87,7 @@ pub fn check_expr(sess: Session,
|
||||
method_map: typeck::method_map,
|
||||
tcx: ty::ctxt,
|
||||
e: @expr,
|
||||
&&is_const: bool,
|
||||
is_const: bool,
|
||||
v: visit::vt<bool>) {
|
||||
if is_const {
|
||||
match e.node {
|
||||
@ -224,7 +224,7 @@ pub fn check_item_recursion(sess: Session,
|
||||
});
|
||||
(visitor.visit_item)(it, env, visitor);
|
||||
|
||||
fn visit_item(it: @item, &&env: env, v: visit::vt<env>) {
|
||||
fn visit_item(it: @item, env: env, v: visit::vt<env>) {
|
||||
if env.idstack.contains(&(it.id)) {
|
||||
env.sess.span_fatal(env.root_it.span, ~"recursive constant");
|
||||
}
|
||||
@ -233,7 +233,7 @@ pub fn check_item_recursion(sess: Session,
|
||||
env.idstack.pop();
|
||||
}
|
||||
|
||||
fn visit_expr(e: @expr, &&env: env, v: visit::vt<env>) {
|
||||
fn visit_expr(e: @expr, env: env, v: visit::vt<env>) {
|
||||
match e.node {
|
||||
expr_path(*) => {
|
||||
match env.def_map.find(&e.id) {
|
||||
|
@ -20,7 +20,7 @@ pub struct Context {
|
||||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt, crate: @crate) {
|
||||
visit::visit_crate(*crate,
|
||||
visit::visit_crate(crate,
|
||||
Context { in_loop: false, can_ret: true },
|
||||
visit::mk_vt(@visit::Visitor {
|
||||
visit_item: |i, _cx, v| {
|
||||
|
@ -40,7 +40,7 @@ pub fn check_crate(tcx: ty::ctxt,
|
||||
let cx = @MatchCheckCtxt {tcx: tcx,
|
||||
method_map: method_map,
|
||||
moves_map: moves_map};
|
||||
visit::visit_crate(*crate, (), visit::mk_vt(@visit::Visitor {
|
||||
visit::visit_crate(crate, (), visit::mk_vt(@visit::Visitor {
|
||||
visit_expr: |a,b,c| check_expr(cx, a, b, c),
|
||||
visit_local: |a,b,c| check_local(cx, a, b, c),
|
||||
visit_fn: |kind, decl, body, sp, id, e, v|
|
||||
@ -58,7 +58,7 @@ pub fn expr_is_non_moving_lvalue(cx: @MatchCheckCtxt, expr: @expr) -> bool {
|
||||
!cx.moves_map.contains(&expr.id)
|
||||
}
|
||||
|
||||
pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, &&s: (), v: visit::vt<()>) {
|
||||
pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, s: (), v: visit::vt<()>) {
|
||||
visit::visit_expr(ex, s, v);
|
||||
match ex.node {
|
||||
expr_match(scrut, ref arms) => {
|
||||
@ -259,7 +259,7 @@ pub fn is_useful(cx: @MatchCheckCtxt, m: &matrix, v: &[@pat]) -> useful {
|
||||
not_useful
|
||||
}
|
||||
_ => {
|
||||
let arity = ctor_arity(cx, single, left_ty);
|
||||
let arity = ctor_arity(cx, &single, left_ty);
|
||||
is_useful_specialized(cx, m, v, single, arity, left_ty)
|
||||
}
|
||||
}
|
||||
@ -268,14 +268,14 @@ pub fn is_useful(cx: @MatchCheckCtxt, m: &matrix, v: &[@pat]) -> useful {
|
||||
match is_useful(cx,
|
||||
&m.filter_mapped(|r| default(cx, *r)),
|
||||
v.tail()) {
|
||||
useful_ => useful(left_ty, (/*bad*/copy *ctor)),
|
||||
useful_ => useful(left_ty, /*bad*/copy *ctor),
|
||||
ref u => (/*bad*/copy *u)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(ref v0_ctor) => {
|
||||
let arity = ctor_arity(cx, (*v0_ctor), left_ty);
|
||||
let arity = ctor_arity(cx, v0_ctor, left_ty);
|
||||
is_useful_specialized(cx, m, v, /*bad*/copy *v0_ctor, arity, left_ty)
|
||||
}
|
||||
}
|
||||
@ -284,13 +284,13 @@ pub fn is_useful(cx: @MatchCheckCtxt, m: &matrix, v: &[@pat]) -> useful {
|
||||
pub fn is_useful_specialized(cx: @MatchCheckCtxt,
|
||||
m: &matrix,
|
||||
v: &[@pat],
|
||||
+ctor: ctor,
|
||||
ctor: ctor,
|
||||
arity: uint,
|
||||
lty: ty::t)
|
||||
-> useful {
|
||||
let ms = m.filter_mapped(|r| specialize(cx, *r, ctor, arity, lty));
|
||||
let ms = m.filter_mapped(|r| specialize(cx, *r, &ctor, arity, lty));
|
||||
let could_be_useful = is_useful(
|
||||
cx, &ms, specialize(cx, v, ctor, arity, lty).get());
|
||||
cx, &ms, specialize(cx, v, &ctor, arity, lty).get());
|
||||
match could_be_useful {
|
||||
useful_ => useful(lty, ctor),
|
||||
ref u => (/*bad*/copy *u)
|
||||
@ -447,12 +447,12 @@ pub fn missing_ctor(cx: @MatchCheckCtxt,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ctor_arity(cx: @MatchCheckCtxt, ctor: ctor, ty: ty::t) -> uint {
|
||||
pub fn ctor_arity(cx: @MatchCheckCtxt, ctor: &ctor, ty: ty::t) -> uint {
|
||||
match ty::get(ty).sty {
|
||||
ty::ty_tup(ref fs) => fs.len(),
|
||||
ty::ty_box(_) | ty::ty_uniq(_) | ty::ty_rptr(*) => 1u,
|
||||
ty::ty_enum(eid, _) => {
|
||||
let id = match ctor { variant(id) => id,
|
||||
let id = match *ctor { variant(id) => id,
|
||||
_ => fail!(~"impossible case") };
|
||||
match vec::find(*ty::enum_variants(cx.tcx, eid), |v| v.id == id ) {
|
||||
Some(v) => v.args.len(),
|
||||
@ -461,7 +461,7 @@ pub fn ctor_arity(cx: @MatchCheckCtxt, ctor: ctor, ty: ty::t) -> uint {
|
||||
}
|
||||
ty::ty_struct(cid, _) => ty::lookup_struct_fields(cx.tcx, cid).len(),
|
||||
ty::ty_unboxed_vec(*) | ty::ty_evec(*) => {
|
||||
match ctor {
|
||||
match *ctor {
|
||||
vec(n) => n,
|
||||
_ => 0u
|
||||
}
|
||||
@ -476,7 +476,7 @@ pub fn wild() -> @pat {
|
||||
|
||||
pub fn specialize(cx: @MatchCheckCtxt,
|
||||
r: &[@pat],
|
||||
ctor_id: ctor,
|
||||
ctor_id: &ctor,
|
||||
arity: uint,
|
||||
left_ty: ty::t)
|
||||
-> Option<~[@pat]> {
|
||||
@ -491,7 +491,7 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||
pat_ident(_, _, _) => {
|
||||
match cx.tcx.def_map.find(&pat_id) {
|
||||
Some(&def_variant(_, id)) => {
|
||||
if variant(id) == ctor_id {
|
||||
if variant(id) == *ctor_id {
|
||||
Some(vec::from_slice(r.tail()))
|
||||
} else {
|
||||
None
|
||||
@ -501,11 +501,11 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||
let const_expr =
|
||||
lookup_const_by_id(cx.tcx, did).get();
|
||||
let e_v = eval_const_expr(cx.tcx, const_expr);
|
||||
let match_ = match ctor_id {
|
||||
val(ref v) => compare_const_vals(e_v, (*v)) == 0,
|
||||
let match_ = match *ctor_id {
|
||||
val(ref v) => compare_const_vals(&e_v, v) == 0,
|
||||
range(ref c_lo, ref c_hi) => {
|
||||
compare_const_vals((*c_lo), e_v) >= 0 &&
|
||||
compare_const_vals((*c_hi), e_v) <= 0
|
||||
compare_const_vals(c_lo, &e_v) >= 0 &&
|
||||
compare_const_vals(c_hi, &e_v) <= 0
|
||||
}
|
||||
single => true,
|
||||
_ => fail!(~"type error")
|
||||
@ -532,11 +532,11 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||
let const_expr =
|
||||
lookup_const_by_id(cx.tcx, did).get();
|
||||
let e_v = eval_const_expr(cx.tcx, const_expr);
|
||||
let match_ = match ctor_id {
|
||||
val(ref v) => compare_const_vals(e_v, (*v)) == 0,
|
||||
let match_ = match *ctor_id {
|
||||
val(ref v) => compare_const_vals(&e_v, v) == 0,
|
||||
range(ref c_lo, ref c_hi) => {
|
||||
compare_const_vals((*c_lo), e_v) >= 0 &&
|
||||
compare_const_vals((*c_hi), e_v) <= 0
|
||||
compare_const_vals(c_lo, &e_v) >= 0 &&
|
||||
compare_const_vals(c_hi, &e_v) <= 0
|
||||
}
|
||||
single => true,
|
||||
_ => fail!(~"type error")
|
||||
@ -547,7 +547,7 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||
None
|
||||
}
|
||||
}
|
||||
def_variant(_, id) if variant(id) == ctor_id => {
|
||||
def_variant(_, id) if variant(id) == *ctor_id => {
|
||||
let args = match args {
|
||||
Some(args) => args,
|
||||
None => vec::from_elem(arity, wild())
|
||||
@ -571,7 +571,7 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||
// Is this a struct or an enum variant?
|
||||
match *cx.tcx.def_map.get(&pat_id) {
|
||||
def_variant(_, variant_id) => {
|
||||
if variant(variant_id) == ctor_id {
|
||||
if variant(variant_id) == *ctor_id {
|
||||
// FIXME #4731: Is this right? --pcw
|
||||
let args = flds.map(|ty_field| {
|
||||
match flds.find(|f|
|
||||
@ -620,11 +620,11 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||
}
|
||||
pat_lit(expr) => {
|
||||
let e_v = eval_const_expr(cx.tcx, expr);
|
||||
let match_ = match ctor_id {
|
||||
val(ref v) => compare_const_vals(e_v, (*v)) == 0,
|
||||
let match_ = match *ctor_id {
|
||||
val(ref v) => compare_const_vals(&e_v, v) == 0,
|
||||
range(ref c_lo, ref c_hi) => {
|
||||
compare_const_vals((*c_lo), e_v) >= 0 &&
|
||||
compare_const_vals((*c_hi), e_v) <= 0
|
||||
compare_const_vals(c_lo, &e_v) >= 0 &&
|
||||
compare_const_vals(c_hi, &e_v) <= 0
|
||||
}
|
||||
single => true,
|
||||
_ => fail!(~"type error")
|
||||
@ -632,7 +632,7 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||
if match_ { Some(vec::from_slice(r.tail())) } else { None }
|
||||
}
|
||||
pat_range(lo, hi) => {
|
||||
let (c_lo, c_hi) = match ctor_id {
|
||||
let (c_lo, c_hi) = match *ctor_id {
|
||||
val(ref v) => ((/*bad*/copy *v), (/*bad*/copy *v)),
|
||||
range(ref lo, ref hi) =>
|
||||
((/*bad*/copy *lo), (/*bad*/copy *hi)),
|
||||
@ -641,12 +641,12 @@ pub fn specialize(cx: @MatchCheckCtxt,
|
||||
};
|
||||
let v_lo = eval_const_expr(cx.tcx, lo),
|
||||
v_hi = eval_const_expr(cx.tcx, hi);
|
||||
let match_ = compare_const_vals(c_lo, v_lo) >= 0 &&
|
||||
compare_const_vals(c_hi, v_hi) <= 0;
|
||||
let match_ = compare_const_vals(&c_lo, &v_lo) >= 0 &&
|
||||
compare_const_vals(&c_hi, &v_hi) <= 0;
|
||||
if match_ { Some(vec::from_slice(r.tail())) } else { None }
|
||||
}
|
||||
pat_vec(before, slice, after) => {
|
||||
match ctor_id {
|
||||
match *ctor_id {
|
||||
vec(_) => {
|
||||
let num_elements = before.len() + after.len();
|
||||
if num_elements < arity && slice.is_some() {
|
||||
@ -682,7 +682,7 @@ pub fn default(cx: @MatchCheckCtxt, r: &[@pat]) -> Option<~[@pat]> {
|
||||
|
||||
pub fn check_local(cx: @MatchCheckCtxt,
|
||||
loc: @local,
|
||||
&&s: (),
|
||||
s: (),
|
||||
v: visit::vt<()>) {
|
||||
visit::visit_local(loc, s, v);
|
||||
if is_refutable(cx, loc.node.pat) {
|
||||
@ -704,7 +704,7 @@ pub fn check_fn(cx: @MatchCheckCtxt,
|
||||
body: &blk,
|
||||
sp: span,
|
||||
id: node_id,
|
||||
&&s: (),
|
||||
s: (),
|
||||
v: visit::vt<()>) {
|
||||
visit::visit_fn(kind, decl, body, sp, id, s, v);
|
||||
for decl.inputs.each |input| {
|
||||
|
@ -229,7 +229,7 @@ pub fn process_crate(crate: @ast::crate,
|
||||
visit_expr_post: |e| { classify(e, tcx); },
|
||||
.. *visit::default_simple_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, (), v);
|
||||
visit::visit_crate(crate, (), v);
|
||||
tcx.sess.abort_if_errors();
|
||||
}
|
||||
|
||||
@ -426,8 +426,8 @@ pub fn lit_to_const(lit: @lit) -> const_val {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compare_const_vals(a: const_val, b: const_val) -> int {
|
||||
match (&a, &b) {
|
||||
pub fn compare_const_vals(a: &const_val, b: &const_val) -> int {
|
||||
match (a, b) {
|
||||
(&const_int(a), &const_int(b)) => {
|
||||
if a == b {
|
||||
0
|
||||
@ -478,7 +478,7 @@ pub fn compare_const_vals(a: const_val, b: const_val) -> int {
|
||||
}
|
||||
|
||||
pub fn compare_lit_exprs(tcx: middle::ty::ctxt, a: @expr, b: @expr) -> int {
|
||||
compare_const_vals(eval_const_expr(tcx, a), eval_const_expr(tcx, b))
|
||||
compare_const_vals(&eval_const_expr(tcx, a), &eval_const_expr(tcx, b))
|
||||
}
|
||||
|
||||
pub fn lit_expr_eq(tcx: middle::ty::ctxt, a: @expr, b: @expr) -> bool {
|
||||
@ -486,7 +486,7 @@ pub fn lit_expr_eq(tcx: middle::ty::ctxt, a: @expr, b: @expr) -> bool {
|
||||
}
|
||||
|
||||
pub fn lit_eq(a: @lit, b: @lit) -> bool {
|
||||
compare_const_vals(lit_to_const(a), lit_to_const(b)) == 0
|
||||
compare_const_vals(&lit_to_const(a), &lit_to_const(b)) == 0
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,9 +42,9 @@ fn collect_freevars(def_map: resolve::DefMap, blk: &ast::blk)
|
||||
let seen = @mut HashMap::new();
|
||||
let refs = @mut ~[];
|
||||
|
||||
fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }
|
||||
fn ignore_item(_i: @ast::item, _depth: int, _v: visit::vt<int>) { }
|
||||
|
||||
let walk_expr: @fn(expr: @ast::expr, &&depth: int, v: visit::vt<int>) =
|
||||
let walk_expr: @fn(expr: @ast::expr, depth: int, v: visit::vt<int>) =
|
||||
|expr, depth, v| {
|
||||
match expr.node {
|
||||
ast::expr_fn_block(*) => visit::visit_expr(expr, depth + 1, v),
|
||||
@ -107,7 +107,7 @@ pub fn annotate_freevars(def_map: resolve::DefMap, crate: @ast::crate) ->
|
||||
visit::mk_simple_visitor(@visit::SimpleVisitor {
|
||||
visit_fn: walk_fn,
|
||||
.. *visit::default_simple_visitor()});
|
||||
visit::visit_crate(*crate, (), visitor);
|
||||
visit::visit_crate(crate, (), visitor);
|
||||
|
||||
return freevars;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ pub fn check_crate(tcx: ty::ctxt,
|
||||
visit_block: check_block,
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, ctx, visit);
|
||||
visit::visit_crate(crate, ctx, visit);
|
||||
tcx.sess.abort_if_errors();
|
||||
}
|
||||
|
||||
@ -573,7 +573,7 @@ pub fn check_cast_for_escaping_regions(
|
||||
true
|
||||
});
|
||||
|
||||
fn is_re_scope(+r: ty::Region) -> bool {
|
||||
fn is_re_scope(r: ty::Region) -> bool {
|
||||
match r {
|
||||
ty::re_scope(*) => true,
|
||||
_ => false
|
||||
|
@ -370,7 +370,7 @@ pub impl<'self> LanguageItemCollector<'self> {
|
||||
|
||||
fn collect_local_language_items(&self) {
|
||||
let this = ptr::addr_of(&self);
|
||||
visit_crate(*self.crate, (), mk_simple_visitor(@SimpleVisitor {
|
||||
visit_crate(self.crate, (), mk_simple_visitor(@SimpleVisitor {
|
||||
visit_item: |item| {
|
||||
for item.attrs.each |attribute| {
|
||||
unsafe {
|
||||
|
@ -348,7 +348,7 @@ pub impl Context {
|
||||
}
|
||||
}
|
||||
|
||||
fn span_lint(&self, level: level, span: span, +msg: ~str) {
|
||||
fn span_lint(&self, level: level, span: span, msg: ~str) {
|
||||
self.sess.span_lint_level(level, span, msg);
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ pub impl Context {
|
||||
}
|
||||
|
||||
|
||||
fn build_settings_item(i: @ast::item, &&cx: Context, v: visit::vt<Context>) {
|
||||
fn build_settings_item(i: @ast::item, cx: Context, v: visit::vt<Context>) {
|
||||
do cx.with_lint_attrs(/*bad*/copy i.attrs) |cx| {
|
||||
if !cx.is_default {
|
||||
cx.sess.lint_settings.settings_map.insert(i.id, cx.curr);
|
||||
@ -481,7 +481,7 @@ pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
|
||||
visit_item: build_settings_item,
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, cx, visit);
|
||||
visit::visit_crate(crate, cx, visit);
|
||||
}
|
||||
|
||||
sess.abort_if_errors();
|
||||
@ -1088,7 +1088,7 @@ pub fn check_crate(tcx: ty::ctxt, crate: @ast::crate) {
|
||||
check_fn(tcx, fk, decl, body, span, id),
|
||||
.. *visit::default_simple_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, (), v);
|
||||
visit::visit_crate(crate, (), v);
|
||||
|
||||
tcx.sess.abort_if_errors();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ pub fn check_crate(tcx: ty::ctxt,
|
||||
capture_map,
|
||||
last_use_map,
|
||||
0);
|
||||
visit::visit_crate(*crate, initial_maps, visitor);
|
||||
visit::visit_crate(crate, initial_maps, visitor);
|
||||
tcx.sess.abort_if_errors();
|
||||
return last_use_map;
|
||||
}
|
||||
@ -358,7 +358,7 @@ pub impl IrMaps {
|
||||
}
|
||||
}
|
||||
|
||||
fn set_captures(&mut self, node_id: node_id, +cs: ~[CaptureInfo]) {
|
||||
fn set_captures(&mut self, node_id: node_id, cs: ~[CaptureInfo]) {
|
||||
self.capture_info_map.insert(node_id, @cs);
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ pub impl IrMaps {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_item(item: @item, &&self: @mut IrMaps, v: vt<@mut IrMaps>) {
|
||||
fn visit_item(item: @item, self: @mut IrMaps, v: vt<@mut IrMaps>) {
|
||||
do with(&mut self.cur_item, item.id) {
|
||||
visit::visit_item(item, self, v)
|
||||
}
|
||||
@ -413,7 +413,7 @@ fn visit_fn(fk: &visit::fn_kind,
|
||||
body: &blk,
|
||||
sp: span,
|
||||
id: node_id,
|
||||
&&self: @mut IrMaps,
|
||||
self: @mut IrMaps,
|
||||
v: vt<@mut IrMaps>) {
|
||||
debug!("visit_fn: id=%d", id);
|
||||
let _i = ::util::common::indenter();
|
||||
@ -489,7 +489,7 @@ fn visit_fn(fk: &visit::fn_kind,
|
||||
lsets.warn_about_unused_args(decl, entry_ln);
|
||||
}
|
||||
|
||||
fn visit_local(local: @local, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
|
||||
fn visit_local(local: @local, self: @mut IrMaps, vt: vt<@mut IrMaps>) {
|
||||
let def_map = self.tcx.def_map;
|
||||
do pat_util::pat_bindings(def_map, local.node.pat) |_bm, p_id, sp, path| {
|
||||
debug!("adding local variable %d", p_id);
|
||||
@ -509,7 +509,7 @@ fn visit_local(local: @local, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
|
||||
visit::visit_local(local, self, vt);
|
||||
}
|
||||
|
||||
fn visit_arm(arm: &arm, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
|
||||
fn visit_arm(arm: &arm, self: @mut IrMaps, vt: vt<@mut IrMaps>) {
|
||||
let def_map = self.tcx.def_map;
|
||||
for arm.pats.each |pat| {
|
||||
do pat_util::pat_bindings(def_map, *pat) |bm, p_id, sp, path| {
|
||||
@ -528,7 +528,7 @@ fn visit_arm(arm: &arm, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
|
||||
visit::visit_arm(arm, self, vt);
|
||||
}
|
||||
|
||||
fn visit_expr(expr: @expr, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
|
||||
fn visit_expr(expr: @expr, self: @mut IrMaps, vt: vt<@mut IrMaps>) {
|
||||
match expr.node {
|
||||
// live nodes required for uses or definitions of variables:
|
||||
expr_path(_) => {
|
||||
@ -1510,7 +1510,7 @@ pub impl Liveness {
|
||||
// _______________________________________________________________________
|
||||
// Checking for error conditions
|
||||
|
||||
fn check_local(local: @local, &&self: @Liveness, vt: vt<@Liveness>) {
|
||||
fn check_local(local: @local, self: @Liveness, vt: vt<@Liveness>) {
|
||||
match local.node.init {
|
||||
Some(_) => {
|
||||
|
||||
@ -1544,14 +1544,14 @@ fn check_local(local: @local, &&self: @Liveness, vt: vt<@Liveness>) {
|
||||
visit::visit_local(local, self, vt);
|
||||
}
|
||||
|
||||
fn check_arm(arm: &arm, &&self: @Liveness, vt: vt<@Liveness>) {
|
||||
fn check_arm(arm: &arm, self: @Liveness, vt: vt<@Liveness>) {
|
||||
do self.arm_pats_bindings(arm.pats) |ln, var, sp, id| {
|
||||
self.warn_about_unused(sp, id, ln, var);
|
||||
}
|
||||
visit::visit_arm(arm, self, vt);
|
||||
}
|
||||
|
||||
fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
|
||||
fn check_expr(expr: @expr, self: @Liveness, vt: vt<@Liveness>) {
|
||||
match expr.node {
|
||||
expr_path(_) => {
|
||||
for self.variable_from_def_map(expr.id, expr.span).each |var| {
|
||||
@ -1632,7 +1632,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
|
||||
|
||||
fn check_fn(_fk: &visit::fn_kind, _decl: &fn_decl,
|
||||
_body: &blk, _sp: span, _id: node_id,
|
||||
&&_self: @Liveness, _v: vt<@Liveness>) {
|
||||
_self: @Liveness, _v: vt<@Liveness>) {
|
||||
// do not check contents of nested fns
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ pub fn compute_moves(tcx: ty::ctxt,
|
||||
capture_map: @mut HashMap::new()
|
||||
}
|
||||
};
|
||||
visit::visit_crate(*crate, visit_cx, visitor);
|
||||
visit::visit_crate(crate, visit_cx, visitor);
|
||||
return visit_cx.move_maps;
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ pub fn compute_moves(tcx: ty::ctxt,
|
||||
// Expressions
|
||||
|
||||
fn compute_modes_for_expr(expr: @expr,
|
||||
&&cx: VisitContext,
|
||||
cx: VisitContext,
|
||||
v: vt<VisitContext>)
|
||||
{
|
||||
cx.consume_expr(expr, v);
|
||||
@ -760,7 +760,7 @@ pub impl VisitContext {
|
||||
|
||||
fn arms_have_by_move_bindings(&self,
|
||||
moves_map: MovesMap,
|
||||
+arms: &[arm]) -> bool
|
||||
arms: &[arm]) -> bool
|
||||
{
|
||||
for arms.each |arm| {
|
||||
for arm.pats.each |pat| {
|
||||
|
@ -604,6 +604,6 @@ pub fn check_crate(tcx: ty::ctxt,
|
||||
},
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, method_map, visitor);
|
||||
visit::visit_crate(crate, method_map, visitor);
|
||||
}
|
||||
|
||||
|
@ -496,7 +496,7 @@ pub fn resolve_crate(sess: Session,
|
||||
visit_local: resolve_local,
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, cx, visitor);
|
||||
visit::visit_crate(crate, cx, visitor);
|
||||
return region_maps;
|
||||
}
|
||||
|
||||
@ -549,8 +549,8 @@ pub struct DetermineRpCtxt {
|
||||
ambient_variance: region_variance,
|
||||
}
|
||||
|
||||
pub fn join_variance(++variance1: region_variance,
|
||||
++variance2: region_variance)
|
||||
pub fn join_variance(variance1: region_variance,
|
||||
variance2: region_variance)
|
||||
-> region_variance {
|
||||
match (variance1, variance2) {
|
||||
(rv_invariant, _) => {rv_invariant}
|
||||
@ -570,8 +570,8 @@ pub fn join_variance(++variance1: region_variance,
|
||||
/// appears in a co-variant position. This implies that this
|
||||
/// occurrence of `r` is contra-variant with respect to the current
|
||||
/// item, and hence the function returns `rv_contravariant`.
|
||||
pub fn add_variance(+ambient_variance: region_variance,
|
||||
+variance: region_variance)
|
||||
pub fn add_variance(ambient_variance: region_variance,
|
||||
variance: region_variance)
|
||||
-> region_variance {
|
||||
match (ambient_variance, variance) {
|
||||
(rv_invariant, _) => rv_invariant,
|
||||
@ -719,7 +719,7 @@ pub impl DetermineRpCtxt {
|
||||
}
|
||||
|
||||
pub fn determine_rp_in_item(item: @ast::item,
|
||||
&&cx: @mut DetermineRpCtxt,
|
||||
cx: @mut DetermineRpCtxt,
|
||||
visitor: visit::vt<@mut DetermineRpCtxt>) {
|
||||
do cx.with(item.id, true) {
|
||||
visit::visit_item(item, cx, visitor);
|
||||
@ -731,7 +731,7 @@ pub fn determine_rp_in_fn(fk: &visit::fn_kind,
|
||||
body: &ast::blk,
|
||||
_: span,
|
||||
_: ast::node_id,
|
||||
&&cx: @mut DetermineRpCtxt,
|
||||
cx: @mut DetermineRpCtxt,
|
||||
visitor: visit::vt<@mut DetermineRpCtxt>) {
|
||||
do cx.with(cx.item_id, false) {
|
||||
do cx.with_ambient_variance(rv_contravariant) {
|
||||
@ -747,7 +747,7 @@ pub fn determine_rp_in_fn(fk: &visit::fn_kind,
|
||||
}
|
||||
|
||||
pub fn determine_rp_in_ty_method(ty_m: &ast::ty_method,
|
||||
&&cx: @mut DetermineRpCtxt,
|
||||
cx: @mut DetermineRpCtxt,
|
||||
visitor: visit::vt<@mut DetermineRpCtxt>) {
|
||||
do cx.with(cx.item_id, false) {
|
||||
visit::visit_ty_method(ty_m, cx, visitor);
|
||||
@ -755,7 +755,7 @@ pub fn determine_rp_in_ty_method(ty_m: &ast::ty_method,
|
||||
}
|
||||
|
||||
pub fn determine_rp_in_ty(ty: @ast::Ty,
|
||||
&&cx: @mut DetermineRpCtxt,
|
||||
cx: @mut DetermineRpCtxt,
|
||||
visitor: visit::vt<@mut DetermineRpCtxt>) {
|
||||
// we are only interested in types that will require an item to
|
||||
// be region-parameterized. if cx.item_id is zero, then this type
|
||||
@ -871,7 +871,7 @@ pub fn determine_rp_in_ty(ty: @ast::Ty,
|
||||
}
|
||||
|
||||
fn visit_mt(mt: ast::mt,
|
||||
&&cx: @mut DetermineRpCtxt,
|
||||
cx: @mut DetermineRpCtxt,
|
||||
visitor: visit::vt<@mut DetermineRpCtxt>) {
|
||||
// mutability is invariant
|
||||
if mt.mutbl == ast::m_mutbl {
|
||||
@ -886,7 +886,7 @@ pub fn determine_rp_in_ty(ty: @ast::Ty,
|
||||
|
||||
pub fn determine_rp_in_struct_field(
|
||||
cm: @ast::struct_field,
|
||||
&&cx: @mut DetermineRpCtxt,
|
||||
cx: @mut DetermineRpCtxt,
|
||||
visitor: visit::vt<@mut DetermineRpCtxt>) {
|
||||
match cm.node.kind {
|
||||
ast::named_field(_, ast::struct_mutable, _) => {
|
||||
@ -903,7 +903,7 @@ pub fn determine_rp_in_struct_field(
|
||||
|
||||
pub fn determine_rp_in_crate(sess: Session,
|
||||
ast_map: ast_map::map,
|
||||
+def_map: resolve::DefMap,
|
||||
def_map: resolve::DefMap,
|
||||
crate: @ast::crate)
|
||||
-> region_paramd_items {
|
||||
let cx = @mut DetermineRpCtxt {
|
||||
@ -927,7 +927,7 @@ pub fn determine_rp_in_crate(sess: Session,
|
||||
visit_struct_field: determine_rp_in_struct_field,
|
||||
.. *visit::default_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, cx, visitor);
|
||||
visit::visit_crate(crate, cx, visitor);
|
||||
|
||||
// Propagate indirect dependencies
|
||||
//
|
||||
|
@ -351,7 +351,7 @@ pub struct ImportDirective {
|
||||
}
|
||||
|
||||
pub fn ImportDirective(privacy: Privacy,
|
||||
+module_path: ~[ident],
|
||||
module_path: ~[ident],
|
||||
subclass: @ImportDirectiveSubclass,
|
||||
span: span)
|
||||
-> ImportDirective {
|
||||
@ -401,7 +401,7 @@ pub struct ImportResolution {
|
||||
}
|
||||
|
||||
pub fn ImportResolution(privacy: Privacy,
|
||||
+span: span,
|
||||
span: span,
|
||||
state: @mut ImportState) -> ImportResolution {
|
||||
ImportResolution {
|
||||
privacy: privacy,
|
||||
@ -904,7 +904,7 @@ pub impl Resolver {
|
||||
fn build_reduced_graph(@mut self) {
|
||||
let initial_parent =
|
||||
ModuleReducedGraphParent(self.graph_root.get_module());
|
||||
visit_crate(*self.crate, initial_parent, mk_vt(@Visitor {
|
||||
visit_crate(self.crate, initial_parent, mk_vt(@Visitor {
|
||||
visit_item: |item, context, visitor|
|
||||
self.build_reduced_graph_for_item(item, context, visitor),
|
||||
|
||||
@ -1088,7 +1088,7 @@ pub impl Resolver {
|
||||
fn build_reduced_graph_for_item(@mut self,
|
||||
item: @item,
|
||||
parent: ReducedGraphParent,
|
||||
&&visitor: vt<ReducedGraphParent>) {
|
||||
visitor: vt<ReducedGraphParent>) {
|
||||
let ident = item.ident;
|
||||
let sp = item.span;
|
||||
let privacy = visibility_to_privacy(item.vis);
|
||||
@ -1173,7 +1173,7 @@ pub impl Resolver {
|
||||
(privacy, def_ty(local_def(item.id)), sp);
|
||||
|
||||
for (*enum_definition).variants.each |variant| {
|
||||
self.build_reduced_graph_for_variant(*variant,
|
||||
self.build_reduced_graph_for_variant(variant,
|
||||
local_def(item.id),
|
||||
// inherited => privacy of the enum item
|
||||
variant_visibility_to_privacy(variant.node.vis,
|
||||
@ -1362,11 +1362,11 @@ pub impl Resolver {
|
||||
// Constructs the reduced graph for one variant. Variants exist in the
|
||||
// type and/or value namespaces.
|
||||
fn build_reduced_graph_for_variant(@mut self,
|
||||
variant: variant,
|
||||
variant: &variant,
|
||||
item_id: def_id,
|
||||
+parent_privacy: Privacy,
|
||||
parent_privacy: Privacy,
|
||||
parent: ReducedGraphParent,
|
||||
&&_visitor: vt<ReducedGraphParent>) {
|
||||
_visitor: vt<ReducedGraphParent>) {
|
||||
let ident = variant.node.name;
|
||||
let (child, _) = self.add_child(ident, parent, ForbidDuplicateValues,
|
||||
variant.span);
|
||||
@ -1402,7 +1402,7 @@ pub impl Resolver {
|
||||
fn build_reduced_graph_for_view_item(@mut self,
|
||||
view_item: @view_item,
|
||||
parent: ReducedGraphParent,
|
||||
&&_visitor: vt<ReducedGraphParent>) {
|
||||
_visitor: vt<ReducedGraphParent>) {
|
||||
let privacy = visibility_to_privacy(view_item.vis);
|
||||
match view_item.node {
|
||||
view_item_use(ref view_paths) => {
|
||||
@ -1495,7 +1495,7 @@ pub impl Resolver {
|
||||
fn build_reduced_graph_for_foreign_item(@mut self,
|
||||
foreign_item: @foreign_item,
|
||||
parent: ReducedGraphParent,
|
||||
&&visitor:
|
||||
visitor:
|
||||
vt<ReducedGraphParent>) {
|
||||
let name = foreign_item.ident;
|
||||
let (name_bindings, new_parent) =
|
||||
@ -1526,7 +1526,7 @@ pub impl Resolver {
|
||||
fn build_reduced_graph_for_block(@mut self,
|
||||
block: &blk,
|
||||
parent: ReducedGraphParent,
|
||||
&&visitor: vt<ReducedGraphParent>) {
|
||||
visitor: vt<ReducedGraphParent>) {
|
||||
let mut new_parent;
|
||||
if self.block_needs_anonymous_module(block) {
|
||||
let block_id = block.node.id;
|
||||
@ -1849,7 +1849,7 @@ pub impl Resolver {
|
||||
fn build_import_directive(@mut self,
|
||||
privacy: Privacy,
|
||||
module_: @mut Module,
|
||||
+module_path: ~[ident],
|
||||
module_path: ~[ident],
|
||||
subclass: @ImportDirectiveSubclass,
|
||||
span: span) {
|
||||
let directive = @ImportDirective(privacy, module_path,
|
||||
@ -2912,7 +2912,7 @@ pub impl Resolver {
|
||||
module_: @mut Module,
|
||||
name: ident,
|
||||
namespace: Namespace,
|
||||
+name_search_type: NameSearchType)
|
||||
name_search_type: NameSearchType)
|
||||
-> ResolveResult<Target> {
|
||||
debug!("(resolving name in module) resolving `%s` in `%s`",
|
||||
*self.session.str_of(name),
|
||||
@ -3352,7 +3352,7 @@ pub impl Resolver {
|
||||
fn resolve_crate(@mut self) {
|
||||
debug!("(resolving crate) starting");
|
||||
|
||||
visit_crate(*self.crate, (), mk_vt(@Visitor {
|
||||
visit_crate(self.crate, (), mk_vt(@Visitor {
|
||||
visit_item: |item, _context, visitor|
|
||||
self.resolve_item(item, visitor),
|
||||
visit_arm: |arm, _context, visitor|
|
||||
@ -3509,7 +3509,7 @@ pub impl Resolver {
|
||||
self.resolve_struct(item.id,
|
||||
generics,
|
||||
struct_def.fields,
|
||||
struct_def.dtor,
|
||||
&struct_def.dtor,
|
||||
visitor);
|
||||
}
|
||||
|
||||
@ -3768,7 +3768,7 @@ pub impl Resolver {
|
||||
id: node_id,
|
||||
generics: &Generics,
|
||||
fields: &[@struct_field],
|
||||
optional_destructor: Option<struct_dtor>,
|
||||
optional_destructor: &Option<struct_dtor>,
|
||||
visitor: ResolveVisitor) {
|
||||
// If applicable, create a rib for the type parameters.
|
||||
do self.with_type_parameter_rib(HasTypeParameters
|
||||
@ -3784,7 +3784,7 @@ pub impl Resolver {
|
||||
}
|
||||
|
||||
// Resolve the destructor, if applicable.
|
||||
match optional_destructor {
|
||||
match *optional_destructor {
|
||||
None => {
|
||||
// Nothing to do.
|
||||
}
|
||||
@ -4525,7 +4525,7 @@ pub impl Resolver {
|
||||
|
||||
fn resolve_module_relative_path(@mut self,
|
||||
path: @Path,
|
||||
+xray: XrayFlag,
|
||||
xray: XrayFlag,
|
||||
namespace: Namespace)
|
||||
-> Option<def> {
|
||||
let module_path_idents = self.intern_module_part_of_path(path);
|
||||
@ -4571,7 +4571,7 @@ pub impl Resolver {
|
||||
/// import resolution.
|
||||
fn resolve_crate_relative_path(@mut self,
|
||||
path: @Path,
|
||||
+xray: XrayFlag,
|
||||
xray: XrayFlag,
|
||||
namespace: Namespace)
|
||||
-> Option<def> {
|
||||
let module_path_idents = self.intern_module_part_of_path(path);
|
||||
@ -5076,7 +5076,7 @@ pub impl Resolver {
|
||||
|
||||
fn add_fixed_trait_for_expr(@mut self,
|
||||
expr_id: node_id,
|
||||
+trait_id: def_id) {
|
||||
trait_id: def_id) {
|
||||
self.trait_map.insert(expr_id, @mut ~[trait_id]);
|
||||
}
|
||||
|
||||
|
@ -785,7 +785,7 @@ pub fn enter_region<'r>(bcx: block,
|
||||
// on a set of enum variants or a literal.
|
||||
pub fn get_options(bcx: block, m: &[@Match], col: uint) -> ~[Opt] {
|
||||
let ccx = bcx.ccx();
|
||||
fn add_to_set(tcx: ty::ctxt, set: &mut ~[Opt], +val: Opt) {
|
||||
fn add_to_set(tcx: ty::ctxt, set: &mut ~[Opt], val: Opt) {
|
||||
if set.any(|l| opt_eq(tcx, l, &val)) {return;}
|
||||
set.push(val);
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ fn fcx_has_nonzero_span(fcx: fn_ctxt) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_fn_time(ccx: @CrateContext, +name: ~str, start: time::Timespec,
|
||||
pub fn log_fn_time(ccx: @CrateContext, name: ~str, start: time::Timespec,
|
||||
end: time::Timespec) {
|
||||
let elapsed = 1000 * ((end.sec - start.sec) as int) +
|
||||
((end.nsec as int) - (start.nsec as int)) / 1000000;
|
||||
@ -165,7 +165,7 @@ pub fn decl_cdecl_fn(llmod: ModuleRef, name: &str, llty: TypeRef)
|
||||
|
||||
// Only use this if you are going to actually define the function. It's
|
||||
// not valid to simply declare a function as internal.
|
||||
pub fn decl_internal_cdecl_fn(llmod: ModuleRef, +name: ~str, llty: TypeRef) ->
|
||||
pub fn decl_internal_cdecl_fn(llmod: ModuleRef, name: ~str, llty: TypeRef) ->
|
||||
ValueRef {
|
||||
let llfn = decl_cdecl_fn(llmod, name, llty);
|
||||
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
|
||||
@ -828,7 +828,7 @@ pub fn trans_external_path(ccx: @CrateContext, did: ast::def_id, t: ty::t)
|
||||
};
|
||||
}
|
||||
|
||||
pub fn invoke(bcx: block, llfn: ValueRef, +llargs: ~[ValueRef])
|
||||
pub fn invoke(bcx: block, llfn: ValueRef, llargs: ~[ValueRef])
|
||||
-> (ValueRef, block) {
|
||||
let _icx = bcx.insn_ctxt("invoke_");
|
||||
if bcx.unreachable {
|
||||
@ -924,7 +924,7 @@ pub fn have_cached_lpad(bcx: block) -> bool {
|
||||
return res;
|
||||
}
|
||||
|
||||
pub fn in_lpad_scope_cx(bcx: block, f: &fn(+si: &mut scope_info)) {
|
||||
pub fn in_lpad_scope_cx(bcx: block, f: &fn(si: &mut scope_info)) {
|
||||
let mut bcx = bcx;
|
||||
loop {
|
||||
{
|
||||
@ -1057,10 +1057,7 @@ pub fn do_spill(bcx: block, v: ValueRef, t: ty::t) -> ValueRef {
|
||||
|
||||
// Since this function does *not* root, it is the caller's responsibility to
|
||||
// ensure that the referent is pointed to by a root.
|
||||
// [Note-arg-mode]
|
||||
// ++ mode is temporary, due to how borrowck treats enums. With hope,
|
||||
// will go away anyway when we get rid of modes.
|
||||
pub fn do_spill_noroot(++cx: block, v: ValueRef) -> ValueRef {
|
||||
pub fn do_spill_noroot(cx: block, v: ValueRef) -> ValueRef {
|
||||
let llptr = alloca(cx, val_ty(v));
|
||||
Store(cx, v, llptr);
|
||||
return llptr;
|
||||
@ -1163,7 +1160,7 @@ pub fn init_local(bcx: block, local: @ast::local) -> block {
|
||||
_match::BindLocal);
|
||||
}
|
||||
|
||||
pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
|
||||
pub fn trans_stmt(cx: block, s: &ast::stmt) -> block {
|
||||
let _icx = cx.insn_ctxt("trans_stmt");
|
||||
debug!("trans_stmt(%s)", stmt_to_str(s, cx.tcx().sess.intr()));
|
||||
|
||||
@ -1189,7 +1186,7 @@ pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
|
||||
}
|
||||
}
|
||||
}
|
||||
ast::decl_item(i) => trans_item(*cx.fcx.ccx, *i)
|
||||
ast::decl_item(i) => trans_item(*cx.fcx.ccx, i)
|
||||
}
|
||||
}
|
||||
ast::stmt_mac(*) => cx.tcx().sess.bug(~"unexpanded macro")
|
||||
@ -1200,8 +1197,8 @@ pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
|
||||
|
||||
// You probably don't want to use this one. See the
|
||||
// next three functions instead.
|
||||
pub fn new_block(cx: fn_ctxt, parent: Option<block>, +kind: block_kind,
|
||||
is_lpad: bool, +name: ~str, opt_node_info: Option<NodeInfo>)
|
||||
pub fn new_block(cx: fn_ctxt, parent: Option<block>, kind: block_kind,
|
||||
is_lpad: bool, name: ~str, opt_node_info: Option<NodeInfo>)
|
||||
-> block {
|
||||
|
||||
let s = if cx.ccx.sess.opts.save_temps || cx.ccx.sess.opts.debuginfo {
|
||||
@ -1245,7 +1242,7 @@ pub fn top_scope_block(fcx: fn_ctxt, opt_node_info: Option<NodeInfo>)
|
||||
|
||||
pub fn scope_block(bcx: block,
|
||||
opt_node_info: Option<NodeInfo>,
|
||||
+n: ~str) -> block {
|
||||
n: ~str) -> block {
|
||||
return new_block(bcx.fcx, Some(bcx), simple_block_scope(), bcx.is_lpad,
|
||||
n, opt_node_info);
|
||||
}
|
||||
@ -1253,7 +1250,7 @@ pub fn scope_block(bcx: block,
|
||||
pub fn loop_scope_block(bcx: block,
|
||||
loop_break: block,
|
||||
loop_label: Option<ident>,
|
||||
+n: ~str,
|
||||
n: ~str,
|
||||
opt_node_info: Option<NodeInfo>) -> block {
|
||||
return new_block(bcx.fcx, Some(bcx), block_scope(scope_info {
|
||||
loop_break: Some(loop_break),
|
||||
@ -1265,12 +1262,12 @@ pub fn loop_scope_block(bcx: block,
|
||||
}
|
||||
|
||||
// Use this when creating a block for the inside of a landing pad.
|
||||
pub fn lpad_block(bcx: block, +n: ~str) -> block {
|
||||
pub fn lpad_block(bcx: block, n: ~str) -> block {
|
||||
new_block(bcx.fcx, Some(bcx), block_non_scope, true, n, None)
|
||||
}
|
||||
|
||||
// Use this when you're making a general CFG BB within a scope.
|
||||
pub fn sub_block(bcx: block, +n: ~str) -> block {
|
||||
pub fn sub_block(bcx: block, n: ~str) -> block {
|
||||
new_block(bcx.fcx, Some(bcx), block_non_scope, bcx.is_lpad, n, None)
|
||||
}
|
||||
|
||||
@ -1286,12 +1283,12 @@ pub fn raw_block(fcx: fn_ctxt, is_lpad: bool, llbb: BasicBlockRef) -> block {
|
||||
// need to make sure those variables go out of scope when the block ends. We
|
||||
// do that by running a 'cleanup' function for each variable.
|
||||
// trans_block_cleanups runs all the cleanup functions for the block.
|
||||
pub fn trans_block_cleanups(bcx: block, +cleanups: ~[cleanup]) -> block {
|
||||
pub fn trans_block_cleanups(bcx: block, cleanups: ~[cleanup]) -> block {
|
||||
trans_block_cleanups_(bcx, cleanups, false)
|
||||
}
|
||||
|
||||
pub fn trans_block_cleanups_(bcx: block,
|
||||
+cleanups: ~[cleanup],
|
||||
cleanups: ~[cleanup],
|
||||
/* cleanup_cx: block, */
|
||||
is_lpad: bool) -> block {
|
||||
let _icx = bcx.insn_ctxt("trans_block_cleanups");
|
||||
@ -1387,7 +1384,7 @@ pub fn leave_block(bcx: block, out_of: block) -> block {
|
||||
|
||||
pub fn with_scope(bcx: block,
|
||||
opt_node_info: Option<NodeInfo>,
|
||||
+name: ~str,
|
||||
name: ~str,
|
||||
f: &fn(block) -> block) -> block {
|
||||
let _icx = bcx.insn_ctxt("with_scope");
|
||||
|
||||
@ -1402,7 +1399,7 @@ pub fn with_scope(bcx: block,
|
||||
|
||||
pub fn with_scope_result(bcx: block,
|
||||
opt_node_info: Option<NodeInfo>,
|
||||
+name: ~str,
|
||||
name: ~str,
|
||||
f: &fn(block) -> Result) -> Result {
|
||||
let _icx = bcx.insn_ctxt("with_scope_result");
|
||||
let scope_cx = scope_block(bcx, opt_node_info, name);
|
||||
@ -1412,7 +1409,7 @@ pub fn with_scope_result(bcx: block,
|
||||
}
|
||||
|
||||
pub fn with_scope_datumblock(bcx: block, opt_node_info: Option<NodeInfo>,
|
||||
+name: ~str, f: &fn(block) -> datum::DatumBlock)
|
||||
name: ~str, f: &fn(block) -> datum::DatumBlock)
|
||||
-> datum::DatumBlock {
|
||||
use middle::trans::datum::DatumBlock;
|
||||
|
||||
@ -1620,7 +1617,7 @@ pub fn make_return_pointer(fcx: fn_ctxt, output_type: ty::t) -> ValueRef {
|
||||
// - new_fn_ctxt
|
||||
// - trans_args
|
||||
pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
|
||||
+path: path,
|
||||
path: path,
|
||||
llfndecl: ValueRef,
|
||||
id: ast::node_id,
|
||||
output_type: ty::t,
|
||||
@ -1674,7 +1671,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
|
||||
}
|
||||
|
||||
pub fn new_fn_ctxt(ccx: @CrateContext,
|
||||
+path: path,
|
||||
path: path,
|
||||
llfndecl: ValueRef,
|
||||
output_type: ty::t,
|
||||
sp: Option<span>)
|
||||
@ -1839,7 +1836,7 @@ pub enum self_arg { impl_self(ty::t), impl_owned_self(ty::t), no_self, }
|
||||
// If the function closes over its environment a closure will be
|
||||
// returned.
|
||||
pub fn trans_closure(ccx: @CrateContext,
|
||||
+path: path,
|
||||
path: path,
|
||||
decl: &ast::fn_decl,
|
||||
body: &ast::blk,
|
||||
llfndecl: ValueRef,
|
||||
@ -1920,7 +1917,7 @@ pub fn trans_closure(ccx: @CrateContext,
|
||||
// trans_fn: creates an LLVM function corresponding to a source language
|
||||
// function.
|
||||
pub fn trans_fn(ccx: @CrateContext,
|
||||
+path: path,
|
||||
path: path,
|
||||
decl: &ast::fn_decl,
|
||||
body: &ast::blk,
|
||||
llfndecl: ValueRef,
|
||||
@ -1965,7 +1962,7 @@ pub fn trans_fn(ccx: @CrateContext,
|
||||
|
||||
pub fn trans_enum_variant(ccx: @CrateContext,
|
||||
enum_id: ast::node_id,
|
||||
variant: ast::variant,
|
||||
variant: &ast::variant,
|
||||
args: &[ast::variant_arg],
|
||||
disr: int,
|
||||
param_substs: Option<@param_substs>,
|
||||
@ -2108,7 +2105,7 @@ pub fn trans_tuple_struct(ccx: @CrateContext,
|
||||
}
|
||||
|
||||
pub fn trans_struct_dtor(ccx: @CrateContext,
|
||||
+path: path,
|
||||
path: path,
|
||||
body: &ast::blk,
|
||||
dtor_id: ast::node_id,
|
||||
psubsts: Option<@param_substs>,
|
||||
@ -2154,7 +2151,7 @@ pub fn trans_struct_dtor(ccx: @CrateContext,
|
||||
lldecl
|
||||
}
|
||||
|
||||
pub fn trans_enum_def(ccx: @CrateContext, enum_definition: ast::enum_def,
|
||||
pub fn trans_enum_def(ccx: @CrateContext, enum_definition: &ast::enum_def,
|
||||
id: ast::node_id,
|
||||
path: @ast_map::path, vi: @~[ty::VariantInfo],
|
||||
i: &mut uint) {
|
||||
@ -2165,7 +2162,7 @@ pub fn trans_enum_def(ccx: @CrateContext, enum_definition: ast::enum_def,
|
||||
match variant.node.kind {
|
||||
ast::tuple_variant_kind(ref args) if args.len() > 0 => {
|
||||
let llfn = get_item_val(ccx, variant.node.id);
|
||||
trans_enum_variant(ccx, id, *variant, *args,
|
||||
trans_enum_variant(ccx, id, variant, *args,
|
||||
disr_val, None, llfn);
|
||||
}
|
||||
ast::tuple_variant_kind(_) => {
|
||||
@ -2179,7 +2176,7 @@ pub fn trans_enum_def(ccx: @CrateContext, enum_definition: ast::enum_def,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn trans_item(ccx: @CrateContext, item: ast::item) {
|
||||
pub fn trans_item(ccx: @CrateContext, item: &ast::item) {
|
||||
let _icx = ccx.insn_ctxt("trans_item");
|
||||
let path = match *ccx.tcx.items.get(&item.id) {
|
||||
ast_map::node_item(_, p) => p,
|
||||
@ -2214,7 +2211,7 @@ pub fn trans_item(ccx: @CrateContext, item: ast::item) {
|
||||
match stmt.node {
|
||||
ast::stmt_decl(@codemap::spanned { node: ast::decl_item(i),
|
||||
_ }, _) => {
|
||||
trans_item(ccx, *i);
|
||||
trans_item(ccx, i);
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
@ -2232,7 +2229,7 @@ pub fn trans_item(ccx: @CrateContext, item: ast::item) {
|
||||
if !generics.is_type_parameterized() {
|
||||
let vi = ty::enum_variants(ccx.tcx, local_def(item.id));
|
||||
let mut i = 0;
|
||||
trans_enum_def(ccx, (*enum_definition), item.id,
|
||||
trans_enum_def(ccx, enum_definition, item.id,
|
||||
path, vi, &mut i);
|
||||
}
|
||||
}
|
||||
@ -2279,13 +2276,13 @@ pub fn trans_struct_def(ccx: @CrateContext, struct_def: @ast::struct_def,
|
||||
pub fn trans_mod(ccx: @CrateContext, m: &ast::_mod) {
|
||||
let _icx = ccx.insn_ctxt("trans_mod");
|
||||
for m.items.each |item| {
|
||||
trans_item(ccx, **item);
|
||||
trans_item(ccx, *item);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register_fn(ccx: @CrateContext,
|
||||
sp: span,
|
||||
+path: path,
|
||||
path: path,
|
||||
node_id: ast::node_id,
|
||||
attrs: &[ast::attribute])
|
||||
-> ValueRef {
|
||||
@ -2295,7 +2292,7 @@ pub fn register_fn(ccx: @CrateContext,
|
||||
|
||||
pub fn register_fn_full(ccx: @CrateContext,
|
||||
sp: span,
|
||||
+path: path,
|
||||
path: path,
|
||||
node_id: ast::node_id,
|
||||
attrs: &[ast::attribute],
|
||||
node_type: ty::t)
|
||||
@ -2307,7 +2304,7 @@ pub fn register_fn_full(ccx: @CrateContext,
|
||||
|
||||
pub fn register_fn_fuller(ccx: @CrateContext,
|
||||
sp: span,
|
||||
+path: path,
|
||||
path: path,
|
||||
node_id: ast::node_id,
|
||||
attrs: &[ast::attribute],
|
||||
node_type: ty::t,
|
||||
@ -2495,7 +2492,7 @@ pub fn item_path(ccx: @CrateContext, i: @ast::item) -> path {
|
||||
/* If there's already a symbol for the dtor with <id> and substs <substs>,
|
||||
return it; otherwise, create one and register it, returning it as well */
|
||||
pub fn get_dtor_symbol(ccx: @CrateContext,
|
||||
+path: path,
|
||||
path: path,
|
||||
id: ast::node_id,
|
||||
substs: Option<@param_substs>)
|
||||
-> ~str {
|
||||
@ -2749,7 +2746,7 @@ pub fn trans_constant(ccx: @CrateContext, it: @ast::item) {
|
||||
|
||||
pub fn trans_constants(ccx: @CrateContext, crate: &ast::crate) {
|
||||
visit::visit_crate(
|
||||
*crate, (),
|
||||
crate, (),
|
||||
visit::mk_simple_visitor(@visit::SimpleVisitor {
|
||||
visit_item: |a| trans_constant(ccx, a),
|
||||
..*visit::default_simple_visitor()
|
||||
@ -3146,7 +3143,7 @@ pub fn trans_crate(sess: session::Session,
|
||||
tcx: ty::ctxt,
|
||||
output: &Path,
|
||||
emap2: resolve::ExportMap2,
|
||||
+maps: astencode::Maps) -> (ModuleRef, LinkMeta) {
|
||||
maps: astencode::Maps) -> (ModuleRef, LinkMeta) {
|
||||
|
||||
let symbol_hasher = @hash::default_state();
|
||||
let link_meta =
|
||||
|
@ -41,7 +41,7 @@ enum x86_64_reg_class {
|
||||
memory_class
|
||||
}
|
||||
|
||||
fn is_sse(++c: x86_64_reg_class) -> bool {
|
||||
fn is_sse(c: x86_64_reg_class) -> bool {
|
||||
return match c {
|
||||
sse_fs_class | sse_fv_class |
|
||||
sse_ds_class | sse_dv_class => true,
|
||||
|
@ -444,7 +444,7 @@ pub fn body_contains_ret(body: &ast::blk) -> bool {
|
||||
}
|
||||
|
||||
// See [Note-arg-mode]
|
||||
pub fn trans_call_inner(++in_cx: block,
|
||||
pub fn trans_call_inner(in_cx: block,
|
||||
call_info: Option<NodeInfo>,
|
||||
fn_expr_ty: ty::t,
|
||||
ret_ty: ty::t,
|
||||
@ -592,7 +592,7 @@ pub enum CallArgs<'self> {
|
||||
ArgVals(&'self [ValueRef])
|
||||
}
|
||||
|
||||
pub fn trans_ret_slot(+bcx: block, +fn_ty: ty::t, +dest: expr::Dest)
|
||||
pub fn trans_ret_slot(bcx: block, fn_ty: ty::t, dest: expr::Dest)
|
||||
-> ValueRef {
|
||||
let retty = ty::ty_fn_ret(fn_ty);
|
||||
|
||||
@ -610,12 +610,12 @@ pub fn trans_ret_slot(+bcx: block, +fn_ty: ty::t, +dest: expr::Dest)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn trans_args(+cx: block,
|
||||
+args: CallArgs,
|
||||
+fn_ty: ty::t,
|
||||
+ret_flag: Option<ValueRef>,
|
||||
+autoref_arg: AutorefArg,
|
||||
+llargs: &mut ~[ValueRef]) -> block
|
||||
pub fn trans_args(cx: block,
|
||||
args: CallArgs,
|
||||
fn_ty: ty::t,
|
||||
ret_flag: Option<ValueRef>,
|
||||
autoref_arg: AutorefArg,
|
||||
llargs: &mut ~[ValueRef]) -> block
|
||||
{
|
||||
let _icx = cx.insn_ctxt("trans_args");
|
||||
let mut temp_cleanups = ~[];
|
||||
@ -663,9 +663,9 @@ pub enum AutorefArg {
|
||||
pub fn trans_arg_expr(bcx: block,
|
||||
formal_ty: ty::arg,
|
||||
arg_expr: @ast::expr,
|
||||
+temp_cleanups: &mut ~[ValueRef],
|
||||
+ret_flag: Option<ValueRef>,
|
||||
+autoref_arg: AutorefArg) -> Result {
|
||||
temp_cleanups: &mut ~[ValueRef],
|
||||
ret_flag: Option<ValueRef>,
|
||||
autoref_arg: AutorefArg) -> Result {
|
||||
let _icx = bcx.insn_ctxt("trans_arg_expr");
|
||||
let ccx = bcx.ccx();
|
||||
|
||||
|
@ -59,9 +59,9 @@ use syntax::parse::token::ident_interner;
|
||||
use syntax::{ast, ast_map};
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips};
|
||||
|
||||
pub type namegen = @fn(+s: ~str) -> ident;
|
||||
pub type namegen = @fn(s: ~str) -> ident;
|
||||
pub fn new_namegen(intr: @ident_interner) -> namegen {
|
||||
let f: @fn(+s: ~str) -> ident = |prefix| {
|
||||
let f: @fn(s: ~str) -> ident = |prefix| {
|
||||
intr.gensym(@fmt!("%s_%u",
|
||||
prefix,
|
||||
intr.gensym(@prefix).repr))
|
||||
@ -395,7 +395,7 @@ pub struct cleanup_path {
|
||||
dest: BasicBlockRef
|
||||
}
|
||||
|
||||
pub fn scope_clean_changed(+scope_info: &mut scope_info) {
|
||||
pub fn scope_clean_changed(scope_info: &mut scope_info) {
|
||||
if scope_info.cleanup_paths.len() > 0u { scope_info.cleanup_paths = ~[]; }
|
||||
scope_info.landing_pad = None;
|
||||
}
|
||||
@ -626,7 +626,7 @@ pub struct block_ {
|
||||
fcx: fn_ctxt
|
||||
}
|
||||
|
||||
pub fn block_(llbb: BasicBlockRef, parent: Option<block>, +kind: block_kind,
|
||||
pub fn block_(llbb: BasicBlockRef, parent: Option<block>, kind: block_kind,
|
||||
is_lpad: bool, node_info: Option<NodeInfo>, fcx: fn_ctxt)
|
||||
-> block_ {
|
||||
|
||||
@ -644,7 +644,7 @@ pub fn block_(llbb: BasicBlockRef, parent: Option<block>, +kind: block_kind,
|
||||
|
||||
pub type block = @mut block_;
|
||||
|
||||
pub fn mk_block(llbb: BasicBlockRef, parent: Option<block>, +kind: block_kind,
|
||||
pub fn mk_block(llbb: BasicBlockRef, parent: Option<block>, kind: block_kind,
|
||||
is_lpad: bool, node_info: Option<NodeInfo>, fcx: fn_ctxt)
|
||||
-> block {
|
||||
@mut block_(llbb, parent, kind, is_lpad, node_info, fcx)
|
||||
@ -663,7 +663,7 @@ pub fn rslt(bcx: block, val: ValueRef) -> Result {
|
||||
}
|
||||
|
||||
pub impl Result {
|
||||
fn unpack(&self, +bcx: &mut block) -> ValueRef {
|
||||
fn unpack(&self, bcx: &mut block) -> ValueRef {
|
||||
*bcx = self.bcx;
|
||||
return self.val;
|
||||
}
|
||||
@ -683,7 +683,7 @@ pub fn val_str(tn: @TypeNames, v: ValueRef) -> @str {
|
||||
return ty_str(tn, val_ty(v));
|
||||
}
|
||||
|
||||
pub fn in_scope_cx(cx: block, f: &fn(+si: &mut scope_info)) {
|
||||
pub fn in_scope_cx(cx: block, f: &fn(si: &mut scope_info)) {
|
||||
let mut cur = cx;
|
||||
loop {
|
||||
{
|
||||
@ -1252,7 +1252,7 @@ pub fn C_bytes_plus_null(bytes: &[u8]) -> ValueRef {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn C_shape(ccx: @CrateContext, +bytes: ~[u8]) -> ValueRef {
|
||||
pub fn C_shape(ccx: @CrateContext, bytes: ~[u8]) -> ValueRef {
|
||||
unsafe {
|
||||
let llshape = C_bytes_plus_null(bytes);
|
||||
let name = fmt!("shape%u", (ccx.names)(~"shape").repr);
|
||||
@ -1325,7 +1325,7 @@ pub struct mono_id_ {
|
||||
pub type mono_id = @mono_id_;
|
||||
|
||||
impl to_bytes::IterBytes for mono_param_id {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
match *self {
|
||||
mono_precise(t, ref mids) =>
|
||||
to_bytes::iter_bytes_3(&0u8, &ty::type_id(t), mids, lsb0, f),
|
||||
@ -1339,7 +1339,7 @@ impl to_bytes::IterBytes for mono_param_id {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for mono_id_ {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_2(&self.def, &self.params, lsb0, f);
|
||||
}
|
||||
}
|
||||
@ -1433,7 +1433,7 @@ pub fn resolve_vtables_in_fn_ctxt(fcx: fn_ctxt, vts: typeck::vtable_res)
|
||||
|
||||
// Apply the typaram substitutions in the fn_ctxt to a vtable. This should
|
||||
// eliminate any vtable_params.
|
||||
pub fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, +vt: typeck::vtable_origin)
|
||||
pub fn resolve_vtable_in_fn_ctxt(fcx: fn_ctxt, vt: typeck::vtable_origin)
|
||||
-> typeck::vtable_origin {
|
||||
let tcx = fcx.ccx.tcx;
|
||||
match vt {
|
||||
@ -1479,7 +1479,7 @@ pub fn find_vtable(tcx: ty::ctxt, ps: ¶m_substs,
|
||||
/*bad*/ copy ps.vtables.get()[vtable_off]
|
||||
}
|
||||
|
||||
pub fn dummy_substs(+tps: ~[ty::t]) -> ty::substs {
|
||||
pub fn dummy_substs(tps: ~[ty::t]) -> ty::substs {
|
||||
substs {
|
||||
self_r: Some(ty::re_bound(ty::br_self)),
|
||||
self_ty: None,
|
||||
|
@ -39,7 +39,7 @@ pub fn trans_block(bcx: block, b: &ast::blk, dest: expr::Dest) -> block {
|
||||
};
|
||||
for vec::each(b.node.stmts) |s| {
|
||||
debuginfo::update_source_pos(bcx, b.span);
|
||||
bcx = trans_stmt(bcx, **s);
|
||||
bcx = trans_stmt(bcx, *s);
|
||||
}
|
||||
match b.node.expr {
|
||||
Some(e) => {
|
||||
|
@ -159,7 +159,7 @@ pub impl DatumMode {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for DatumMode {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
(*self as uint).iter_bytes(lsb0, f)
|
||||
}
|
||||
}
|
||||
@ -811,7 +811,7 @@ pub impl Datum {
|
||||
}
|
||||
|
||||
pub impl DatumBlock {
|
||||
fn unpack(&self, +bcx: &mut block) -> Datum {
|
||||
fn unpack(&self, bcx: &mut block) -> Datum {
|
||||
*bcx = self.bcx;
|
||||
return self.datum;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ pub struct DebugContext {
|
||||
crate_file: ~str
|
||||
}
|
||||
|
||||
pub fn mk_ctxt(+crate: ~str, intr: @ident_interner) -> DebugContext {
|
||||
pub fn mk_ctxt(crate: ~str, intr: @ident_interner) -> DebugContext {
|
||||
DebugContext {
|
||||
llmetadata: @mut HashMap::new(),
|
||||
names: new_namegen(intr),
|
||||
@ -249,7 +249,7 @@ fn get_file_path_and_dir(work_dir: &str, full_path: &str) -> (~str, ~str) {
|
||||
}, work_dir.to_owned())
|
||||
}
|
||||
|
||||
fn create_file(cx: @CrateContext, +full_path: ~str)
|
||||
fn create_file(cx: @CrateContext, full_path: ~str)
|
||||
-> @Metadata<FileMetadata> {
|
||||
let cache = get_cache(cx);;
|
||||
let tg = FileDescriptorTag;
|
||||
@ -589,7 +589,7 @@ fn create_boxed_type(cx: @CrateContext, contents: ty::t,
|
||||
fn create_composite_type(type_tag: int, name: &str, file: ValueRef,
|
||||
line: int, size: int, align: int, offset: int,
|
||||
derived: Option<ValueRef>,
|
||||
+members: Option<~[ValueRef]>)
|
||||
members: Option<~[ValueRef]>)
|
||||
-> ValueRef {
|
||||
let lldata = ~[lltag(type_tag),
|
||||
file,
|
||||
|
@ -1572,7 +1572,7 @@ fn trans_binary(bcx: block,
|
||||
fn trans_overloaded_op(bcx: block,
|
||||
expr: @ast::expr,
|
||||
rcvr: @ast::expr,
|
||||
+args: ~[@ast::expr],
|
||||
args: ~[@ast::expr],
|
||||
ret_ty: ty::t,
|
||||
dest: Dest)
|
||||
-> block {
|
||||
@ -1746,6 +1746,6 @@ fn trans_assign_op(bcx: block,
|
||||
return result_datum.copy_to_datum(bcx, DROP_EXISTING, dst_datum);
|
||||
}
|
||||
|
||||
fn shorten(+x: ~str) -> ~str {
|
||||
fn shorten(x: ~str) -> ~str {
|
||||
if x.len() > 60 { x.substr(0, 60).to_owned() } else { x }
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ use syntax::{ast, ast_util};
|
||||
use syntax::{attr, ast_map};
|
||||
use syntax::opt_vec;
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::abi::{Architecture, X86, X86_64, Arm, Mips};
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips};
|
||||
use syntax::abi::{RustIntrinsic, Rust, Stdcall, Fastcall,
|
||||
Cdecl, Aapcs, C};
|
||||
|
||||
@ -139,7 +139,7 @@ type shim_ret_builder<'self> =
|
||||
llretval: ValueRef);
|
||||
|
||||
fn build_shim_fn_(ccx: @CrateContext,
|
||||
+shim_name: ~str,
|
||||
shim_name: ~str,
|
||||
llbasefn: ValueRef,
|
||||
tys: &ShimTypes,
|
||||
cc: lib::llvm::CallConv,
|
||||
@ -544,7 +544,7 @@ pub fn trans_foreign_mod(ccx: @CrateContext,
|
||||
pub fn trans_intrinsic(ccx: @CrateContext,
|
||||
decl: ValueRef,
|
||||
item: @ast::foreign_item,
|
||||
+path: ast_map::path,
|
||||
path: ast_map::path,
|
||||
substs: @param_substs,
|
||||
ref_id: Option<ast::node_id>) {
|
||||
debug!("trans_intrinsic(item.ident=%s)", *ccx.sess.str_of(item.ident));
|
||||
@ -1089,7 +1089,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
|
||||
* }
|
||||
*/
|
||||
pub fn trans_foreign_fn(ccx: @CrateContext,
|
||||
+path: ast_map::path,
|
||||
path: ast_map::path,
|
||||
decl: &ast::fn_decl,
|
||||
body: &ast::blk,
|
||||
llwrapfn: ValueRef,
|
||||
@ -1097,7 +1097,7 @@ pub fn trans_foreign_fn(ccx: @CrateContext,
|
||||
let _icx = ccx.insn_ctxt("foreign::build_foreign_fn");
|
||||
|
||||
fn build_rust_fn(ccx: @CrateContext,
|
||||
+path: ast_map::path,
|
||||
path: ast_map::path,
|
||||
decl: &ast::fn_decl,
|
||||
body: &ast::blk,
|
||||
id: ast::node_id)
|
||||
@ -1125,7 +1125,7 @@ pub fn trans_foreign_fn(ccx: @CrateContext,
|
||||
}
|
||||
|
||||
fn build_shim_fn(ccx: @CrateContext,
|
||||
+path: ast_map::path,
|
||||
path: ast_map::path,
|
||||
llrustfn: ValueRef,
|
||||
tys: &ShimTypes)
|
||||
-> ValueRef {
|
||||
@ -1266,7 +1266,7 @@ pub fn trans_foreign_fn(ccx: @CrateContext,
|
||||
|
||||
pub fn register_foreign_fn(ccx: @CrateContext,
|
||||
sp: span,
|
||||
+path: ast_map::path,
|
||||
path: ast_map::path,
|
||||
node_id: ast::node_id,
|
||||
attrs: &[ast::attribute])
|
||||
-> ValueRef {
|
||||
|
@ -321,7 +321,7 @@ pub fn lazily_emit_tydesc_glue(ccx: @CrateContext,
|
||||
}
|
||||
|
||||
// See [Note-arg-mode]
|
||||
pub fn call_tydesc_glue_full(++bcx: block,
|
||||
pub fn call_tydesc_glue_full(bcx: block,
|
||||
v: ValueRef,
|
||||
tydesc: ValueRef,
|
||||
field: uint,
|
||||
@ -388,7 +388,7 @@ pub fn call_tydesc_glue_full(++bcx: block,
|
||||
}
|
||||
|
||||
// See [Note-arg-mode]
|
||||
pub fn call_tydesc_glue(++cx: block, v: ValueRef, t: ty::t, field: uint)
|
||||
pub fn call_tydesc_glue(cx: block, v: ValueRef, t: ty::t, field: uint)
|
||||
-> block {
|
||||
let _icx = cx.insn_ctxt("call_tydesc_glue");
|
||||
let ti = get_tydesc(cx.ccx(), t);
|
||||
@ -713,7 +713,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
|
||||
pub type glue_helper = @fn(block, ValueRef, ty::t);
|
||||
|
||||
pub fn declare_generic_glue(ccx: @CrateContext, t: ty::t, llfnty: TypeRef,
|
||||
+name: ~str) -> ValueRef {
|
||||
name: ~str) -> ValueRef {
|
||||
let _icx = ccx.insn_ctxt("declare_generic_glue");
|
||||
let name = name;
|
||||
//XXX this triggers duplicate LLVM symbols
|
||||
|
@ -54,7 +54,7 @@ pub fn maybe_instantiate_inline(ccx: @CrateContext, fn_id: ast::def_id,
|
||||
csearch::found(ast::ii_item(item)) => {
|
||||
ccx.external.insert(fn_id, Some(item.id));
|
||||
ccx.stats.n_inlines += 1;
|
||||
if translate { trans_item(ccx, *item); }
|
||||
if translate { trans_item(ccx, item); }
|
||||
local_def(item.id)
|
||||
}
|
||||
csearch::found(ast::ii_foreign(item)) => {
|
||||
@ -76,7 +76,7 @@ pub fn maybe_instantiate_inline(ccx: @CrateContext, fn_id: ast::def_id,
|
||||
_ => ccx.sess.bug(~"maybe_instantiate_inline: item has a \
|
||||
non-enum parent")
|
||||
}
|
||||
if translate { trans_item(ccx, *item); }
|
||||
if translate { trans_item(ccx, item); }
|
||||
local_def(my_id)
|
||||
}
|
||||
csearch::found_parent(_, _) => {
|
||||
|
@ -42,7 +42,7 @@ for non-monomorphized methods only. Other methods will
|
||||
be generated once they are invoked with specific type parameters,
|
||||
see `trans::base::lval_static_fn()` or `trans::base::monomorphic_fn()`.
|
||||
*/
|
||||
pub fn trans_impl(ccx: @CrateContext, +path: path, name: ast::ident,
|
||||
pub fn trans_impl(ccx: @CrateContext, path: path, name: ast::ident,
|
||||
methods: &[@ast::method], generics: &ast::Generics,
|
||||
self_ty: Option<ty::t>, id: ast::node_id) {
|
||||
let _icx = ccx.insn_ctxt("impl::trans_impl");
|
||||
@ -89,7 +89,7 @@ Translates a (possibly monomorphized) method body.
|
||||
- `impl_id`: the node ID of the impl this method is inside
|
||||
*/
|
||||
pub fn trans_method(ccx: @CrateContext,
|
||||
+path: path,
|
||||
path: path,
|
||||
method: &ast::method,
|
||||
param_substs: Option<@param_substs>,
|
||||
base_self_ty: Option<ty::t>,
|
||||
@ -443,7 +443,7 @@ pub fn trans_monomorphized_callee(bcx: block,
|
||||
mentry: typeck::method_map_entry,
|
||||
trait_id: ast::def_id,
|
||||
n_method: uint,
|
||||
+vtbl: typeck::vtable_origin)
|
||||
vtbl: typeck::vtable_origin)
|
||||
-> Callee {
|
||||
let _icx = bcx.insn_ctxt("impl::trans_monomorphized_callee");
|
||||
return match vtbl {
|
||||
@ -724,7 +724,7 @@ pub fn trans_trait_callee_from_llval(bcx: block,
|
||||
}
|
||||
|
||||
pub fn vtable_id(ccx: @CrateContext,
|
||||
+origin: typeck::vtable_origin)
|
||||
origin: typeck::vtable_origin)
|
||||
-> mono_id {
|
||||
match origin {
|
||||
typeck::vtable_static(impl_id, substs, sub_vtables) => {
|
||||
@ -747,7 +747,7 @@ pub fn vtable_id(ccx: @CrateContext,
|
||||
}
|
||||
|
||||
pub fn get_vtable(ccx: @CrateContext,
|
||||
+origin: typeck::vtable_origin)
|
||||
origin: typeck::vtable_origin)
|
||||
-> ValueRef {
|
||||
// XXX: Bad copy.
|
||||
let hash_id = vtable_id(ccx, copy origin);
|
||||
|
@ -221,9 +221,9 @@ pub fn monomorphic_fn(ccx: @CrateContext,
|
||||
let this_tv = vec::find(*tvs, |tv| { tv.id.node == fn_id.node}).get();
|
||||
let d = mk_lldecl();
|
||||
set_inline_hint(d);
|
||||
match (*v).node.kind {
|
||||
match v.node.kind {
|
||||
ast::tuple_variant_kind(ref args) => {
|
||||
trans_enum_variant(ccx, enum_item.id, *v, /*bad*/copy *args,
|
||||
trans_enum_variant(ccx, enum_item.id, v, /*bad*/copy *args,
|
||||
this_tv.disr_val, psubsts, d);
|
||||
}
|
||||
ast::struct_variant_kind(_) =>
|
||||
|
@ -49,13 +49,13 @@ pub fn find_reachable(crate_mod: &_mod, exp_map2: resolve::ExportMap2,
|
||||
method_map: method_map,
|
||||
rmap: &mut rmap
|
||||
};
|
||||
traverse_public_mod(cx, ast::crate_node_id, crate_mod);
|
||||
traverse_all_resources_and_impls(cx, crate_mod);
|
||||
traverse_public_mod(&cx, ast::crate_node_id, crate_mod);
|
||||
traverse_all_resources_and_impls(&cx, crate_mod);
|
||||
}
|
||||
return @rmap;
|
||||
}
|
||||
|
||||
fn traverse_exports(cx: ctx, mod_id: node_id) -> bool {
|
||||
fn traverse_exports(cx: &ctx, mod_id: node_id) -> bool {
|
||||
let mut found_export = false;
|
||||
match cx.exp_map2.find(&mod_id) {
|
||||
Some(ref exp2s) => {
|
||||
@ -69,7 +69,7 @@ fn traverse_exports(cx: ctx, mod_id: node_id) -> bool {
|
||||
return found_export;
|
||||
}
|
||||
|
||||
fn traverse_def_id(cx: ctx, did: def_id) {
|
||||
fn traverse_def_id(cx: &ctx, did: def_id) {
|
||||
if did.crate != local_crate { return; }
|
||||
match cx.tcx.items.find(&did.node) {
|
||||
None => (), // This can happen for self, for example
|
||||
@ -85,7 +85,7 @@ fn traverse_def_id(cx: ctx, did: def_id) {
|
||||
}
|
||||
}
|
||||
|
||||
fn traverse_public_mod(cx: ctx, mod_id: node_id, m: &_mod) {
|
||||
fn traverse_public_mod(cx: &ctx, mod_id: node_id, m: &_mod) {
|
||||
if !traverse_exports(cx, mod_id) {
|
||||
// No exports, so every local item is exported
|
||||
for m.items.each |item| {
|
||||
@ -94,7 +94,7 @@ fn traverse_public_mod(cx: ctx, mod_id: node_id, m: &_mod) {
|
||||
}
|
||||
}
|
||||
|
||||
fn traverse_public_item(cx: ctx, item: @item) {
|
||||
fn traverse_public_item(cx: &ctx, item: @item) {
|
||||
// XXX: it shouldn't be necessary to do this
|
||||
let rmap: &mut HashSet<node_id> = cx.rmap;
|
||||
if rmap.contains(&item.id) { return; }
|
||||
@ -139,7 +139,9 @@ fn traverse_public_item(cx: ctx, item: @item) {
|
||||
}
|
||||
}
|
||||
item_ty(t, _) => {
|
||||
traverse_ty(t, cx, mk_ty_visitor());
|
||||
traverse_ty(t, cx,
|
||||
visit::mk_vt(@visit::Visitor {visit_ty: traverse_ty,
|
||||
..*visit::default_visitor()}))
|
||||
}
|
||||
item_const(*) |
|
||||
item_enum(*) | item_trait(*) => (),
|
||||
@ -147,12 +149,7 @@ fn traverse_public_item(cx: ctx, item: @item) {
|
||||
}
|
||||
}
|
||||
|
||||
fn mk_ty_visitor() -> visit::vt<ctx> {
|
||||
visit::mk_vt(@visit::Visitor {visit_ty: traverse_ty,
|
||||
..*visit::default_visitor()})
|
||||
}
|
||||
|
||||
fn traverse_ty<'a>(ty: @Ty, cx: ctx<'a>, v: visit::vt<ctx<'a>>) {
|
||||
fn traverse_ty<'a, 'b>(ty: @Ty, cx: &'b ctx<'a>, v: visit::vt<&'b ctx<'a>>) {
|
||||
// XXX: it shouldn't be necessary to do this
|
||||
let rmap: &mut HashSet<node_id> = cx.rmap;
|
||||
if rmap.contains(&ty.id) { return; }
|
||||
@ -175,8 +172,9 @@ fn traverse_ty<'a>(ty: @Ty, cx: ctx<'a>, v: visit::vt<ctx<'a>>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn traverse_inline_body(cx: ctx, body: &blk) {
|
||||
fn traverse_expr<'a>(e: @expr, cx: ctx<'a>, v: visit::vt<ctx<'a>>) {
|
||||
fn traverse_inline_body(cx: &ctx, body: &blk) {
|
||||
fn traverse_expr<'a, 'b>(e: @expr, cx: &'b ctx<'a>,
|
||||
v: visit::vt<&'b ctx<'a>>) {
|
||||
match e.node {
|
||||
expr_path(_) => {
|
||||
match cx.tcx.def_map.find(&e.id) {
|
||||
@ -221,7 +219,7 @@ fn traverse_inline_body(cx: ctx, body: &blk) {
|
||||
// Don't ignore nested items: for example if a generic fn contains a
|
||||
// generic impl (as in deque::create), we need to monomorphize the
|
||||
// impl as well
|
||||
fn traverse_item(i: @item, cx: ctx, _v: visit::vt<ctx>) {
|
||||
fn traverse_item(i: @item, cx: &ctx, _v: visit::vt<&ctx>) {
|
||||
traverse_public_item(cx, i);
|
||||
}
|
||||
visit::visit_block(body, cx, visit::mk_vt(@visit::Visitor {
|
||||
@ -231,7 +229,7 @@ fn traverse_inline_body(cx: ctx, body: &blk) {
|
||||
}));
|
||||
}
|
||||
|
||||
fn traverse_all_resources_and_impls(cx: ctx, crate_mod: &_mod) {
|
||||
fn traverse_all_resources_and_impls(cx: &ctx, crate_mod: &_mod) {
|
||||
visit::visit_mod(
|
||||
crate_mod,
|
||||
codemap::dummy_sp(),
|
||||
|
@ -121,7 +121,7 @@ pub impl Reflector {
|
||||
|
||||
fn bracketed(&mut self,
|
||||
bracket_name: ~str,
|
||||
+extra: ~[ValueRef],
|
||||
extra: ~[ValueRef],
|
||||
inner: &fn(&mut Reflector)) {
|
||||
// XXX: Bad copy.
|
||||
self.visit(~"enter_" + bracket_name, copy extra);
|
||||
@ -145,7 +145,7 @@ pub impl Reflector {
|
||||
}
|
||||
}
|
||||
|
||||
fn leaf(&mut self, +name: ~str) {
|
||||
fn leaf(&mut self, name: ~str) {
|
||||
self.visit(name, ~[]);
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ pub struct creader_cache_key {
|
||||
type creader_cache = @mut HashMap<creader_cache_key, t>;
|
||||
|
||||
impl to_bytes::IterBytes for creader_cache_key {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_3(&self.cnum, &self.pos, &self.len, lsb0, f);
|
||||
}
|
||||
}
|
||||
@ -150,7 +150,7 @@ impl cmp::Eq for intern_key {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for intern_key {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
unsafe {
|
||||
(*self.sty).iter_bytes(lsb0, f);
|
||||
}
|
||||
@ -390,13 +390,13 @@ pub struct FnSig {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for BareFnTy {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_3(&self.purity, &self.abis, &self.sig, lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for ClosureTy {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_5(&self.purity, &self.sigil, &self.onceness,
|
||||
&self.region, &self.sig, lsb0, f)
|
||||
}
|
||||
@ -685,7 +685,7 @@ pub enum InferTy {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for InferTy {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
match *self {
|
||||
TyVar(ref tv) => to_bytes::iter_bytes_2(&0u8, tv, lsb0, f),
|
||||
IntVar(ref iv) => to_bytes::iter_bytes_2(&1u8, iv, lsb0, f),
|
||||
@ -702,7 +702,7 @@ pub enum InferRegion {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for InferRegion {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
match *self {
|
||||
ReVar(ref rv) => to_bytes::iter_bytes_2(&0u8, rv, lsb0, f),
|
||||
ReSkolemized(ref v, _) => to_bytes::iter_bytes_2(&1u8, v, lsb0, f)
|
||||
@ -790,25 +790,25 @@ impl ToStr for IntVarValue {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for TyVid {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
self.to_uint().iter_bytes(lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for IntVid {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
self.to_uint().iter_bytes(lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for FloatVid {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
self.to_uint().iter_bytes(lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for RegionVid {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
self.to_uint().iter_bytes(lsb0, f)
|
||||
}
|
||||
}
|
||||
@ -877,7 +877,7 @@ pub fn mk_ctxt(s: session::Session,
|
||||
freevars: freevars::freevar_map,
|
||||
region_maps: @mut middle::region::RegionMaps,
|
||||
region_paramd_items: middle::region::region_paramd_items,
|
||||
+lang_items: middle::lang_items::LanguageItems,
|
||||
lang_items: middle::lang_items::LanguageItems,
|
||||
crate: @ast::crate)
|
||||
-> ctxt {
|
||||
let mut legacy_modes = false;
|
||||
@ -942,7 +942,7 @@ pub fn mk_ctxt(s: session::Session,
|
||||
|
||||
// Interns a type/name combination, stores the resulting box in cx.interner,
|
||||
// and returns the box as cast to an unsafe ptr (see comments for t above).
|
||||
fn mk_t(cx: ctxt, +st: sty) -> t {
|
||||
fn mk_t(cx: ctxt, st: sty) -> t {
|
||||
// Check for primitive types.
|
||||
match st {
|
||||
ty_nil => return mk_nil(cx),
|
||||
@ -1141,7 +1141,7 @@ pub fn mk_estr(cx: ctxt, t: vstore) -> t {
|
||||
mk_t(cx, ty_estr(t))
|
||||
}
|
||||
|
||||
pub fn mk_enum(cx: ctxt, did: ast::def_id, +substs: substs) -> t {
|
||||
pub fn mk_enum(cx: ctxt, did: ast::def_id, substs: substs) -> t {
|
||||
// take a copy of substs so that we own the vectors inside
|
||||
mk_t(cx, ty_enum(did, substs))
|
||||
}
|
||||
@ -1192,13 +1192,13 @@ pub fn mk_mut_unboxed_vec(cx: ctxt, ty: t) -> t {
|
||||
mk_t(cx, ty_unboxed_vec(mt {ty: ty, mutbl: ast::m_imm}))
|
||||
}
|
||||
|
||||
pub fn mk_tup(cx: ctxt, +ts: ~[t]) -> t { mk_t(cx, ty_tup(ts)) }
|
||||
pub fn mk_tup(cx: ctxt, ts: ~[t]) -> t { mk_t(cx, ty_tup(ts)) }
|
||||
|
||||
pub fn mk_closure(cx: ctxt, +fty: ClosureTy) -> t {
|
||||
pub fn mk_closure(cx: ctxt, fty: ClosureTy) -> t {
|
||||
mk_t(cx, ty_closure(fty))
|
||||
}
|
||||
|
||||
pub fn mk_bare_fn(cx: ctxt, +fty: BareFnTy) -> t {
|
||||
pub fn mk_bare_fn(cx: ctxt, fty: BareFnTy) -> t {
|
||||
mk_t(cx, ty_bare_fn(fty))
|
||||
}
|
||||
|
||||
@ -1217,7 +1217,7 @@ pub fn mk_ctor_fn(cx: ctxt, input_tys: &[ty::t], output: ty::t) -> t {
|
||||
|
||||
pub fn mk_trait(cx: ctxt,
|
||||
did: ast::def_id,
|
||||
+substs: substs,
|
||||
substs: substs,
|
||||
store: TraitStore,
|
||||
mutability: ast::mutability)
|
||||
-> t {
|
||||
@ -1225,7 +1225,7 @@ pub fn mk_trait(cx: ctxt,
|
||||
mk_t(cx, ty_trait(did, substs, store, mutability))
|
||||
}
|
||||
|
||||
pub fn mk_struct(cx: ctxt, struct_id: ast::def_id, +substs: substs) -> t {
|
||||
pub fn mk_struct(cx: ctxt, struct_id: ast::def_id, substs: substs) -> t {
|
||||
// take a copy of substs so that we own the vectors inside
|
||||
mk_t(cx, ty_struct(struct_id, substs))
|
||||
}
|
||||
@ -1236,7 +1236,7 @@ pub fn mk_int_var(cx: ctxt, v: IntVid) -> t { mk_infer(cx, IntVar(v)) }
|
||||
|
||||
pub fn mk_float_var(cx: ctxt, v: FloatVid) -> t { mk_infer(cx, FloatVar(v)) }
|
||||
|
||||
pub fn mk_infer(cx: ctxt, +it: InferTy) -> t { mk_t(cx, ty_infer(it)) }
|
||||
pub fn mk_infer(cx: ctxt, it: InferTy) -> t { mk_t(cx, ty_infer(it)) }
|
||||
|
||||
pub fn mk_self(cx: ctxt, did: ast::def_id) -> t { mk_t(cx, ty_self(did)) }
|
||||
|
||||
@ -2672,7 +2672,7 @@ impl cmp::TotalEq for bound_region {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for vstore {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
match *self {
|
||||
vstore_fixed(ref u) =>
|
||||
to_bytes::iter_bytes_2(&0u8, u, lsb0, f),
|
||||
@ -2687,7 +2687,7 @@ impl to_bytes::IterBytes for vstore {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for substs {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_3(&self.self_r,
|
||||
&self.self_ty,
|
||||
&self.tps, lsb0, f)
|
||||
@ -2695,28 +2695,28 @@ impl to_bytes::IterBytes for substs {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for mt {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_2(&self.ty,
|
||||
&self.mutbl, lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for field {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_2(&self.ident,
|
||||
&self.mt, lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for arg {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_2(&self.mode,
|
||||
&self.ty, lsb0, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for FnSig {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_2(&self.inputs,
|
||||
&self.output,
|
||||
lsb0, f);
|
||||
@ -2724,7 +2724,7 @@ impl to_bytes::IterBytes for FnSig {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for sty {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
match *self {
|
||||
ty_nil => 0u8.iter_bytes(lsb0, f),
|
||||
ty_bool => 1u8.iter_bytes(lsb0, f),
|
||||
@ -3383,7 +3383,7 @@ pub fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) {
|
||||
// Maintains a little union-set tree for inferred modes. `canon()` returns
|
||||
// the current head value for `m0`.
|
||||
fn canon<T:Copy + cmp::Eq>(tbl: &mut HashMap<ast::node_id, ast::inferable<T>>,
|
||||
+m0: ast::inferable<T>) -> ast::inferable<T> {
|
||||
m0: ast::inferable<T>) -> ast::inferable<T> {
|
||||
match m0 {
|
||||
ast::infer(id) => {
|
||||
let m1 = match tbl.find(&id) {
|
||||
|
@ -248,7 +248,7 @@ pub static NO_TPS: uint = 2;
|
||||
// internal notion of a type. `getter` is a function that returns the type
|
||||
// corresponding to a definition ID:
|
||||
pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
|
||||
self: &AC, rscope: &RS, &&ast_ty: @ast::Ty) -> ty::t {
|
||||
self: &AC, rscope: &RS, ast_ty: @ast::Ty) -> ty::t {
|
||||
|
||||
fn ast_mt_to_mt<AC:AstConv, RS:region_scope + Copy + Durable>(
|
||||
self: &AC, rscope: &RS, mt: &ast::mt) -> ty::mt {
|
||||
|
@ -44,7 +44,7 @@ pub fn check_match(fcx: @mut FnCtxt,
|
||||
block_region: ty::re_scope(arm.body.node.id)
|
||||
};
|
||||
|
||||
for arm.pats.each |p| { check_pat(pcx, *p, pattern_ty);}
|
||||
for arm.pats.each |p| { check_pat(&pcx, *p, pattern_ty);}
|
||||
}
|
||||
|
||||
// Now typecheck the blocks.
|
||||
@ -99,7 +99,7 @@ pub struct pat_ctxt {
|
||||
block_region: ty::Region, // Region for the block of the arm
|
||||
}
|
||||
|
||||
pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::Path,
|
||||
pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: @ast::Path,
|
||||
subpats: &Option<~[@ast::pat]>, expected: ty::t) {
|
||||
|
||||
// Typecheck the path.
|
||||
@ -247,7 +247,7 @@ pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::Path,
|
||||
/// `substitutions` are the type substitutions applied to this struct type
|
||||
/// (e.g. K,V in HashMap<K,V>).
|
||||
/// `etc` is true if the pattern said '...' and false otherwise.
|
||||
pub fn check_struct_pat_fields(pcx: pat_ctxt,
|
||||
pub fn check_struct_pat_fields(pcx: &pat_ctxt,
|
||||
span: span,
|
||||
path: @ast::Path,
|
||||
fields: &[ast::field_pat],
|
||||
@ -299,7 +299,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_struct_pat(pcx: pat_ctxt, pat_id: ast::node_id, span: span,
|
||||
pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::node_id, span: span,
|
||||
expected: ty::t, path: @ast::Path,
|
||||
fields: &[ast::field_pat], etc: bool,
|
||||
class_id: ast::def_id, substitutions: &ty::substs) {
|
||||
@ -337,7 +337,7 @@ pub fn check_struct_pat(pcx: pat_ctxt, pat_id: ast::node_id, span: span,
|
||||
substitutions, etc);
|
||||
}
|
||||
|
||||
pub fn check_struct_like_enum_variant_pat(pcx: pat_ctxt,
|
||||
pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt,
|
||||
pat_id: ast::node_id,
|
||||
span: span,
|
||||
expected: ty::t,
|
||||
@ -375,7 +375,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: pat_ctxt,
|
||||
|
||||
// Pattern checking is top-down rather than bottom-up so that bindings get
|
||||
// their types immediately.
|
||||
pub fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
||||
pub fn check_pat(pcx: &pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
||||
let fcx = pcx.fcx;
|
||||
let tcx = pcx.fcx.ccx.tcx;
|
||||
|
||||
|
@ -1298,7 +1298,7 @@ pub impl<'self> LookupContext<'self> {
|
||||
ty::item_path_str(self.tcx(), did)
|
||||
}
|
||||
|
||||
fn bug(&self, +s: ~str) -> ! {
|
||||
fn bug(&self, s: ~str) -> ! {
|
||||
self.tcx().sess.bug(s)
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ pub fn check_item_types(ccx: @mut CrateCtxt, crate: @ast::crate) {
|
||||
visit_item: |a| check_item(ccx, a),
|
||||
.. *visit::default_simple_visitor()
|
||||
});
|
||||
visit::visit_crate(*crate, (), visit);
|
||||
visit::visit_crate(crate, (), visit);
|
||||
}
|
||||
|
||||
pub fn check_bare_fn(ccx: @mut CrateCtxt,
|
||||
@ -430,11 +430,11 @@ pub fn check_fn(ccx: @mut CrateCtxt,
|
||||
match_region: region,
|
||||
block_region: region,
|
||||
};
|
||||
_match::check_pat(pcx, input.pat, *arg_ty);
|
||||
_match::check_pat(&pcx, input.pat, *arg_ty);
|
||||
}
|
||||
|
||||
// Add explicitly-declared locals.
|
||||
let visit_local: @fn(@ast::local, &&e: (), visit::vt<()>) =
|
||||
let visit_local: @fn(@ast::local, e: (), visit::vt<()>) =
|
||||
|local, e, v| {
|
||||
let o_ty = match local.node.ty.node {
|
||||
ast::ty_infer => None,
|
||||
@ -449,7 +449,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
|
||||
};
|
||||
|
||||
// Add pattern bindings.
|
||||
let visit_pat: @fn(@ast::pat, &&e: (), visit::vt<()>) = |p, e, v| {
|
||||
let visit_pat: @fn(@ast::pat, e: (), visit::vt<()>) = |p, e, v| {
|
||||
match p.node {
|
||||
ast::pat_ident(_, path, _)
|
||||
if pat_util::pat_is_binding(fcx.ccx.tcx.def_map, p) => {
|
||||
@ -464,7 +464,7 @@ pub fn check_fn(ccx: @mut CrateCtxt,
|
||||
visit::visit_pat(p, e, v);
|
||||
};
|
||||
|
||||
let visit_block: @fn(&ast::blk, &&e: (), visit::vt<()>) = |b, e, v| {
|
||||
let visit_block: @fn(&ast::blk, e: (), visit::vt<()>) = |b, e, v| {
|
||||
// non-obvious: the `blk` variable maps to region lb, so
|
||||
// we have to keep this up-to-date. This
|
||||
// is... unfortunate. It'd be nice to not need this.
|
||||
@ -476,9 +476,9 @@ pub fn check_fn(ccx: @mut CrateCtxt,
|
||||
// Don't descend into fns and items
|
||||
fn visit_fn(_fk: &visit::fn_kind, _decl: &ast::fn_decl,
|
||||
_body: &ast::blk, _sp: span,
|
||||
_id: ast::node_id, &&_t: (), _v: visit::vt<()>) {
|
||||
_id: ast::node_id, _t: (), _v: visit::vt<()>) {
|
||||
}
|
||||
fn visit_item(_i: @ast::item, &&_e: (), _v: visit::vt<()>) { }
|
||||
fn visit_item(_i: @ast::item, _e: (), _v: visit::vt<()>) { }
|
||||
|
||||
let visit = visit::mk_vt(
|
||||
@visit::Visitor {visit_local: visit_local,
|
||||
@ -714,7 +714,7 @@ pub impl FnCtxt {
|
||||
self.inh.node_types.insert(node_id, ty);
|
||||
}
|
||||
|
||||
fn write_substs(&self, node_id: ast::node_id, +substs: ty::substs) {
|
||||
fn write_substs(&self, node_id: ast::node_id, substs: ty::substs) {
|
||||
if !ty::substs_is_noop(&substs) {
|
||||
debug!("write_substs(%d, %s) in fcx %s",
|
||||
node_id,
|
||||
@ -727,7 +727,7 @@ pub impl FnCtxt {
|
||||
fn write_ty_substs(&self,
|
||||
node_id: ast::node_id,
|
||||
ty: ty::t,
|
||||
+substs: ty::substs) {
|
||||
substs: ty::substs) {
|
||||
let ty = ty::subst(self.tcx(), &substs, ty);
|
||||
self.write_ty(node_id, ty);
|
||||
self.write_substs(node_id, substs);
|
||||
@ -1429,9 +1429,9 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||
self_ex: @ast::expr,
|
||||
self_t: ty::t,
|
||||
opname: ast::ident,
|
||||
+args: ~[@ast::expr],
|
||||
+deref_args: DerefArgs,
|
||||
+autoderef_receiver: AutoderefReceiverFlag,
|
||||
args: ~[@ast::expr],
|
||||
deref_args: DerefArgs,
|
||||
autoderef_receiver: AutoderefReceiverFlag,
|
||||
unbound_method: &fn(),
|
||||
_expected_result: Option<ty::t>
|
||||
)
|
||||
@ -1570,7 +1570,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||
|
||||
fn check_user_unop(fcx: @mut FnCtxt,
|
||||
op_str: ~str,
|
||||
+mname: ~str,
|
||||
mname: ~str,
|
||||
ex: @ast::expr,
|
||||
rhs_expr: @ast::expr,
|
||||
rhs_t: ty::t,
|
||||
@ -1775,7 +1775,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
|
||||
span: span,
|
||||
class_id: ast::def_id,
|
||||
node_id: ast::node_id,
|
||||
+substitutions: ty::substs,
|
||||
substitutions: ty::substs,
|
||||
field_types: &[ty::field_ty],
|
||||
ast_fields: &[ast::field],
|
||||
check_completeness: bool) {
|
||||
@ -2859,7 +2859,7 @@ pub fn check_decl_local(fcx: @mut FnCtxt, local: @ast::local) {
|
||||
match_region: region,
|
||||
block_region: region,
|
||||
};
|
||||
_match::check_pat(pcx, local.node.pat, t);
|
||||
_match::check_pat(&pcx, local.node.pat, t);
|
||||
let pat_ty = fcx.node_ty(local.node.pat.id);
|
||||
if ty::type_is_error(pat_ty) || ty::type_is_bot(pat_ty) {
|
||||
fcx.write_ty(local.node.id, pat_ty);
|
||||
@ -2947,7 +2947,7 @@ pub fn check_block_with_expected(fcx0: @mut FnCtxt,
|
||||
let mut any_err = false;
|
||||
for blk.node.stmts.each |s| {
|
||||
check_stmt(fcx, *s);
|
||||
let s_ty = fcx.node_ty(ast_util::stmt_id(**s));
|
||||
let s_ty = fcx.node_ty(ast_util::stmt_id(*s));
|
||||
if last_was_bot && !warned && match s.node {
|
||||
ast::stmt_decl(@codemap::spanned { node: ast::decl_local(_),
|
||||
_}, _) |
|
||||
@ -3350,7 +3350,7 @@ pub fn may_break(cx: ty::ctxt, id: ast::node_id, b: &ast::blk) -> bool {
|
||||
// First: is there an unlabeled break immediately
|
||||
// inside the loop?
|
||||
(loop_query(b, |e| {
|
||||
match e {
|
||||
match *e {
|
||||
ast::expr_break(_) => true,
|
||||
_ => false
|
||||
}
|
||||
|
@ -159,11 +159,11 @@ fn regionck_visitor() -> rvt {
|
||||
.. *visit::default_visitor()})
|
||||
}
|
||||
|
||||
fn visit_item(_item: @ast::item, &&_rcx: @mut Rcx, _v: rvt) {
|
||||
fn visit_item(_item: @ast::item, _rcx: @mut Rcx, _v: rvt) {
|
||||
// Ignore items
|
||||
}
|
||||
|
||||
fn visit_local(l: @ast::local, &&rcx: @mut Rcx, v: rvt) {
|
||||
fn visit_local(l: @ast::local, rcx: @mut Rcx, v: rvt) {
|
||||
// Check to make sure that the regions in all local variables are
|
||||
// within scope.
|
||||
//
|
||||
@ -194,11 +194,11 @@ fn visit_local(l: @ast::local, &&rcx: @mut Rcx, v: rvt) {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_block(b: &ast::blk, &&rcx: @mut Rcx, v: rvt) {
|
||||
fn visit_block(b: &ast::blk, rcx: @mut Rcx, v: rvt) {
|
||||
visit::visit_block(b, rcx, v);
|
||||
}
|
||||
|
||||
fn visit_expr(expr: @ast::expr, &&rcx: @mut Rcx, v: rvt) {
|
||||
fn visit_expr(expr: @ast::expr, rcx: @mut Rcx, v: rvt) {
|
||||
debug!("regionck::visit_expr(e=%s)", rcx.fcx.expr_to_str(expr));
|
||||
|
||||
for rcx.fcx.inh.adjustments.find(&expr.id).each |&adjustment| {
|
||||
@ -333,7 +333,7 @@ fn visit_expr(expr: @ast::expr, &&rcx: @mut Rcx, v: rvt) {
|
||||
visit::visit_expr(expr, rcx, v);
|
||||
}
|
||||
|
||||
fn visit_stmt(s: @ast::stmt, &&rcx: @mut Rcx, v: rvt) {
|
||||
fn visit_stmt(s: @ast::stmt, rcx: @mut Rcx, v: rvt) {
|
||||
visit::visit_stmt(s, rcx, v);
|
||||
}
|
||||
|
||||
@ -973,10 +973,10 @@ pub mod guarantor {
|
||||
}
|
||||
|
||||
fn apply_autoderefs(
|
||||
+rcx: @mut Rcx,
|
||||
+expr: @ast::expr,
|
||||
+autoderefs: uint,
|
||||
+ct: ExprCategorizationType)
|
||||
rcx: @mut Rcx,
|
||||
expr: @ast::expr,
|
||||
autoderefs: uint,
|
||||
ct: ExprCategorizationType)
|
||||
-> ExprCategorizationType {
|
||||
let mut ct = ct;
|
||||
let tcx = rcx.fcx.ccx.tcx;
|
||||
|
@ -135,7 +135,7 @@ fn lookup_vtables(vcx: &VtableContext,
|
||||
}
|
||||
|
||||
fn fixup_substs(vcx: &VtableContext, location_info: &LocationInfo,
|
||||
id: ast::def_id, +substs: ty::substs,
|
||||
id: ast::def_id, substs: ty::substs,
|
||||
is_early: bool) -> Option<ty::substs> {
|
||||
let tcx = vcx.tcx();
|
||||
// use a dummy type just to package up the substs that need fixing up
|
||||
@ -480,7 +480,7 @@ pub fn location_info_for_expr(expr: @ast::expr) -> LocationInfo {
|
||||
}
|
||||
|
||||
pub fn early_resolve_expr(ex: @ast::expr,
|
||||
&&fcx: @mut FnCtxt,
|
||||
fcx: @mut FnCtxt,
|
||||
is_early: bool) {
|
||||
debug!("vtable: early_resolve_expr() ex with id %? (early: %b): %s",
|
||||
ex.id, is_early, expr_to_str(ex, fcx.tcx().sess.intr()));
|
||||
@ -656,7 +656,7 @@ pub fn early_resolve_expr(ex: @ast::expr,
|
||||
}
|
||||
|
||||
fn resolve_expr(ex: @ast::expr,
|
||||
&&fcx: @mut FnCtxt,
|
||||
fcx: @mut FnCtxt,
|
||||
v: visit::vt<@mut FnCtxt>) {
|
||||
early_resolve_expr(ex, fcx, false);
|
||||
visit::visit_expr(ex, fcx, v);
|
||||
|
@ -212,12 +212,12 @@ struct WbCtxt {
|
||||
|
||||
type wb_vt = visit::vt<@mut WbCtxt>;
|
||||
|
||||
fn visit_stmt(s: @ast::stmt, &&wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
fn visit_stmt(s: @ast::stmt, wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
if !wbcx.success { return; }
|
||||
resolve_type_vars_for_node(wbcx, s.span, ty::stmt_node_id(s));
|
||||
visit::visit_stmt(s, wbcx, v);
|
||||
}
|
||||
fn visit_expr(e: @ast::expr, &&wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
fn visit_expr(e: @ast::expr, wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
if !wbcx.success { return; }
|
||||
resolve_type_vars_for_node(wbcx, e.span, e.id);
|
||||
resolve_method_map_entry(wbcx.fcx, e.span, e.id);
|
||||
@ -256,12 +256,12 @@ fn visit_expr(e: @ast::expr, &&wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
}
|
||||
visit::visit_expr(e, wbcx, v);
|
||||
}
|
||||
fn visit_block(b: &ast::blk, &&wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
fn visit_block(b: &ast::blk, wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
if !wbcx.success { return; }
|
||||
resolve_type_vars_for_node(wbcx, b.span, b.node.id);
|
||||
visit::visit_block(b, wbcx, v);
|
||||
}
|
||||
fn visit_pat(p: @ast::pat, &&wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
fn visit_pat(p: @ast::pat, wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
if !wbcx.success { return; }
|
||||
resolve_type_vars_for_node(wbcx, p.span, p.id);
|
||||
debug!("Type for pattern binding %s (id %d) resolved to %s",
|
||||
@ -271,7 +271,7 @@ fn visit_pat(p: @ast::pat, &&wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
p.id)));
|
||||
visit::visit_pat(p, wbcx, v);
|
||||
}
|
||||
fn visit_local(l: @ast::local, &&wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
fn visit_local(l: @ast::local, wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
if !wbcx.success { return; }
|
||||
let var_ty = wbcx.fcx.local_ty(l.span, l.node.id);
|
||||
match resolve_type(wbcx.fcx.infcx(), var_ty, resolve_all | force_all) {
|
||||
@ -293,7 +293,7 @@ fn visit_local(l: @ast::local, &&wbcx: @mut WbCtxt, v: wb_vt) {
|
||||
}
|
||||
visit::visit_local(l, wbcx, v);
|
||||
}
|
||||
fn visit_item(_item: @ast::item, &&_wbcx: @mut WbCtxt, _v: wb_vt) {
|
||||
fn visit_item(_item: @ast::item, _wbcx: @mut WbCtxt, _v: wb_vt) {
|
||||
// Ignore items
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ pub impl CoherenceChecker {
|
||||
// Check implementations and traits. This populates the tables
|
||||
// containing the inherent methods and extension methods. It also
|
||||
// builds up the trait inheritance table.
|
||||
visit_crate(*crate, (), mk_simple_visitor(@SimpleVisitor {
|
||||
visit_crate(crate, (), mk_simple_visitor(@SimpleVisitor {
|
||||
visit_item: |item| {
|
||||
// debug!("(checking coherence) item '%s'",
|
||||
// self.crate_context.tcx.sess.str_of(item.ident));
|
||||
@ -655,7 +655,7 @@ pub impl CoherenceChecker {
|
||||
|
||||
// Privileged scope checking
|
||||
fn check_privileged_scopes(self, crate: @crate) {
|
||||
visit_crate(*crate, (), mk_vt(@Visitor {
|
||||
visit_crate(crate, (), mk_vt(@Visitor {
|
||||
visit_item: |item, _context, visitor| {
|
||||
match item.node {
|
||||
item_mod(ref module_) => {
|
||||
|
@ -111,7 +111,7 @@ pub fn collect_item_types(ccx: @mut CrateCtxt, crate: @ast::crate) {
|
||||
}
|
||||
|
||||
visit::visit_crate(
|
||||
*crate, (),
|
||||
crate, (),
|
||||
visit::mk_simple_visitor(@visit::SimpleVisitor {
|
||||
visit_item: |a| convert(ccx, a),
|
||||
visit_foreign_item: |a|convert_foreign(ccx, a),
|
||||
|
@ -124,7 +124,7 @@ pub struct CombineFields {
|
||||
}
|
||||
|
||||
pub fn expected_found<C:Combine,T>(
|
||||
self: &C, +a: T, +b: T) -> ty::expected_found<T> {
|
||||
self: &C, a: T, b: T) -> ty::expected_found<T> {
|
||||
if self.a_is_expected() {
|
||||
ty::expected_found {expected: a, found: b}
|
||||
} else {
|
||||
|
@ -77,8 +77,8 @@ pub impl CombineFields {
|
||||
fn var_sub_var<T:Copy + InferStr + LatticeValue,
|
||||
V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
|
||||
&self,
|
||||
+a_id: V,
|
||||
+b_id: V) -> ures
|
||||
a_id: V,
|
||||
b_id: V) -> ures
|
||||
{
|
||||
/*!
|
||||
*
|
||||
@ -130,8 +130,8 @@ pub impl CombineFields {
|
||||
fn var_sub_t<T:Copy + InferStr + LatticeValue,
|
||||
V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
|
||||
&self,
|
||||
+a_id: V,
|
||||
+b: T) -> ures
|
||||
a_id: V,
|
||||
b: T) -> ures
|
||||
{
|
||||
/*!
|
||||
*
|
||||
@ -154,8 +154,8 @@ pub impl CombineFields {
|
||||
fn t_sub_var<T:Copy + InferStr + LatticeValue,
|
||||
V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
|
||||
&self,
|
||||
+a: T,
|
||||
+b_id: V) -> ures
|
||||
a: T,
|
||||
b_id: V) -> ures
|
||||
{
|
||||
/*!
|
||||
*
|
||||
@ -206,7 +206,7 @@ pub impl CombineFields {
|
||||
fn set_var_to_merged_bounds<T:Copy + InferStr + LatticeValue,
|
||||
V:Copy+Eq+ToStr+Vid+UnifyVid<Bounds<T>>>(
|
||||
&self,
|
||||
+v_id: V,
|
||||
v_id: V,
|
||||
a: &Bounds<T>,
|
||||
b: &Bounds<T>,
|
||||
rank: uint) -> ures
|
||||
@ -296,7 +296,7 @@ pub impl CombineFields {
|
||||
pub trait LatticeDir {
|
||||
fn combine_fields(&self) -> CombineFields;
|
||||
fn bnd<T:Copy>(&self, b: &Bounds<T>) -> Option<T>;
|
||||
fn with_bnd<T:Copy>(&self, b: &Bounds<T>, +t: T) -> Bounds<T>;
|
||||
fn with_bnd<T:Copy>(&self, b: &Bounds<T>, t: T) -> Bounds<T>;
|
||||
}
|
||||
|
||||
pub trait TyLatticeDir {
|
||||
@ -306,7 +306,7 @@ pub trait TyLatticeDir {
|
||||
impl LatticeDir for Lub {
|
||||
fn combine_fields(&self) -> CombineFields { **self }
|
||||
fn bnd<T:Copy>(&self, b: &Bounds<T>) -> Option<T> { b.ub }
|
||||
fn with_bnd<T:Copy>(&self, b: &Bounds<T>, +t: T) -> Bounds<T> {
|
||||
fn with_bnd<T:Copy>(&self, b: &Bounds<T>, t: T) -> Bounds<T> {
|
||||
Bounds { ub: Some(t), ..*b }
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ impl TyLatticeDir for Lub {
|
||||
impl LatticeDir for Glb {
|
||||
fn combine_fields(&self) -> CombineFields { **self }
|
||||
fn bnd<T:Copy>(&self, b: &Bounds<T>) -> Option<T> { b.lb }
|
||||
fn with_bnd<T:Copy>(&self, b: &Bounds<T>, +t: T) -> Bounds<T> {
|
||||
fn with_bnd<T:Copy>(&self, b: &Bounds<T>, t: T) -> Bounds<T> {
|
||||
Bounds { lb: Some(t), ..*b }
|
||||
}
|
||||
}
|
||||
@ -401,8 +401,8 @@ pub fn lattice_vars<L:LatticeDir + Combine,
|
||||
T:Copy + InferStr + LatticeValue,
|
||||
V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
|
||||
self: &L, // defines whether we want LUB or GLB
|
||||
+a_vid: V, // first variable
|
||||
+b_vid: V, // second variable
|
||||
a_vid: V, // first variable
|
||||
b_vid: V, // second variable
|
||||
lattice_dir_op: LatticeDirOp<T>) // LUB or GLB operation on types
|
||||
-> cres<LatticeVarResult<V,T>> {
|
||||
let nde_a = self.infcx().get(a_vid);
|
||||
@ -447,7 +447,7 @@ pub fn lattice_var_and_t<L:LatticeDir + Combine,
|
||||
T:Copy + InferStr + LatticeValue,
|
||||
V:Copy + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
|
||||
self: &L,
|
||||
+a_id: V,
|
||||
a_id: V,
|
||||
b: &T,
|
||||
lattice_dir_op: LatticeDirOp<T>)
|
||||
-> cres<T> {
|
||||
|
@ -643,8 +643,8 @@ pub impl InferCtxt {
|
||||
}
|
||||
|
||||
fn next_simple_var<V:Copy,T:Copy>(
|
||||
+counter: &mut uint,
|
||||
+bindings: &mut ValsAndBindings<V,Option<T>>)
|
||||
counter: &mut uint,
|
||||
bindings: &mut ValsAndBindings<V,Option<T>>)
|
||||
-> uint {
|
||||
let id = *counter;
|
||||
*counter += 1;
|
||||
|
@ -563,7 +563,7 @@ enum Constraint {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for Constraint {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
match *self {
|
||||
ConstrainVarSubVar(ref v0, ref v1) =>
|
||||
to_bytes::iter_bytes_3(&0u8, v0, v1, lsb0, f),
|
||||
@ -584,7 +584,7 @@ struct TwoRegions {
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for TwoRegions {
|
||||
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
|
||||
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
|
||||
to_bytes::iter_bytes_2(&self.a, &self.b, lsb0, f)
|
||||
}
|
||||
}
|
||||
@ -729,7 +729,7 @@ pub impl RegionVarBindings {
|
||||
re_bound(br_fresh(sc))
|
||||
}
|
||||
|
||||
fn add_constraint(&mut self, +constraint: Constraint, span: span) {
|
||||
fn add_constraint(&mut self, constraint: Constraint, span: span) {
|
||||
// cannot add constraints once regions are resolved
|
||||
assert!(self.values.is_empty());
|
||||
|
||||
@ -995,7 +995,7 @@ pub impl RegionVarBindings {
|
||||
|
||||
return result_set;
|
||||
|
||||
fn consider_adding_edge(+result_set: ~[Region],
|
||||
fn consider_adding_edge(result_set: ~[Region],
|
||||
r: &Region,
|
||||
r1: &Region,
|
||||
r2: &Region) -> ~[Region]
|
||||
@ -1030,7 +1030,7 @@ priv impl RegionVarBindings {
|
||||
rm.is_subregion_of(sub, sup)
|
||||
}
|
||||
|
||||
fn lub_concrete_regions(&self, +a: Region, +b: Region) -> Region {
|
||||
fn lub_concrete_regions(&self, a: Region, b: Region) -> Region {
|
||||
match (a, b) {
|
||||
(re_static, _) | (_, re_static) => {
|
||||
re_static // nothing lives longer than static
|
||||
@ -1122,8 +1122,8 @@ priv impl RegionVarBindings {
|
||||
}
|
||||
|
||||
fn glb_concrete_regions(&self,
|
||||
+a: Region,
|
||||
+b: Region)
|
||||
a: Region,
|
||||
b: Region)
|
||||
-> cres<Region> {
|
||||
debug!("glb_concrete_regions(%?, %?)", a, b);
|
||||
match (a, b) {
|
||||
@ -1330,7 +1330,7 @@ pub impl RegionVarBindings {
|
||||
|
||||
return (graph);
|
||||
|
||||
fn insert_edge(+graph: &mut Graph,
|
||||
fn insert_edge(graph: &mut Graph,
|
||||
node_id: RegionVid,
|
||||
edge_dir: Direction,
|
||||
edge_idx: uint) {
|
||||
@ -1457,9 +1457,9 @@ pub impl RegionVarBindings {
|
||||
}
|
||||
};
|
||||
|
||||
fn check_node(+self: &mut RegionVarBindings,
|
||||
fn check_node(self: &mut RegionVarBindings,
|
||||
a_vid: RegionVid,
|
||||
+a_node: &mut GraphNode,
|
||||
a_node: &mut GraphNode,
|
||||
a_region: Region,
|
||||
b_region: Region)
|
||||
-> bool {
|
||||
@ -1471,9 +1471,9 @@ pub impl RegionVarBindings {
|
||||
false
|
||||
}
|
||||
|
||||
fn adjust_node(+self: &mut RegionVarBindings,
|
||||
fn adjust_node(self: &mut RegionVarBindings,
|
||||
a_vid: RegionVid,
|
||||
+a_node: &mut GraphNode,
|
||||
a_node: &mut GraphNode,
|
||||
a_region: Region,
|
||||
b_region: Region)
|
||||
-> bool {
|
||||
|
@ -42,7 +42,7 @@ pub trait UnifyVid<T> {
|
||||
pub impl InferCtxt {
|
||||
fn get<T:Copy, V:Copy+Eq+Vid+UnifyVid<T>>(
|
||||
&mut self,
|
||||
+vid: V) -> Node<V, T>
|
||||
vid: V) -> Node<V, T>
|
||||
{
|
||||
/*!
|
||||
*
|
||||
@ -88,8 +88,8 @@ pub impl InferCtxt {
|
||||
|
||||
fn set<T:Copy + InferStr,V:Copy + Vid + ToStr + UnifyVid<T>>(
|
||||
&mut self,
|
||||
+vid: V,
|
||||
+new_v: VarValue<V, T>) {
|
||||
vid: V,
|
||||
new_v: VarValue<V, T>) {
|
||||
/*!
|
||||
*
|
||||
* Sets the value for `vid` to `new_v`. `vid` MUST be a root node!
|
||||
@ -147,9 +147,9 @@ pub trait SimplyUnifiable {
|
||||
fn to_type_err(expected_found<Self>) -> ty::type_err;
|
||||
}
|
||||
|
||||
pub fn mk_err<T:SimplyUnifiable>(+a_is_expected: bool,
|
||||
+a_t: T,
|
||||
+b_t: T) -> ures {
|
||||
pub fn mk_err<T:SimplyUnifiable>(a_is_expected: bool,
|
||||
a_t: T,
|
||||
b_t: T) -> ures {
|
||||
if a_is_expected {
|
||||
Err(SimplyUnifiable::to_type_err(
|
||||
ty::expected_found {expected: a_t, found: b_t}))
|
||||
@ -163,9 +163,9 @@ pub impl InferCtxt {
|
||||
fn simple_vars<T:Copy + Eq + InferStr + SimplyUnifiable,
|
||||
V:Copy + Eq + Vid + ToStr + UnifyVid<Option<T>>>(
|
||||
&mut self,
|
||||
+a_is_expected: bool,
|
||||
+a_id: V,
|
||||
+b_id: V)
|
||||
a_is_expected: bool,
|
||||
a_id: V,
|
||||
b_id: V)
|
||||
-> ures {
|
||||
/*!
|
||||
*
|
||||
@ -201,9 +201,9 @@ pub impl InferCtxt {
|
||||
fn simple_var_t<T:Copy + Eq + InferStr + SimplyUnifiable,
|
||||
V:Copy + Eq + Vid + ToStr + UnifyVid<Option<T>>>(
|
||||
&mut self,
|
||||
+a_is_expected: bool,
|
||||
+a_id: V,
|
||||
+b: T)
|
||||
a_is_expected: bool,
|
||||
a_id: V,
|
||||
b: T)
|
||||
-> ures {
|
||||
/*!
|
||||
*
|
||||
|
@ -194,7 +194,7 @@ pub fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::node_id, ty: ty::t) {
|
||||
}
|
||||
pub fn write_substs_to_tcx(tcx: ty::ctxt,
|
||||
node_id: ast::node_id,
|
||||
+substs: ~[ty::t]) {
|
||||
substs: ~[ty::t]) {
|
||||
if substs.len() > 0u {
|
||||
debug!("write_substs_to_tcx(%d, %?)", node_id,
|
||||
substs.map(|t| ppaux::ty_to_str(tcx, *t)));
|
||||
@ -397,7 +397,7 @@ fn check_for_entry_fn(ccx: @mut CrateCtxt) {
|
||||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
+trait_map: resolve::TraitMap,
|
||||
trait_map: resolve::TraitMap,
|
||||
crate: @ast::crate)
|
||||
-> (method_map, vtable_map) {
|
||||
let time_passes = tcx.sess.time_passes();
|
||||
|
@ -272,7 +272,7 @@ pub struct binding_rscope {
|
||||
|
||||
pub fn in_binding_rscope<RS:region_scope + Copy + Durable>(
|
||||
self: &RS,
|
||||
+region_param_names: RegionParamNames)
|
||||
region_param_names: RegionParamNames)
|
||||
-> binding_rscope {
|
||||
let base = @copy *self;
|
||||
let base = base as @region_scope;
|
||||
|
@ -18,12 +18,10 @@
|
||||
#[license = "MIT/ASL2"];
|
||||
#[crate_type = "lib"];
|
||||
|
||||
#[legacy_modes];
|
||||
|
||||
#[allow(non_implicitly_copyable_typarams)];
|
||||
#[allow(non_camel_case_types)];
|
||||
#[allow(deprecated_mode)];
|
||||
#[warn(deprecated_pattern)];
|
||||
#[deny(deprecated_pattern)];
|
||||
#[deny(deprecated_mode)];
|
||||
|
||||
#[no_core];
|
||||
|
||||
@ -259,12 +257,12 @@ pub fn run_compiler(args: &~[~str], demitter: diagnostic::Emitter) {
|
||||
let odir = odir.map(|o| Path(*o));
|
||||
let ofile = getopts::opt_maybe_str(matches, ~"o");
|
||||
let ofile = ofile.map(|o| Path(*o));
|
||||
let cfg = build_configuration(sess, binary, input);
|
||||
let cfg = build_configuration(sess, binary, &input);
|
||||
let pretty = getopts::opt_default(matches, ~"pretty", "normal").map(
|
||||
|a| parse_pretty(sess, *a));
|
||||
match pretty {
|
||||
Some::<pp_mode>(ppm) => {
|
||||
pretty_print_input(sess, cfg, input, ppm);
|
||||
pretty_print_input(sess, cfg, &input, ppm);
|
||||
return;
|
||||
}
|
||||
None::<pp_mode> => {/* continue */ }
|
||||
@ -282,7 +280,7 @@ pub fn run_compiler(args: &~[~str], demitter: diagnostic::Emitter) {
|
||||
return;
|
||||
}
|
||||
|
||||
compile_input(sess, cfg, input, &odir, &ofile);
|
||||
compile_input(sess, cfg, &input, &odir, &ofile);
|
||||
}
|
||||
|
||||
#[deriving(Eq)]
|
||||
@ -303,7 +301,7 @@ diagnostic emitter which records when we hit a fatal error. If the task
|
||||
fails without recording a fatal error then we've encountered a compiler
|
||||
bug and need to present an error.
|
||||
*/
|
||||
pub fn monitor(+f: ~fn(diagnostic::Emitter)) {
|
||||
pub fn monitor(f: ~fn(diagnostic::Emitter)) {
|
||||
use core::comm::*;
|
||||
let (p, ch) = stream();
|
||||
let ch = SharedChan::new(ch);
|
||||
|
@ -63,12 +63,12 @@ pub fn field_exprs(fields: ~[ast::field]) -> ~[@ast::expr] {
|
||||
|
||||
// Takes a predicate p, returns true iff p is true for any subexpressions
|
||||
// of b -- skipping any inner loops (loop, while, loop_body)
|
||||
pub fn loop_query(b: &ast::blk, p: @fn(ast::expr_) -> bool) -> bool {
|
||||
pub fn loop_query(b: &ast::blk, p: @fn(&ast::expr_) -> bool) -> bool {
|
||||
let rs = @mut false;
|
||||
let visit_expr: @fn(@ast::expr,
|
||||
&&flag: @mut bool,
|
||||
v: visit::vt<@mut bool>) = |e, &&flag, v| {
|
||||
*flag |= p(e.node);
|
||||
flag: @mut bool,
|
||||
v: visit::vt<@mut bool>) = |e, flag, v| {
|
||||
*flag |= p(&e.node);
|
||||
match e.node {
|
||||
// Skip inner loops, since a break in the inner loop isn't a
|
||||
// break inside the outer loop
|
||||
@ -89,8 +89,8 @@ pub fn loop_query(b: &ast::blk, p: @fn(ast::expr_) -> bool) -> bool {
|
||||
pub fn block_query(b: &ast::blk, p: @fn(@ast::expr) -> bool) -> bool {
|
||||
let rs = @mut false;
|
||||
let visit_expr: @fn(@ast::expr,
|
||||
&&flag: @mut bool,
|
||||
v: visit::vt<@mut bool>) = |e, &&flag, v| {
|
||||
flag: @mut bool,
|
||||
v: visit::vt<@mut bool>) = |e, flag, v| {
|
||||
*flag |= p(e);
|
||||
visit::visit_expr(e, flag, v)
|
||||
};
|
||||
@ -108,7 +108,7 @@ pub fn local_rhs_span(l: @ast::local, def: span) -> span {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pluralize(n: uint, +s: ~str) -> ~str {
|
||||
pub fn pluralize(n: uint, s: ~str) -> ~str {
|
||||
if n == 1 { s }
|
||||
else { str::concat([s, ~"s"]) }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user