auto merge of #5965 : alexcrichton/rust/issue-4364, r=pcwalton

This closes #4364. I came into rust after modes had begun to be phased out, so I'm not exactly sure what they all did. My strategy was basically to turn on the compilation warnings and then when everything compiles and passes all the tests it's all good.

In most cases, I just dropped the mode, but in others I converted things to use `&` pointers when otherwise a move would happen.

This depends on #5963. When running the tests, everything passed except for a few compile-fail tests. These tests leaked memory, causing the task to abort differently. By suppressing the ICE from #5963, no leaks happen and the tests all pass. I would have looked into where the leaks were coming from, but I wasn't sure where or how to debug them (I found `RUSTRT_TRACK_ALLOCATIONS`, but it wasn't all that useful).
This commit is contained in:
bors 2013-04-20 01:00:49 -07:00
commit 4ff701b7db
110 changed files with 1081 additions and 1116 deletions

View file

@ -112,8 +112,6 @@ pub mod streamp {
#[allow(non_camel_case_types)]
pub mod server {
priv use core::kinds::Owned;
#[allow(non_camel_case_types)]
pub type Open<T> = ::core::pipes::RecvPacket<super::Open<T>>;
}
@ -388,8 +386,6 @@ pub mod oneshot {
#[allow(non_camel_case_types)]
pub mod server {
priv use core::kinds::Owned;
#[allow(non_camel_case_types)]
pub type Oneshot<T> =
::core::pipes::RecvPacketBuffered<super::Oneshot<T>,

View file

@ -66,18 +66,16 @@ pub fn borrow(f: &fn(&mut Scheduler)) {
/// Because this leaves the Scheduler in thread-local storage it is possible
/// For the Scheduler pointer to be aliased
pub unsafe fn unsafe_borrow() -> &mut Scheduler {
unsafe {
let key = tls_key();
let mut void_sched: *mut c_void = tls::get(key);
assert!(void_sched.is_not_null());
{
let void_sched_ptr = &mut void_sched;
let sched: &mut ~Scheduler = {
transmute::<&mut *mut c_void, &mut ~Scheduler>(void_sched_ptr)
};
let sched: &mut Scheduler = &mut **sched;
return sched;
}
let key = tls_key();
let mut void_sched: *mut c_void = tls::get(key);
assert!(void_sched.is_not_null());
{
let void_sched_ptr = &mut void_sched;
let sched: &mut ~Scheduler = {
transmute::<&mut *mut c_void, &mut ~Scheduler>(void_sched_ptr)
};
let sched: &mut Scheduler = &mut **sched;
return sched;
}
}

View file

@ -388,7 +388,7 @@ fn connect_read() {
vec_to_uv_buf(vec::from_elem(size, 0))
};
do stream_watcher.read_start(alloc)
|stream_watcher, nread, buf, status| {
|stream_watcher, _nread, buf, status| {
let buf = vec_from_uv_buf(buf);
rtdebug!("read cb!");

View file

@ -64,9 +64,7 @@ fn test_simple_deep() {
if i == 0 { return }
for walk_stack |_frame| {
unsafe {
breakpoint();
}
breakpoint();
}
run(i - 1);
}

View file

@ -3346,7 +3346,7 @@ mod tests {
#[test]
fn test_shift_byte() {
let mut s = ~"ABC";
let b = unsafe { raw::shift_byte(&mut s) };
let b = raw::shift_byte(&mut s);
assert!((s == ~"BC"));
assert!((b == 65u8));
}
@ -3354,7 +3354,7 @@ mod tests {
#[test]
fn test_pop_byte() {
let mut s = ~"ABC";
let b = unsafe { raw::pop_byte(&mut s) };
let b = raw::pop_byte(&mut s);
assert!((s == ~"AB"));
assert!((b == 67u8));
}

View file

@ -150,32 +150,28 @@ fn test_tls_modify() {
#[test]
fn test_tls_crust_automorestack_memorial_bug() {
unsafe {
// This might result in a stack-canary clobber if the runtime fails to
// set sp_limit to 0 when calling the cleanup extern - it might
// automatically jump over to the rust stack, which causes next_c_sp
// to get recorded as something within a rust stack segment. Then a
// subsequent upcall (esp. for logging, think vsnprintf) would run on
// a stack smaller than 1 MB.
fn my_key(_x: @~str) { }
do task::spawn {
unsafe { local_data_set(my_key, @~"hax"); }
}
// This might result in a stack-canary clobber if the runtime fails to
// set sp_limit to 0 when calling the cleanup extern - it might
// automatically jump over to the rust stack, which causes next_c_sp
// to get recorded as something within a rust stack segment. Then a
// subsequent upcall (esp. for logging, think vsnprintf) would run on
// a stack smaller than 1 MB.
fn my_key(_x: @~str) { }
do task::spawn {
unsafe { local_data_set(my_key, @~"hax"); }
}
}
#[test]
fn test_tls_multiple_types() {
unsafe {
fn str_key(_x: @~str) { }
fn box_key(_x: @@()) { }
fn int_key(_x: @int) { }
do task::spawn {
unsafe {
local_data_set(str_key, @~"string data");
local_data_set(box_key, @@());
local_data_set(int_key, @42);
}
fn str_key(_x: @~str) { }
fn box_key(_x: @@()) { }
fn int_key(_x: @int) { }
do task::spawn {
unsafe {
local_data_set(str_key, @~"string data");
local_data_set(box_key, @@());
local_data_set(int_key, @42);
}
}
}

View file

@ -160,7 +160,7 @@ pub fn stash_ty_if(c: @fn(@ast::Ty, test_mode)->bool,
pub struct StolenStuff {exprs: ~[ast::expr], tys: ~[ast::Ty]}
pub fn steal(crate: ast::crate, tm: test_mode) -> StolenStuff {
pub fn steal(crate: @ast::crate, tm: test_mode) -> StolenStuff {
let exprs = @mut ~[];
let tys = @mut ~[];
let v = visit::mk_simple_visitor(@visit::SimpleVisitor {
@ -197,7 +197,7 @@ pub fn safe_to_replace_ty(t: &ast::ty_, _tm: test_mode) -> bool {
}
// Replace the |i|th expr (in fold order) of |crate| with |newexpr|.
pub fn replace_expr_in_crate(crate: ast::crate, i: uint,
pub fn replace_expr_in_crate(crate: @ast::crate, i: uint,
newexpr: ast::expr, tm: test_mode) ->
ast::crate {
let j: @mut uint = @mut 0u;
@ -222,13 +222,13 @@ pub fn replace_expr_in_crate(crate: ast::crate, i: uint,
.. *fold::default_ast_fold()
};
let af = fold::make_fold(afp);
let crate2: @ast::crate = @af.fold_crate(&crate);
let crate2: @ast::crate = @af.fold_crate(crate);
*crate2
}
// Replace the |i|th ty (in fold order) of |crate| with |newty|.
pub fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::Ty,
pub fn replace_ty_in_crate(crate: @ast::crate, i: uint, newty: ast::Ty,
tm: test_mode) -> ast::crate {
let j: @mut uint = @mut 0u;
fn fold_ty_rep(j_: @mut uint,
@ -248,7 +248,7 @@ pub fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::Ty,
.. *fold::default_ast_fold()
};
let af = fold::make_fold(afp);
let crate2: @ast::crate = @af.fold_crate(&crate);
let crate2: @ast::crate = @af.fold_crate(crate);
*crate2
}
@ -261,7 +261,7 @@ pub fn as_str(f: @fn(+x: @io::Writer)) -> ~str {
io::with_str_writer(f)
}
pub fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
pub fn check_variants_of_ast(crate: @ast::crate, codemap: @codemap::CodeMap,
filename: &Path, cx: Context) {
let stolen = steal(crate, cx.mode);
let extra_exprs = do common_exprs().filtered |a| {
@ -275,13 +275,13 @@ pub fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
}
pub fn check_variants_T<T: Copy>(
crate: ast::crate,
crate: @ast::crate,
codemap: @codemap::CodeMap,
filename: &Path,
thing_label: ~str,
things: ~[T],
stringifier: @fn(@T, @syntax::parse::token::ident_interner) -> ~str,
replacer: @fn(ast::crate, uint, T, test_mode) -> ast::crate,
replacer: @fn(@ast::crate, uint, T, test_mode) -> ast::crate,
cx: Context
) {
error!("%s contains %u %s objects", filename.to_str(),
@ -323,7 +323,7 @@ pub fn check_variants_T<T: Copy>(
last_part(filename.to_str()),
thing_label, i, j);
let safe_to_run = !(content_is_dangerous_to_run(*str3)
|| has_raw_pointers(*crate2));
|| has_raw_pointers(crate2));
check_whole_compiler(*str3, &Path(file_label),
safe_to_run);
}
@ -480,7 +480,7 @@ pub fn parse_and_print(code: @~str) -> ~str {
}
}
pub fn has_raw_pointers(c: ast::crate) -> bool {
pub fn has_raw_pointers(c: @ast::crate) -> bool {
let has_rp = @mut false;
fn visit_ty(flag: @mut bool, t: @ast::Ty) {
match t.node {
@ -634,7 +634,7 @@ pub fn check_variants(files: &[Path], cx: Context) {
pprust::no_ann(),
false)))
});
check_variants_of_ast(*crate, sess.cm, file, cx);
check_variants_of_ast(crate, sess.cm, file, cx);
}
}

View file

@ -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()

View file

@ -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));
}

View file

@ -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(),

View file

@ -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");

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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();

View file

@ -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()
}

View file

@ -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])> {

View file

@ -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(']');
}

View file

@ -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: ~[]};

View file

@ -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);

View file

@ -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) => {

View file

@ -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

View file

@ -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);
}

View file

@ -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) {

View file

@ -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| {

View file

@ -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| {

View file

@ -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
}

View file

@ -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;
}

View file

@ -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

View file

@ -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 {

View file

@ -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();
}

View file

@ -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
}

View file

@ -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| {

View file

@ -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);
}

View file

@ -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
//

View file

@ -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]);
}

View file

@ -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);
}

View file

@ -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 =

View file

@ -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,

View file

@ -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();

View file

@ -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: &param_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,

View file

@ -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) => {

View file

@ -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;
}

View file

@ -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,

View 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 }
}

View file

@ -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 {

View file

@ -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

View file

@ -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(_, _) => {

View file

@ -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);

View file

@ -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(_) =>

View file

@ -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(),

View file

@ -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, ~[]);
}

View file

@ -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) {

View file

@ -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 {

View file

@ -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;

View file

@ -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)
}
}

View file

@ -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
}

View file

@ -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;

View file

@ -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);

View file

@ -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
}

View file

@ -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_) => {

View file

@ -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),

View file

@ -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 {

View file

@ -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> {

View file

@ -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;

View file

@ -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 {

View file

@ -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 {
/*!
*

View file

@ -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();

View file

@ -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;

View file

@ -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);

View file

@ -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"]) }
}

View file

@ -117,7 +117,7 @@ fn build_ctxt(sess: Session,
let ast = syntax::ext::expand::expand_crate(sess.parse_sess,
copy sess.opts.cfg, ast);
let ast = front::test::modify_for_testing(sess, ast);
let ast_map = ast_map::map_crate(sess.diagnostic(), *ast);
let ast_map = ast_map::map_crate(sess.diagnostic(), ast);
Ctxt {
ast: ast,

View file

@ -39,5 +39,5 @@ pub fn from_str_sess(sess: session::Session, source: ~str) -> @ast::crate {
}
fn cfg(sess: session::Session, input: driver::input) -> ast::crate_cfg {
driver::build_configuration(sess, @~"rustdoc", input)
driver::build_configuration(sess, @~"rustdoc", &input)
}

View file

@ -93,7 +93,7 @@ fn record(repl: Repl, blk: @ast::blk, intr: @token::ident_interner) -> Repl {
for blk.node.stmts.each |stmt| {
match stmt.node {
ast::stmt_decl(*) | ast::stmt_mac(*) => {
pprust::print_stmt(pp, **stmt);
pprust::print_stmt(pp, *stmt);
writer.write_line(~"");
}
ast::stmt_expr(expr, _) | ast::stmt_semi(expr, _) => {
@ -101,7 +101,7 @@ fn record(repl: Repl, blk: @ast::blk, intr: @token::ident_interner) -> Repl {
ast::expr_assign(*) |
ast::expr_assign_op(*) |
ast::expr_swap(*) => {
pprust::print_stmt(pp, **stmt);
pprust::print_stmt(pp, *stmt);
writer.write_line(~"");
}
_ => {}
@ -147,13 +147,13 @@ fn run(repl: Repl, input: ~str) -> Repl {
debug!("building driver configuration");
let cfg = driver::build_configuration(sess,
@repl.binary,
wrapped);
&wrapped);
let outputs = driver::build_output_filenames(wrapped, &None, &None, sess);
let outputs = driver::build_output_filenames(&wrapped, &None, &None, sess);
debug!("calling compile_upto");
let (crate, _) = driver::compile_upto(sess, cfg, wrapped,
driver::cu_everything,
Some(outputs));
let (crate, _) = driver::compile_upto(sess, cfg, &wrapped,
driver::cu_everything,
Some(outputs));
let mut opt = None;
@ -198,9 +198,9 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
let input = driver::file_input(src_path);
let sess = driver::build_session(options, diagnostic::emit);
*sess.building_library = true;
let cfg = driver::build_configuration(sess, @binary, input);
let cfg = driver::build_configuration(sess, @binary, &input);
let outputs = driver::build_output_filenames(
input, &None, &None, sess);
&input, &None, &None, sess);
// If the library already exists and is newer than the source
// file, skip compilation and return None.
let mut should_compile = true;
@ -228,7 +228,7 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
}
if (should_compile) {
io::println(fmt!("compiling %s...", src_filename));
driver::compile_upto(sess, cfg, input, driver::cu_everything,
driver::compile_upto(sess, cfg, &input, driver::cu_everything,
Some(outputs));
true
} else { false }

View file

@ -37,7 +37,7 @@ use std::{getopts};
use syntax::{ast, diagnostic};
use util::*;
use path_util::{dest_dir, normalize};
use rustc::driver::session::{lib_crate, bin_crate, unknown_crate, crate_type};
use rustc::driver::session::{lib_crate, bin_crate, crate_type};
mod conditions;
mod usage;
@ -82,8 +82,8 @@ impl PkgScript {
};
let input = driver::file_input(script);
let sess = driver::build_session(options, diagnostic::emit);
let cfg = driver::build_configuration(sess, @binary, input);
let (crate, _) = driver::compile_upto(sess, cfg, input,
let cfg = driver::build_configuration(sess, @binary, &input);
let (crate, _) = driver::compile_upto(sess, cfg, &input,
driver::cu_parse, None);
let work_dir = dest_dir(id);
@ -112,7 +112,7 @@ impl PkgScript {
// Collect together any user-defined commands in the package script
let crate = util::ready_crate(sess, self.crate);
debug!("Building output filenames with script name %s",
driver::source_name(self.input));
driver::source_name(&self.input));
match filesearch::get_rustpkg_sysroot() {
Ok(r) => {
let root = r.pop().pop().pop().pop(); // :-\

View file

@ -12,7 +12,7 @@ use core::*;
use core::cmp::Ord;
use core::hash::Streaming;
use rustc::driver::{driver, session};
use rustc::driver::session::{lib_crate, bin_crate, unknown_crate};
use rustc::driver::session::{lib_crate, unknown_crate};
use rustc::metadata::filesearch;
use std::getopts::groups::getopts;
use std::semver;
@ -25,7 +25,7 @@ use syntax::{ast, attr, codemap, diagnostic, fold};
use syntax::ast::{meta_name_value, meta_list, attribute, crate_};
use syntax::attr::{mk_attr};
use rustc::back::link::output_type_exe;
use rustc::driver::session::{lib_crate, bin_crate, unknown_crate, crate_type};
use rustc::driver::session::{lib_crate, unknown_crate, crate_type};
pub type ExitCode = int; // For now
@ -516,9 +516,9 @@ pub fn compile_crate_from_input(input: driver::input,
binary: ~str,
what: driver::compile_upto) -> @ast::crate {
debug!("Calling build_output_filenames with %?", build_dir_opt);
let outputs = driver::build_output_filenames(input, &build_dir_opt, &Some(out_file), sess);
let outputs = driver::build_output_filenames(&input, &build_dir_opt, &Some(out_file), sess);
debug!("Outputs are %? and output type = %?", outputs, sess.opts.output_type);
let cfg = driver::build_configuration(sess, @binary, input);
let cfg = driver::build_configuration(sess, @binary, &input);
match crate_opt {
Some(c) => {
debug!("Calling compile_rest, outputs = %?", outputs);
@ -528,7 +528,7 @@ pub fn compile_crate_from_input(input: driver::input,
}
None => {
debug!("Calling compile_upto, outputs = %?", outputs);
let (crate, _) = driver::compile_upto(sess, cfg, input,
let (crate, _) = driver::compile_upto(sess, cfg, &input,
driver::cu_parse, Some(outputs));
// Inject the inferred link_meta info if it's not already there

View file

@ -159,8 +159,8 @@ mod tests {
assert!(mem as int != 0);
return unsafe { c_vec_with_dtor(mem as *mut u8, n as uint,
|| unsafe { free(mem) }) };
return c_vec_with_dtor(mem as *mut u8, n as uint,
|| unsafe { free(mem) });
}
}
@ -196,7 +196,7 @@ mod tests {
#[test]
fn test_and_I_mean_it() {
let cv = malloc(16u as size_t);
let p = unsafe { ptr(cv) };
let p = ptr(cv);
set(cv, 0u, 32u8);
set(cv, 1u, 33u8);

View file

@ -1287,18 +1287,16 @@ mod tests {
node::Content(x) => {
let str = @mut ~"";
fn aux(str: @mut ~str, node: @node::Node) {
unsafe {
match (*node) {
node::Leaf(x) => {
*str += str::slice(
*x.content, x.byte_offset,
x.byte_offset + x.byte_len).to_owned();
}
node::Concat(ref x) => {
aux(str, x.left);
aux(str, x.right);
}
}
match (*node) {
node::Leaf(x) => {
*str += str::slice(
*x.content, x.byte_offset,
x.byte_offset + x.byte_len).to_owned();
}
node::Concat(ref x) => {
aux(str, x.left);
aux(str, x.right);
}
}
}
aux(str, x);

View file

@ -224,36 +224,32 @@ struct AhData {
#[cfg(test)]
fn impl_uv_iotask_async(iotask: &IoTask) {
unsafe {
let async_handle = ll::async_t();
let ah_ptr = ptr::addr_of(&async_handle);
let (exit_po, exit_ch) = stream::<()>();
let ah_data = AhData {
iotask: iotask.clone(),
exit_ch: SharedChan::new(exit_ch)
};
let ah_data_ptr: *AhData = unsafe {
ptr::to_unsafe_ptr(&ah_data)
};
debug!("about to interact");
do interact(iotask) |loop_ptr| {
unsafe {
debug!("interacting");
ll::async_init(loop_ptr, ah_ptr, async_handle_cb);
ll::set_data_for_uv_handle(
ah_ptr, ah_data_ptr as *libc::c_void);
ll::async_send(ah_ptr);
}
};
debug!("waiting for async close");
exit_po.recv();
}
let async_handle = ll::async_t();
let ah_ptr = ptr::addr_of(&async_handle);
let (exit_po, exit_ch) = stream::<()>();
let ah_data = AhData {
iotask: iotask.clone(),
exit_ch: SharedChan::new(exit_ch)
};
let ah_data_ptr: *AhData = ptr::to_unsafe_ptr(&ah_data);
debug!("about to interact");
do interact(iotask) |loop_ptr| {
unsafe {
debug!("interacting");
ll::async_init(loop_ptr, ah_ptr, async_handle_cb);
ll::set_data_for_uv_handle(
ah_ptr, ah_data_ptr as *libc::c_void);
ll::async_send(ah_ptr);
}
};
debug!("waiting for async close");
exit_po.recv();
}
// this fn documents the bear minimum neccesary to roll your own
// high_level_loop
#[cfg(test)]
unsafe fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask {
fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask {
let (iotask_port, iotask_ch) = stream::<IoTask>();
do task::spawn_sched(task::ManualThreads(1u)) {
debug!("about to run a test loop");
@ -265,9 +261,7 @@ unsafe fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask {
#[cfg(test)]
extern fn lifetime_handle_close(handle: *libc::c_void) {
unsafe {
debug!("lifetime_handle_close ptr %?", handle);
}
debug!("lifetime_handle_close ptr %?", handle);
}
#[cfg(test)]
@ -279,38 +273,36 @@ extern fn lifetime_async_callback(handle: *libc::c_void,
#[test]
fn test_uv_iotask_async() {
unsafe {
let (exit_po, exit_ch) = stream::<()>();
let iotask = &spawn_test_loop(~exit_ch);
let (exit_po, exit_ch) = stream::<()>();
let iotask = &spawn_test_loop(~exit_ch);
debug!("spawned iotask");
debug!("spawned iotask");
// using this handle to manage the lifetime of the
// high_level_loop, as it will exit the first time one of
// the impl_uv_hl_async() is cleaned up with no one ref'd
// handles on the loop (Which can happen under
// race-condition type situations.. this ensures that the
// loop lives until, at least, all of the
// impl_uv_hl_async() runs have been called, at least.
let (work_exit_po, work_exit_ch) = stream::<()>();
let work_exit_ch = SharedChan::new(work_exit_ch);
for iter::repeat(7u) {
let iotask_clone = iotask.clone();
let work_exit_ch_clone = work_exit_ch.clone();
do task::spawn_sched(task::ManualThreads(1u)) {
debug!("async");
impl_uv_iotask_async(&iotask_clone);
debug!("done async");
work_exit_ch_clone.send(());
};
// using this handle to manage the lifetime of the
// high_level_loop, as it will exit the first time one of
// the impl_uv_hl_async() is cleaned up with no one ref'd
// handles on the loop (Which can happen under
// race-condition type situations.. this ensures that the
// loop lives until, at least, all of the
// impl_uv_hl_async() runs have been called, at least.
let (work_exit_po, work_exit_ch) = stream::<()>();
let work_exit_ch = SharedChan::new(work_exit_ch);
for iter::repeat(7u) {
let iotask_clone = iotask.clone();
let work_exit_ch_clone = work_exit_ch.clone();
do task::spawn_sched(task::ManualThreads(1u)) {
debug!("async");
impl_uv_iotask_async(&iotask_clone);
debug!("done async");
work_exit_ch_clone.send(());
};
for iter::repeat(7u) {
debug!("waiting");
work_exit_po.recv();
};
debug!(~"sending teardown_loop msg..");
exit(iotask);
exit_po.recv();
debug!(~"after recv on exit_po.. exiting..");
}
};
for iter::repeat(7u) {
debug!("waiting");
work_exit_po.recv();
};
debug!(~"sending teardown_loop msg..");
exit(iotask);
exit_po.recv();
debug!(~"after recv on exit_po.. exiting..");
}

View file

@ -1422,10 +1422,8 @@ mod test {
}
extern fn server_after_close_cb(handle: *libc::c_void) {
unsafe {
debug!("SERVER server stream closed, should exit. h: %?",
handle);
}
debug!("SERVER server stream closed, should exit. h: %?",
handle);
}
extern fn client_stream_after_close_cb(handle: *libc::c_void) {
@ -1709,48 +1707,46 @@ mod test {
// this is the impl for a test that is (maybe) ran on a
// per-platform/arch basis below
pub fn impl_uv_tcp_server_and_request() {
unsafe {
let bind_ip = ~"0.0.0.0";
let request_ip = ~"127.0.0.1";
let port = 8886;
let kill_server_msg = ~"does a dog have buddha nature?";
let server_resp_msg = ~"mu!";
let (client_port, client_chan) = stream::<~str>();
let client_chan = SharedChan::new(client_chan);
let (server_port, server_chan) = stream::<~str>();
let server_chan = SharedChan::new(server_chan);
let bind_ip = ~"0.0.0.0";
let request_ip = ~"127.0.0.1";
let port = 8886;
let kill_server_msg = ~"does a dog have buddha nature?";
let server_resp_msg = ~"mu!";
let (client_port, client_chan) = stream::<~str>();
let client_chan = SharedChan::new(client_chan);
let (server_port, server_chan) = stream::<~str>();
let server_chan = SharedChan::new(server_chan);
let (continue_port, continue_chan) = stream::<bool>();
let continue_chan = SharedChan::new(continue_chan);
let (continue_port, continue_chan) = stream::<bool>();
let continue_chan = SharedChan::new(continue_chan);
let kill_server_msg_copy = copy kill_server_msg;
let server_resp_msg_copy = copy server_resp_msg;
do task::spawn_sched(task::ManualThreads(1)) {
impl_uv_tcp_server(bind_ip, port,
copy kill_server_msg_copy,
copy server_resp_msg_copy,
server_chan.clone(),
continue_chan.clone());
};
let kill_server_msg_copy = copy kill_server_msg;
let server_resp_msg_copy = copy server_resp_msg;
do task::spawn_sched(task::ManualThreads(1)) {
impl_uv_tcp_server(bind_ip, port,
copy kill_server_msg_copy,
copy server_resp_msg_copy,
server_chan.clone(),
continue_chan.clone());
};
// block until the server up is.. possibly a race?
debug!(~"before receiving on server continue_port");
continue_port.recv();
debug!(~"received on continue port, set up tcp client");
// block until the server up is.. possibly a race?
debug!(~"before receiving on server continue_port");
continue_port.recv();
debug!(~"received on continue port, set up tcp client");
let kill_server_msg_copy = copy kill_server_msg;
do task::spawn_sched(task::ManualThreads(1u)) {
impl_uv_tcp_request(request_ip, port,
kill_server_msg_copy,
client_chan.clone());
};
let kill_server_msg_copy = copy kill_server_msg;
do task::spawn_sched(task::ManualThreads(1u)) {
impl_uv_tcp_request(request_ip, port,
kill_server_msg_copy,
client_chan.clone());
};
let msg_from_client = server_port.recv();
let msg_from_server = client_port.recv();
let msg_from_client = server_port.recv();
let msg_from_server = client_port.recv();
assert!(str::contains(msg_from_client, kill_server_msg));
assert!(str::contains(msg_from_server, server_resp_msg));
}
assert!(str::contains(msg_from_client, kill_server_msg));
assert!(str::contains(msg_from_server, server_resp_msg));
}
// FIXME don't run on fbsd or linux 32 bit(#2064)
@ -1784,17 +1780,15 @@ mod test {
fn struct_size_check_common<TStruct>(t_name: ~str,
foreign_size: libc::c_uint) {
unsafe {
let rust_size = sys::size_of::<TStruct>();
let sizes_match = foreign_size as uint == rust_size;
if !sizes_match {
let output = fmt!(
"STRUCT_SIZE FAILURE: %s -- actual: %u expected: %u",
t_name, rust_size, foreign_size as uint);
debug!(output);
}
assert!(sizes_match);
let rust_size = sys::size_of::<TStruct>();
let sizes_match = foreign_size as uint == rust_size;
if !sizes_match {
let output = fmt!(
"STRUCT_SIZE FAILURE: %s -- actual: %u expected: %u",
t_name, rust_size, foreign_size as uint);
debug!(output);
}
assert!(sizes_match);
}
// struct size tests

View file

@ -255,13 +255,13 @@ pub impl AbiSet {
}
impl to_bytes::IterBytes for Abi {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
self.index().iter_bytes(lsb0, f)
}
}
impl to_bytes::IterBytes for AbiSet {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
self.bits.iter_bytes(lsb0, f)
}
}

View file

@ -97,7 +97,7 @@ impl<D:Decoder> Decodable<D> for ident {
}
impl to_bytes::IterBytes for ident {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
self.repr.iter_bytes(lsb0, f)
}
}
@ -284,7 +284,7 @@ pub enum binding_mode {
}
impl to_bytes::IterBytes for binding_mode {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
match *self {
bind_by_copy => 0u8.iter_bytes(lsb0, f),
@ -330,7 +330,7 @@ pub enum pat_ {
pub enum mutability { m_mutbl, m_imm, m_const, }
impl to_bytes::IterBytes for mutability {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -345,7 +345,7 @@ pub enum Sigil {
}
impl to_bytes::IterBytes for Sigil {
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)
}
}
@ -428,7 +428,7 @@ pub enum inferable<T> {
}
impl<T:to_bytes::IterBytes> to_bytes::IterBytes for inferable<T> {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
match *self {
expl(ref t) =>
to_bytes::iter_bytes_2(&0u8, t, lsb0, f),
@ -446,7 +446,7 @@ impl<T:to_bytes::IterBytes> to_bytes::IterBytes for inferable<T> {
pub enum rmode { by_ref, by_copy }
impl to_bytes::IterBytes for rmode {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -781,7 +781,7 @@ impl ToStr for int_ty {
}
impl to_bytes::IterBytes for int_ty {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -798,7 +798,7 @@ impl ToStr for uint_ty {
}
impl to_bytes::IterBytes for uint_ty {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -815,7 +815,7 @@ impl ToStr for float_ty {
}
impl to_bytes::IterBytes for float_ty {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -860,7 +860,7 @@ impl ToStr for Onceness {
}
impl to_bytes::IterBytes for Onceness {
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);
}
}
@ -911,7 +911,7 @@ pub enum ty_ {
}
impl to_bytes::IterBytes for Ty {
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.span.lo, &self.span.hi, lsb0, f);
}
}
@ -979,7 +979,7 @@ impl ToStr for purity {
}
impl to_bytes::IterBytes for purity {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -994,7 +994,7 @@ pub enum ret_style {
}
impl to_bytes::IterBytes for ret_style {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}
@ -1268,7 +1268,7 @@ pub enum item_ {
pub enum struct_mutability { struct_mutable, struct_immutable }
impl to_bytes::IterBytes for struct_mutability {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(*self as u8).iter_bytes(lsb0, f)
}
}

View file

@ -115,7 +115,7 @@ pub struct Ctx {
pub type vt = visit::vt<@mut Ctx>;
pub fn extend(cx: @mut Ctx, +elt: ident) -> @path {
pub fn extend(cx: @mut Ctx, elt: ident) -> @path {
@(vec::append(copy cx.path, ~[path_name(elt)]))
}
@ -132,7 +132,7 @@ pub fn mk_ast_map_visitor() -> vt {
});
}
pub fn map_crate(diag: @span_handler, c: crate) -> map {
pub fn map_crate(diag: @span_handler, c: @crate) -> map {
let cx = @mut Ctx {
map: @mut HashMap::new(),
path: ~[],
@ -148,8 +148,8 @@ pub fn map_crate(diag: @span_handler, c: crate) -> map {
// the item itself.
pub fn map_decoded_item(diag: @span_handler,
map: map,
+path: path,
ii: inlined_item) {
path: path,
ii: &inlined_item) {
// I believe it is ok for the local IDs of inlined items from other crates
// to overlap with the local ids from this crate, so just generate the ids
// starting from 0. (In particular, I think these ids are only used in
@ -167,7 +167,7 @@ pub fn map_decoded_item(diag: @span_handler,
// methods get added to the AST map when their impl is visited. Since we
// don't decode and instantiate the impl, but just the method, we have to
// add it to the table now:
match ii {
match *ii {
ii_item(*) | ii_dtor(*) => { /* fallthrough */ }
ii_foreign(i) => {
cx.map.insert(i.id, node_foreign_item(i,
@ -190,7 +190,7 @@ pub fn map_fn(
body: &blk,
sp: codemap::span,
id: node_id,
&&cx: @mut Ctx,
cx: @mut Ctx,
v: visit::vt<@mut Ctx>
) {
for decl.inputs.each |a| {
@ -222,7 +222,7 @@ pub fn map_fn(
visit::visit_fn(fk, decl, body, sp, id, cx, v);
}
pub fn map_block(b: &blk, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_block(b: &blk, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
cx.map.insert(b.node.id, node_block(/* FIXME (#2543) */ copy *b));
visit::visit_block(b, cx, v);
}
@ -239,24 +239,24 @@ pub fn number_pat(cx: @mut Ctx, pat: @pat) {
};
}
pub fn map_local(loc: @local, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_local(loc: @local, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
number_pat(cx, loc.node.pat);
visit::visit_local(loc, cx, v);
}
pub fn map_arm(arm: &arm, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_arm(arm: &arm, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
number_pat(cx, arm.pats[0]);
visit::visit_arm(arm, cx, v);
}
pub fn map_method(impl_did: def_id, impl_path: @path,
m: @method, &&cx: @mut Ctx) {
m: @method, cx: @mut Ctx) {
cx.map.insert(m.id, node_method(m, impl_did, impl_path));
cx.map.insert(m.self_id, node_local(cx.local_id));
cx.local_id += 1u;
}
pub fn map_item(i: @item, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_item(i: @item, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
let item_path = @/* FIXME (#2543) */ copy cx.path;
cx.map.insert(i.id, node_item(i, item_path));
match i.node {
@ -355,13 +355,13 @@ pub fn map_struct_def(
}
}
pub fn map_expr(ex: @expr, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
pub fn map_expr(ex: @expr, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
cx.map.insert(ex.id, node_expr(ex));
visit::visit_expr(ex, cx, v);
}
pub fn map_stmt(stmt: @stmt, &&cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
cx.map.insert(stmt_id(*stmt), node_stmt(stmt));
pub fn map_stmt(stmt: @stmt, cx: @mut Ctx, v: visit::vt<@mut Ctx>) {
cx.map.insert(stmt_id(stmt), node_stmt(stmt));
visit::visit_stmt(stmt, cx, v);
}
@ -408,7 +408,7 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
}
Some(&node_stmt(stmt)) => {
fmt!("stmt %s (id=%?)",
pprust::stmt_to_str(*stmt, itr), id)
pprust::stmt_to_str(stmt, itr), id)
}
Some(&node_arg(_, _)) => { // add more info here
fmt!("arg (id=%?)", id)
@ -430,7 +430,7 @@ pub fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
pub fn node_item_query<Result>(items: map, id: node_id,
query: &fn(@item) -> Result,
+error_msg: ~str) -> Result {
error_msg: ~str) -> Result {
match items.find(&id) {
Some(&node_item(it, _)) => query(it),
_ => fail!(error_msg)

View file

@ -39,7 +39,7 @@ pub fn local_def(id: node_id) -> def_id {
pub fn is_local(did: ast::def_id) -> bool { did.crate == local_crate }
pub fn stmt_id(s: stmt) -> node_id {
pub fn stmt_id(s: &stmt) -> node_id {
match s.node {
stmt_decl(_, id) => id,
stmt_expr(_, id) => id,
@ -200,7 +200,7 @@ pub fn is_call_expr(e: @expr) -> bool {
// This makes def_id hashable
impl to_bytes::IterBytes for def_id {
#[inline(always)]
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.crate, &self.node, lsb0, f);
}
}
@ -211,7 +211,7 @@ pub fn block_from_expr(e: @expr) -> blk {
}
pub fn default_block(
+stmts1: ~[@stmt],
stmts1: ~[@stmt],
expr1: Option<@expr>,
id1: node_id
) -> blk_ {
@ -224,7 +224,7 @@ pub fn default_block(
}
}
pub fn ident_to_path(s: span, +i: ident) -> @Path {
pub fn ident_to_path(s: span, i: ident) -> @Path {
@ast::Path { span: s,
global: false,
idents: ~[i],
@ -232,7 +232,7 @@ pub fn ident_to_path(s: span, +i: ident) -> @Path {
types: ~[] }
}
pub fn ident_to_pat(id: node_id, s: span, +i: ident) -> @pat {
pub fn ident_to_pat(id: node_id, s: span, i: ident) -> @pat {
@ast::pat { id: id,
node: pat_ident(bind_by_copy, ident_to_path(s, i), None),
span: s }
@ -300,7 +300,7 @@ pub fn struct_field_visibility(field: ast::struct_field) -> visibility {
pub trait inlined_item_utils {
fn ident(&self) -> ident;
fn id(&self) -> ast::node_id;
fn accept<E>(&self, e: E, v: visit::vt<E>);
fn accept<E: Copy>(&self, e: E, v: visit::vt<E>);
}
impl inlined_item_utils for inlined_item {
@ -322,7 +322,7 @@ impl inlined_item_utils for inlined_item {
}
}
fn accept<E>(&self, e: E, v: visit::vt<E>) {
fn accept<E: Copy>(&self, e: E, v: visit::vt<E>) {
match *self {
ii_item(i) => (v.visit_item)(i, e, v),
ii_foreign(i) => (v.visit_foreign_item)(i, e, v),
@ -435,7 +435,7 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
visit_local: |l| vfn(l.node.id),
visit_block: |b| vfn(b.node.id),
visit_stmt: |s| vfn(ast_util::stmt_id(*s)),
visit_stmt: |s| vfn(ast_util::stmt_id(s)),
visit_arm: |_| {},
visit_pat: |p| vfn(p.id),
visit_decl: |_| {},
@ -491,7 +491,7 @@ pub fn id_visitor(vfn: @fn(node_id)) -> visit::vt<()> {
})
}
pub fn visit_ids_for_inlined_item(item: inlined_item, vfn: @fn(node_id)) {
pub fn visit_ids_for_inlined_item(item: &inlined_item, vfn: @fn(node_id)) {
item.accept((), id_visitor(vfn));
}
@ -505,7 +505,7 @@ pub fn compute_id_range(visit_ids_fn: &fn(@fn(node_id))) -> id_range {
id_range { min: *min, max: *max }
}
pub fn compute_id_range_for_inlined_item(item: inlined_item) -> id_range {
pub fn compute_id_range_for_inlined_item(item: &inlined_item) -> id_range {
compute_id_range(|f| visit_ids_for_inlined_item(item, f))
}
@ -609,7 +609,7 @@ pub fn mk_rename (id:ident, to:Name, tail:SyntaxContext, table: &mut SCTable)
pub fn mk_sctable() -> SCTable { ~[EmptyCtxt] }
/// Add a value to the end of a vec, return its index
fn idx_push<T>(vec: &mut ~[T], +val: T) -> uint {
fn idx_push<T>(vec: &mut ~[T], val: T) -> uint {
vec.push(val);
vec.len() - 1
}

View file

@ -31,12 +31,12 @@ pub fn mk_name_value_item_str(name: @~str, value: @~str)
mk_name_value_item(name, value_lit)
}
pub fn mk_name_value_item(name: @~str, +value: ast::lit)
pub fn mk_name_value_item(name: @~str, value: ast::lit)
-> @ast::meta_item {
@dummy_spanned(ast::meta_name_value(name, value))
}
pub fn mk_list_item(name: @~str, +items: ~[@ast::meta_item]) ->
pub fn mk_list_item(name: @~str, items: ~[@ast::meta_item]) ->
@ast::meta_item {
@dummy_spanned(ast::meta_list(name, items))
}
@ -51,8 +51,8 @@ pub fn mk_attr(item: @ast::meta_item) -> ast::attribute {
is_sugared_doc: false })
}
pub fn mk_sugared_doc_attr(+text: ~str,
+lo: BytePos, +hi: BytePos) -> ast::attribute {
pub fn mk_sugared_doc_attr(text: ~str,
lo: BytePos, hi: BytePos) -> ast::attribute {
let style = doc_comment_style(text);
let lit = spanned(lo, hi, ast::lit_str(@text));
let attr = ast::attribute_ {

View file

@ -71,7 +71,7 @@ impl Sub<BytePos, BytePos> for BytePos {
}
impl to_bytes::IterBytes for BytePos {
fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(**self).iter_bytes(lsb0, f)
}
}
@ -89,7 +89,7 @@ impl cmp::Ord for CharPos {
}
impl to_bytes::IterBytes for CharPos {
fn iter_bytes(&self, +lsb0: bool, &&f: to_bytes::Cb) {
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) {
(**self).iter_bytes(lsb0, f)
}
}
@ -141,20 +141,20 @@ impl<D:Decoder> Decodable<D> for span {
}
}
pub fn spanned<T>(+lo: BytePos, +hi: BytePos, +t: T) -> spanned<T> {
pub fn spanned<T>(lo: BytePos, hi: BytePos, t: T) -> spanned<T> {
respan(mk_sp(lo, hi), t)
}
pub fn respan<T>(sp: span, +t: T) -> spanned<T> {
pub fn respan<T>(sp: span, t: T) -> spanned<T> {
spanned {node: t, span: sp}
}
pub fn dummy_spanned<T>(+t: T) -> spanned<T> {
pub fn dummy_spanned<T>(t: T) -> spanned<T> {
respan(dummy_sp(), t)
}
/* assuming that we're not in macro expansion */
pub fn mk_sp(+lo: BytePos, +hi: BytePos) -> span {
pub fn mk_sp(lo: BytePos, hi: BytePos) -> span {
span {lo: lo, hi: hi, expn_info: None}
}
@ -247,7 +247,7 @@ pub impl FileMap {
// UNCHECKED INVARIANT: these offsets must be added in the right
// order and must be in the right places; there is shared knowledge
// about what ends a line between this file and parse.rs
fn next_line(&self, +pos: BytePos) {
fn next_line(&self, pos: BytePos) {
// the new charpos must be > the last one (or it's the first one).
let lines = &mut *self.lines;
assert!((lines.len() == 0) || (lines[lines.len() - 1] < pos));
@ -287,14 +287,14 @@ pub impl CodeMap {
}
/// Add a new FileMap to the CodeMap and return it
fn new_filemap(&self, +filename: FileName, src: @~str) -> @FileMap {
fn new_filemap(&self, filename: FileName, src: @~str) -> @FileMap {
return self.new_filemap_w_substr(filename, FssNone, src);
}
fn new_filemap_w_substr(
&self,
+filename: FileName,
+substr: FileSubstr,
filename: FileName,
substr: FileSubstr,
src: @~str
) -> @FileMap {
let files = &mut *self.files;
@ -325,11 +325,11 @@ pub impl CodeMap {
}
/// Lookup source information about a BytePos
pub fn lookup_char_pos(&self, +pos: BytePos) -> Loc {
pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
return self.lookup_pos(pos);
}
pub fn lookup_char_pos_adj(&self, +pos: BytePos) -> LocWithOpt
pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt
{
let loc = self.lookup_char_pos(pos);
match (loc.file.substr) {
@ -405,7 +405,7 @@ pub impl CodeMap {
priv impl CodeMap {
fn lookup_filemap_idx(&self, +pos: BytePos) -> uint {
fn lookup_filemap_idx(&self, pos: BytePos) -> uint {
let files = &*self.files;
let len = files.len();
let mut a = 0u;
@ -440,7 +440,7 @@ priv impl CodeMap {
return FileMapAndLine {fm: f, line: a};
}
fn lookup_pos(&self, +pos: BytePos) -> Loc {
fn lookup_pos(&self, pos: BytePos) -> Loc {
let FileMapAndLine {fm: f, line: a} = self.lookup_line(pos);
let line = a + 1u; // Line numbers start at 1
let chpos = self.bytepos_to_local_charpos(pos);
@ -466,7 +466,7 @@ priv impl CodeMap {
lo.line, lo.col.to_uint(), hi.line, hi.col.to_uint())
}
fn lookup_byte_offset(&self, +bpos: BytePos)
fn lookup_byte_offset(&self, bpos: BytePos)
-> FileMapAndBytePos {
let idx = self.lookup_filemap_idx(bpos);
let fm = self.files[idx];
@ -476,7 +476,7 @@ priv impl CodeMap {
// Converts an absolute BytePos to a CharPos relative to the file it is
// located in
fn bytepos_to_local_charpos(&self, +bpos: BytePos) -> CharPos {
fn bytepos_to_local_charpos(&self, bpos: BytePos) -> CharPos {
debug!("codemap: converting %? to char pos", bpos);
let idx = self.lookup_filemap_idx(bpos);
let map = self.files[idx];

View file

@ -239,7 +239,7 @@ priv impl @ext_ctxt {
}
}
fn expr(&self, span: span, +node: ast::expr_) -> @ast::expr {
fn expr(&self, span: span, node: ast::expr_) -> @ast::expr {
@ast::expr {
id: self.next_id(),
callee_id: self.next_id(),
@ -248,7 +248,7 @@ priv impl @ext_ctxt {
}
}
fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
fn path(&self, span: span, strs: ~[ast::ident]) -> @ast::Path {
@ast::Path {
span: span,
global: false,
@ -258,7 +258,7 @@ priv impl @ext_ctxt {
}
}
fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
fn path_global(&self, span: span, strs: ~[ast::ident]) -> @ast::Path {
@ast::Path {
span: span,
global: true,
@ -271,8 +271,8 @@ priv impl @ext_ctxt {
fn path_tps(
&self,
span: span,
+strs: ~[ast::ident],
+tps: ~[@ast::Ty]
strs: ~[ast::ident],
tps: ~[@ast::Ty]
) -> @ast::Path {
@ast::Path {
span: span,
@ -286,8 +286,8 @@ priv impl @ext_ctxt {
fn path_tps_global(
&self,
span: span,
+strs: ~[ast::ident],
+tps: ~[@ast::Ty]
strs: ~[ast::ident],
tps: ~[@ast::Ty]
) -> @ast::Path {
@ast::Path {
span: span,
@ -301,8 +301,8 @@ priv impl @ext_ctxt {
fn ty_path(
&self,
span: span,
+strs: ~[ast::ident],
+tps: ~[@ast::Ty]
strs: ~[ast::ident],
tps: ~[@ast::Ty]
) -> @ast::Ty {
@ast::Ty {
id: self.next_id(),
@ -349,13 +349,13 @@ priv impl @ext_ctxt {
span: span}))
}
fn lambda(&self, +blk: ast::blk) -> @ast::expr {
fn lambda(&self, blk: ast::blk) -> @ast::expr {
let ext_cx = *self;
let blk_e = self.expr(copy blk.span, ast::expr_block(copy blk));
quote_expr!( || $blk_e )
}
fn blk(&self, span: span, +stmts: ~[@ast::stmt]) -> ast::blk {
fn blk(&self, span: span, stmts: ~[@ast::stmt]) -> ast::blk {
codemap::spanned {
node: ast::blk_ {
view_items: ~[],
@ -381,19 +381,19 @@ priv impl @ext_ctxt {
}
}
fn expr_path(&self, span: span, +strs: ~[ast::ident]) -> @ast::expr {
fn expr_path(&self, span: span, strs: ~[ast::ident]) -> @ast::expr {
self.expr(span, ast::expr_path(self.path(span, strs)))
}
fn expr_path_global(
&self,
span: span,
+strs: ~[ast::ident]
strs: ~[ast::ident]
) -> @ast::expr {
self.expr(span, ast::expr_path(self.path_global(span, strs)))
}
fn expr_var(&self, span: span, +var: ~str) -> @ast::expr {
fn expr_var(&self, span: span, var: ~str) -> @ast::expr {
self.expr_path(span, ~[self.ident_of(var)])
}
@ -410,7 +410,7 @@ priv impl @ext_ctxt {
&self,
span: span,
expr: @ast::expr,
+args: ~[@ast::expr]
args: ~[@ast::expr]
) -> @ast::expr {
self.expr(span, ast::expr_call(expr, args, ast::NoSugar))
}
@ -420,7 +420,7 @@ priv impl @ext_ctxt {
span: span,
expr: @ast::expr,
ident: ast::ident,
+args: ~[@ast::expr]
args: ~[@ast::expr]
) -> @ast::expr {
self.expr(span, ast::expr_method_call(expr, ident, ~[], args, ast::NoSugar))
}
@ -429,7 +429,7 @@ priv impl @ext_ctxt {
self.lambda(self.expr_blk(expr))
}
fn lambda_stmts(&self, span: span, +stmts: ~[@ast::stmt]) -> @ast::expr {
fn lambda_stmts(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr {
self.lambda(self.blk(span, stmts))
}
}
@ -597,7 +597,7 @@ fn mk_deser_impl(
fn mk_ser_method(
cx: @ext_ctxt,
span: span,
+ser_body: ast::blk
ser_body: ast::blk
) -> @ast::method {
let ty_s = @ast::Ty {
id: cx.next_id(),
@ -660,7 +660,7 @@ fn mk_deser_method(
cx: @ext_ctxt,
span: span,
ty: @ast::Ty,
+deser_body: ast::blk
deser_body: ast::blk
) -> @ast::method {
let ty_d = @ast::Ty {
id: cx.next_id(),
@ -864,7 +864,7 @@ fn mk_enum_ser_impl(
cx: @ext_ctxt,
span: span,
ident: ast::ident,
+enum_def: ast::enum_def,
enum_def: ast::enum_def,
generics: &ast::Generics
) -> @ast::item {
let body = mk_enum_ser_body(
@ -881,7 +881,7 @@ fn mk_enum_deser_impl(
cx: @ext_ctxt,
span: span,
ident: ast::ident,
+enum_def: ast::enum_def,
enum_def: ast::enum_def,
generics: &ast::Generics
) -> @ast::item {
let body = mk_enum_deser_body(
@ -974,7 +974,7 @@ fn mk_enum_ser_body(
cx: @ext_ctxt,
span: span,
name: ast::ident,
+variants: ~[ast::variant]
variants: ~[ast::variant]
) -> @ast::expr {
let arms = do variants.mapi |v_idx, variant| {
match variant.node.kind {
@ -1219,37 +1219,37 @@ mod test {
impl Encoder for TestEncoder {
fn emit_nil(&self) { self.add_to_log(CallToEmitNil) }
fn emit_uint(&self, +v: uint) {self.add_to_log(CallToEmitUint(v)); }
fn emit_u64(&self, +_v: u64) { self.add_unknown_to_log(); }
fn emit_u32(&self, +_v: u32) { self.add_unknown_to_log(); }
fn emit_u16(&self, +_v: u16) { self.add_unknown_to_log(); }
fn emit_u8(&self, +_v: u8) { self.add_unknown_to_log(); }
fn emit_uint(&self, v: uint) {self.add_to_log(CallToEmitUint(v)); }
fn emit_u64(&self, _v: u64) { self.add_unknown_to_log(); }
fn emit_u32(&self, _v: u32) { self.add_unknown_to_log(); }
fn emit_u16(&self, _v: u16) { self.add_unknown_to_log(); }
fn emit_u8(&self, _v: u8) { self.add_unknown_to_log(); }
fn emit_int(&self, +_v: int) { self.add_unknown_to_log(); }
fn emit_i64(&self, +_v: i64) { self.add_unknown_to_log(); }
fn emit_i32(&self, +_v: i32) { self.add_unknown_to_log(); }
fn emit_i16(&self, +_v: i16) { self.add_unknown_to_log(); }
fn emit_i8(&self, +_v: i8) { self.add_unknown_to_log(); }
fn emit_int(&self, _v: int) { self.add_unknown_to_log(); }
fn emit_i64(&self, _v: i64) { self.add_unknown_to_log(); }
fn emit_i32(&self, _v: i32) { self.add_unknown_to_log(); }
fn emit_i16(&self, _v: i16) { self.add_unknown_to_log(); }
fn emit_i8(&self, _v: i8) { self.add_unknown_to_log(); }
fn emit_bool(&self, +_v: bool) { self.add_unknown_to_log(); }
fn emit_bool(&self, _v: bool) { self.add_unknown_to_log(); }
fn emit_f64(&self, +_v: f64) { self.add_unknown_to_log(); }
fn emit_f32(&self, +_v: f32) { self.add_unknown_to_log(); }
fn emit_float(&self, +_v: float) { self.add_unknown_to_log(); }
fn emit_f64(&self, _v: f64) { self.add_unknown_to_log(); }
fn emit_f32(&self, _v: f32) { self.add_unknown_to_log(); }
fn emit_float(&self, _v: float) { self.add_unknown_to_log(); }
fn emit_char(&self, +_v: char) { self.add_unknown_to_log(); }
fn emit_str(&self, +_v: &str) { self.add_unknown_to_log(); }
fn emit_char(&self, _v: char) { self.add_unknown_to_log(); }
fn emit_str(&self, _v: &str) { self.add_unknown_to_log(); }
fn emit_enum(&self, name: &str, f: &fn()) {
self.add_to_log(CallToEmitEnum(name.to_str())); f(); }
fn emit_enum_variant(&self, name: &str, +id: uint,
+cnt: uint, f: &fn()) {
fn emit_enum_variant(&self, name: &str, id: uint,
cnt: uint, f: &fn()) {
self.add_to_log(CallToEmitEnumVariant (name.to_str(),id,cnt));
f();
}
fn emit_enum_variant_arg(&self, +idx: uint, f: &fn()) {
fn emit_enum_variant_arg(&self, idx: uint, f: &fn()) {
self.add_to_log(CallToEmitEnumVariantArg (idx)); f();
}
@ -1261,10 +1261,10 @@ mod test {
self.emit_enum_variant_arg(idx, f)
}
fn emit_struct(&self, name: &str, +len: uint, f: &fn()) {
fn emit_struct(&self, name: &str, len: uint, f: &fn()) {
self.add_to_log(CallToEmitStruct (name.to_str(),len)); f();
}
fn emit_struct_field(&self, name: &str, +idx: uint, f: &fn()) {
fn emit_struct_field(&self, name: &str, idx: uint, f: &fn()) {
self.add_to_log(CallToEmitField (name.to_str(),idx)); f();
}
@ -1294,10 +1294,10 @@ mod test {
f();
}
fn emit_seq(&self, +_len: uint, f: &fn()) {
fn emit_seq(&self, _len: uint, f: &fn()) {
self.add_unknown_to_log(); f();
}
fn emit_seq_elt(&self, +_idx: uint, f: &fn()) {
fn emit_seq_elt(&self, _idx: uint, f: &fn()) {
self.add_unknown_to_log(); f();
}

View file

@ -238,7 +238,7 @@ pub trait ext_ctxt {
fn ident_of(@mut self, st: ~str) -> ast::ident;
}
pub fn mk_ctxt(parse_sess: @mut parse::ParseSess, +cfg: ast::crate_cfg)
pub fn mk_ctxt(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg)
-> @ext_ctxt {
struct CtxtRepr {
parse_sess: @mut parse::ParseSess,
@ -439,7 +439,7 @@ pub enum MapChain<K,V> {
impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
// Constructor. I don't think we need a zero-arg one.
fn new(+init: ~HashMap<K,@V>) -> @mut MapChain<K,V> {
fn new(init: ~HashMap<K,@V>) -> @mut MapChain<K,V> {
@mut BaseMapChain(init)
}
@ -509,7 +509,7 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
}
// insert the binding into the top-level map
fn insert (&mut self, +key: K, +ext: @V) -> bool {
fn insert (&mut self, key: K, ext: @V) -> bool {
// can't abstract over get_map because of flow sensitivity...
match *self {
BaseMapChain (~ref mut map) => map.insert(key, ext),

View file

@ -27,7 +27,7 @@ pub struct Field {
pub fn mk_expr(cx: @ext_ctxt,
sp: codemap::span,
+expr: ast::expr_)
expr: ast::expr_)
-> @ast::expr {
@ast::expr {
id: cx.next_id(),
@ -63,12 +63,12 @@ pub fn mk_unary(cx: @ext_ctxt, sp: span, op: ast::unop, e: @ast::expr)
cx.next_id(); // see ast_util::op_expr_callee_id
mk_expr(cx, sp, ast::expr_unary(op, e))
}
pub fn mk_raw_path(sp: span, +idents: ~[ast::ident]) -> @ast::Path {
pub fn mk_raw_path(sp: span, idents: ~[ast::ident]) -> @ast::Path {
mk_raw_path_(sp, idents, ~[])
}
pub fn mk_raw_path_(sp: span,
+idents: ~[ast::ident],
+types: ~[@ast::Ty])
idents: ~[ast::ident],
types: ~[@ast::Ty])
-> @ast::Path {
@ast::Path { span: sp,
global: false,
@ -76,23 +76,23 @@ pub fn mk_raw_path_(sp: span,
rp: None,
types: types }
}
pub fn mk_raw_path_global(sp: span, +idents: ~[ast::ident]) -> @ast::Path {
pub fn mk_raw_path_global(sp: span, idents: ~[ast::ident]) -> @ast::Path {
mk_raw_path_global_(sp, idents, ~[])
}
pub fn mk_raw_path_global_(sp: span,
+idents: ~[ast::ident],
+types: ~[@ast::Ty]) -> @ast::Path {
idents: ~[ast::ident],
types: ~[@ast::Ty]) -> @ast::Path {
@ast::Path { span: sp,
global: true,
idents: idents,
rp: None,
types: types }
}
pub fn mk_path(cx: @ext_ctxt, sp: span, +idents: ~[ast::ident])
pub fn mk_path(cx: @ext_ctxt, sp: span, idents: ~[ast::ident])
-> @ast::expr {
mk_expr(cx, sp, ast::expr_path(mk_raw_path(sp, idents)))
}
pub fn mk_path_global(cx: @ext_ctxt, sp: span, +idents: ~[ast::ident])
pub fn mk_path_global(cx: @ext_ctxt, sp: span, idents: ~[ast::ident])
-> @ast::expr {
mk_expr(cx, sp, ast::expr_path(mk_raw_path_global(sp, idents)))
}
@ -100,7 +100,7 @@ pub fn mk_access_(cx: @ext_ctxt, sp: span, p: @ast::expr, m: ast::ident)
-> @ast::expr {
mk_expr(cx, sp, ast::expr_field(p, m, ~[]))
}
pub fn mk_access(cx: @ext_ctxt, sp: span, +p: ~[ast::ident], m: ast::ident)
pub fn mk_access(cx: @ext_ctxt, sp: span, p: ~[ast::ident], m: ast::ident)
-> @ast::expr {
let pathexpr = mk_path(cx, sp, p);
return mk_access_(cx, sp, pathexpr, m);
@ -115,25 +115,25 @@ pub fn mk_method_call(cx: @ext_ctxt,
sp: span,
rcvr_expr: @ast::expr,
method_ident: ast::ident,
+args: ~[@ast::expr]) -> @ast::expr {
args: ~[@ast::expr]) -> @ast::expr {
mk_expr(cx, sp, ast::expr_method_call(rcvr_expr, method_ident, ~[], args, ast::NoSugar))
}
pub fn mk_call_(cx: @ext_ctxt, sp: span, fn_expr: @ast::expr,
+args: ~[@ast::expr]) -> @ast::expr {
args: ~[@ast::expr]) -> @ast::expr {
mk_expr(cx, sp, ast::expr_call(fn_expr, args, ast::NoSugar))
}
pub fn mk_call(cx: @ext_ctxt, sp: span, +fn_path: ~[ast::ident],
+args: ~[@ast::expr]) -> @ast::expr {
pub fn mk_call(cx: @ext_ctxt, sp: span, fn_path: ~[ast::ident],
args: ~[@ast::expr]) -> @ast::expr {
let pathexpr = mk_path(cx, sp, fn_path);
return mk_call_(cx, sp, pathexpr, args);
}
pub fn mk_call_global(cx: @ext_ctxt, sp: span, +fn_path: ~[ast::ident],
+args: ~[@ast::expr]) -> @ast::expr {
pub fn mk_call_global(cx: @ext_ctxt, sp: span, fn_path: ~[ast::ident],
args: ~[@ast::expr]) -> @ast::expr {
let pathexpr = mk_path_global(cx, sp, fn_path);
return mk_call_(cx, sp, pathexpr, args);
}
// e = expr, t = type
pub fn mk_base_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
pub fn mk_base_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr])
-> @ast::expr {
let vecexpr = ast::expr_vec(exprs, ast::m_imm);
mk_expr(cx, sp, vecexpr)
@ -143,20 +143,20 @@ pub fn mk_vstore_e(cx: @ext_ctxt, sp: span, expr: @ast::expr,
@ast::expr {
mk_expr(cx, sp, ast::expr_vstore(expr, vst))
}
pub fn mk_uniq_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
pub fn mk_uniq_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr])
-> @ast::expr {
mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs), ast::expr_vstore_uniq)
}
pub fn mk_slice_vec_e(cx: @ext_ctxt, sp: span, +exprs: ~[@ast::expr])
pub fn mk_slice_vec_e(cx: @ext_ctxt, sp: span, exprs: ~[@ast::expr])
-> @ast::expr {
mk_vstore_e(cx, sp, mk_base_vec_e(cx, sp, exprs),
ast::expr_vstore_slice)
}
pub fn mk_base_str(cx: @ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
pub fn mk_base_str(cx: @ext_ctxt, sp: span, s: ~str) -> @ast::expr {
let lit = ast::lit_str(@s);
return mk_lit(cx, sp, lit);
}
pub fn mk_uniq_str(cx: @ext_ctxt, sp: span, +s: ~str) -> @ast::expr {
pub fn mk_uniq_str(cx: @ext_ctxt, sp: span, s: ~str) -> @ast::expr {
mk_vstore_e(cx, sp, mk_base_str(cx, sp, s), ast::expr_vstore_uniq)
}
pub fn mk_field(sp: span, f: &Field) -> ast::field {
@ -170,8 +170,8 @@ pub fn mk_fields(sp: span, fields: ~[Field]) -> ~[ast::field] {
}
pub fn mk_struct_e(cx: @ext_ctxt,
sp: span,
+ctor_path: ~[ast::ident],
+fields: ~[Field])
ctor_path: ~[ast::ident],
fields: ~[Field])
-> @ast::expr {
mk_expr(cx, sp,
ast::expr_struct(mk_raw_path(sp, ctor_path),
@ -180,8 +180,8 @@ pub fn mk_struct_e(cx: @ext_ctxt,
}
pub fn mk_global_struct_e(cx: @ext_ctxt,
sp: span,
+ctor_path: ~[ast::ident],
+fields: ~[Field])
ctor_path: ~[ast::ident],
fields: ~[Field])
-> @ast::expr {
mk_expr(cx, sp,
ast::expr_struct(mk_raw_path_global(sp, ctor_path),
@ -190,7 +190,7 @@ pub fn mk_global_struct_e(cx: @ext_ctxt,
}
pub fn mk_glob_use(cx: @ext_ctxt,
sp: span,
+path: ~[ast::ident]) -> @ast::view_item {
path: ~[ast::ident]) -> @ast::view_item {
let glob = @codemap::spanned {
node: ast::view_path_glob(mk_raw_path(sp, path), cx.next_id()),
span: sp,
@ -226,8 +226,8 @@ pub fn mk_local(cx: @ext_ctxt, sp: span, mutbl: bool,
@codemap::spanned { node: ast::stmt_decl(@decl, cx.next_id()), span: sp }
}
pub fn mk_block(cx: @ext_ctxt, span: span,
+view_items: ~[@ast::view_item],
+stmts: ~[@ast::stmt],
view_items: ~[@ast::view_item],
stmts: ~[@ast::stmt],
expr: Option<@ast::expr>) -> @ast::expr {
let blk = codemap::spanned {
node: ast::blk_ {
@ -243,7 +243,7 @@ pub fn mk_block(cx: @ext_ctxt, span: span,
}
pub fn mk_block_(cx: @ext_ctxt,
span: span,
+stmts: ~[@ast::stmt])
stmts: ~[@ast::stmt])
-> ast::blk {
codemap::spanned {
node: ast::blk_ {
@ -307,7 +307,7 @@ pub fn mk_copy(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
pub fn mk_managed(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
mk_expr(cx, sp, ast::expr_unary(ast::box(ast::m_imm), e))
}
pub fn mk_pat(cx: @ext_ctxt, span: span, +pat: ast::pat_) -> @ast::pat {
pub fn mk_pat(cx: @ext_ctxt, span: span, pat: ast::pat_) -> @ast::pat {
@ast::pat { id: cx.next_id(), node: pat, span: span }
}
pub fn mk_pat_wild(cx: @ext_ctxt, span: span) -> @ast::pat {
@ -335,7 +335,7 @@ pub fn mk_pat_ident_with_binding_mode(cx: @ext_ctxt,
pub fn mk_pat_enum(cx: @ext_ctxt,
span: span,
path: @ast::Path,
+subpats: ~[@ast::pat])
subpats: ~[@ast::pat])
-> @ast::pat {
let pat = ast::pat_enum(path, Some(subpats));
mk_pat(cx, span, pat)
@ -343,7 +343,7 @@ pub fn mk_pat_enum(cx: @ext_ctxt,
pub fn mk_pat_struct(cx: @ext_ctxt,
span: span,
path: @ast::Path,
+field_pats: ~[ast::field_pat])
field_pats: ~[ast::field_pat])
-> @ast::pat {
let pat = ast::pat_struct(path, field_pats, false);
mk_pat(cx, span, pat)
@ -360,7 +360,7 @@ pub fn mk_stmt(cx: @ext_ctxt, span: span, expr: @ast::expr) -> @ast::stmt {
}
pub fn mk_ty_path(cx: @ext_ctxt,
span: span,
+idents: ~[ ast::ident ])
idents: ~[ ast::ident ])
-> @ast::Ty {
let ty = build::mk_raw_path(span, idents);
let ty = ast::ty_path(ty, cx.next_id());
@ -369,7 +369,7 @@ pub fn mk_ty_path(cx: @ext_ctxt,
}
pub fn mk_ty_path_global(cx: @ext_ctxt,
span: span,
+idents: ~[ ast::ident ])
idents: ~[ ast::ident ])
-> @ast::Ty {
let ty = build::mk_raw_path_global(span, idents);
let ty = ast::ty_path(ty, cx.next_id());
@ -399,7 +399,7 @@ pub fn mk_ty_infer(cx: @ext_ctxt, span: span) -> @ast::Ty {
}
pub fn mk_trait_ref_global(cx: @ext_ctxt,
span: span,
+idents: ~[ ast::ident ])
idents: ~[ ast::ident ])
-> @ast::trait_ref
{
mk_trait_ref_(cx, build::mk_raw_path_global(span, idents))
@ -430,12 +430,12 @@ pub fn mk_arg(cx: @ext_ctxt,
id: cx.next_id()
}
}
pub fn mk_fn_decl(+inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl {
pub fn mk_fn_decl(inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl {
ast::fn_decl { inputs: inputs, output: output, cf: ast::return_val }
}
pub fn mk_trait_ty_param_bound_global(cx: @ext_ctxt,
span: span,
+idents: ~[ast::ident])
idents: ~[ast::ident])
-> ast::TyParamBound {
ast::TraitTyParamBound(mk_trait_ref_global(cx, span, idents))
}

View file

@ -91,7 +91,7 @@ fn create_derived_encodable_impl(
fn create_encode_method(
cx: @ext_ctxt,
span: span,
+statements: ~[@stmt]
statements: ~[@stmt]
) -> @method {
// Create the `e` parameter.
let e_arg_type = build::mk_ty_rptr(

View file

@ -64,7 +64,7 @@ fn create_derived_iter_bytes_impl(cx: @ext_ctxt,
// signature of the `iter_bytes` method.
fn create_iter_bytes_method(cx: @ext_ctxt,
span: span,
+statements: ~[@stmt])
statements: ~[@stmt])
-> @method {
// Create the `lsb0` parameter.
let bool_ident = cx.ident_of(~"bool");

View file

@ -142,7 +142,7 @@ pub fn expand_deriving(cx: @ext_ctxt,
result
}
fn create_impl_item(cx: @ext_ctxt, span: span, +item: item_) -> @item {
fn create_impl_item(cx: @ext_ctxt, span: span, item: item_) -> @item {
let doc_attr = respan(span,
ast::lit_str(@~"Automatically derived."));
let doc_attr = respan(span, ast::meta_name_value(@~"doc", doc_attr));

View file

@ -237,8 +237,8 @@ macro_rules! without_macro_scoping(
// Support for item-position macro invocations, exactly the same
// logic as for expression-position macro invocations.
pub fn expand_item_mac(+extsbox: @mut SyntaxEnv,
cx: @ext_ctxt, &&it: @ast::item,
pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
cx: @ext_ctxt, it: @ast::item,
fld: @ast_fold)
-> Option<@ast::item> {
let (pth, tts) = match it.node {

View file

@ -34,7 +34,7 @@ mod syntax {
pub use parse;
}
pub fn path(+ids: ~[ident], span: span) -> @ast::Path {
pub fn path(ids: ~[ident], span: span) -> @ast::Path {
@ast::Path { span: span,
global: false,
idents: ids,
@ -42,7 +42,7 @@ pub fn path(+ids: ~[ident], span: span) -> @ast::Path {
types: ~[] }
}
pub fn path_global(+ids: ~[ident], span: span) -> @ast::Path {
pub fn path_global(ids: ~[ident], span: span) -> @ast::Path {
@ast::Path { span: span,
global: true,
idents: ids,
@ -52,7 +52,7 @@ pub fn path_global(+ids: ~[ident], span: span) -> @ast::Path {
pub trait append_types {
fn add_ty(&self, ty: @ast::Ty) -> @ast::Path;
fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path;
fn add_tys(&self, tys: ~[@ast::Ty]) -> @ast::Path;
}
impl append_types for @ast::Path {
@ -63,7 +63,7 @@ impl append_types for @ast::Path {
}
}
fn add_tys(&self, +tys: ~[@ast::Ty]) -> @ast::Path {
fn add_tys(&self, tys: ~[@ast::Ty]) -> @ast::Path {
@ast::Path {
types: vec::append(copy self.types, tys),
.. copy **self
@ -76,63 +76,63 @@ pub trait ext_ctxt_ast_builder {
-> ast::TyParam;
fn arg(&self, name: ident, ty: @ast::Ty) -> ast::arg;
fn expr_block(&self, e: @ast::expr) -> ast::blk;
fn fn_decl(&self, +inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl;
fn item(&self, name: ident, span: span, +node: ast::item_) -> @ast::item;
fn fn_decl(&self, inputs: ~[ast::arg], output: @ast::Ty) -> ast::fn_decl;
fn item(&self, name: ident, span: span, node: ast::item_) -> @ast::item;
fn item_fn_poly(&self,
ame: ident,
+inputs: ~[ast::arg],
inputs: ~[ast::arg],
output: @ast::Ty,
+generics: Generics,
+body: ast::blk) -> @ast::item;
generics: Generics,
body: ast::blk) -> @ast::item;
fn item_fn(&self,
name: ident,
+inputs: ~[ast::arg],
inputs: ~[ast::arg],
output: @ast::Ty,
+body: ast::blk) -> @ast::item;
body: ast::blk) -> @ast::item;
fn item_enum_poly(&self,
name: ident,
span: span,
+enum_definition: ast::enum_def,
+generics: Generics) -> @ast::item;
enum_definition: ast::enum_def,
generics: Generics) -> @ast::item;
fn item_enum(&self,
name: ident,
span: span,
+enum_definition: ast::enum_def) -> @ast::item;
enum_definition: ast::enum_def) -> @ast::item;
fn item_struct_poly(&self,
name: ident,
span: span,
+struct_def: ast::struct_def,
+generics: Generics) -> @ast::item;
struct_def: ast::struct_def,
generics: Generics) -> @ast::item;
fn item_struct(&self,
name: ident,
span: span,
+struct_def: ast::struct_def) -> @ast::item;
struct_def: ast::struct_def) -> @ast::item;
fn struct_expr(&self,
path: @ast::Path,
+fields: ~[ast::field]) -> @ast::expr;
fields: ~[ast::field]) -> @ast::expr;
fn variant(&self,
name: ident,
span: span,
+tys: ~[@ast::Ty]) -> ast::variant;
tys: ~[@ast::Ty]) -> ast::variant;
fn item_mod(&self,
name: ident,
span: span,
+items: ~[@ast::item]) -> @ast::item;
items: ~[@ast::item]) -> @ast::item;
fn ty_path_ast_builder(&self, path: @ast::Path) -> @ast::Ty;
fn item_ty_poly(&self,
name: ident,
span: span,
ty: @ast::Ty,
+generics: Generics) -> @ast::item;
generics: Generics) -> @ast::item;
fn item_ty(&self, name: ident, span: span, ty: @ast::Ty) -> @ast::item;
fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty];
fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty];
fn ty_field_imm(&self, name: ident, ty: @ast::Ty) -> ast::ty_field;
fn field_imm(&self, name: ident, e: @ast::expr) -> ast::field;
fn block(&self, +stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk;
fn block(&self, stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk;
fn stmt_let(&self, ident: ident, e: @ast::expr) -> @ast::stmt;
fn stmt_expr(&self, e: @ast::expr) -> @ast::stmt;
fn block_expr(&self, +b: ast::blk) -> @ast::expr;
fn block_expr(&self, b: ast::blk) -> @ast::expr;
fn ty_option(&self, ty: @ast::Ty) -> @ast::Ty;
fn ty_infer(&self) -> @ast::Ty;
fn ty_nil_ast_builder(&self) -> @ast::Ty;
@ -148,7 +148,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
], dummy_sp()).add_ty(ty))
}
fn block_expr(&self, +b: ast::blk) -> @ast::expr {
fn block_expr(&self, b: ast::blk) -> @ast::expr {
@expr {
id: self.next_id(),
callee_id: self.next_id(),
@ -215,7 +215,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
}
fn block(&self, +stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk {
fn block(&self, stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk {
let blk = ast::blk_ {
view_items: ~[],
stmts: stmts,
@ -231,7 +231,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
self.block(~[], e)
}
fn fn_decl(&self, +inputs: ~[ast::arg],
fn fn_decl(&self, inputs: ~[ast::arg],
output: @ast::Ty) -> ast::fn_decl {
ast::fn_decl {
inputs: inputs,
@ -241,7 +241,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item(&self, name: ident, span: span,
+node: ast::item_) -> @ast::item {
node: ast::item_) -> @ast::item {
// XXX: Would be nice if our generated code didn't violate
// Rust coding conventions
@ -265,10 +265,10 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item_fn_poly(&self, name: ident,
+inputs: ~[ast::arg],
inputs: ~[ast::arg],
output: @ast::Ty,
+generics: Generics,
+body: ast::blk) -> @ast::item {
generics: Generics,
body: ast::blk) -> @ast::item {
self.item(name,
dummy_sp(),
ast::item_fn(self.fn_decl(inputs, output),
@ -280,9 +280,9 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
fn item_fn(&self,
name: ident,
+inputs: ~[ast::arg],
inputs: ~[ast::arg],
output: @ast::Ty,
+body: ast::blk
body: ast::blk
) -> @ast::item {
self.item_fn_poly(
name,
@ -294,13 +294,13 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item_enum_poly(&self, name: ident, span: span,
+enum_definition: ast::enum_def,
+generics: Generics) -> @ast::item {
enum_definition: ast::enum_def,
generics: Generics) -> @ast::item {
self.item(name, span, ast::item_enum(enum_definition, generics))
}
fn item_enum(&self, name: ident, span: span,
+enum_definition: ast::enum_def) -> @ast::item {
enum_definition: ast::enum_def) -> @ast::item {
self.item_enum_poly(name, span, enum_definition,
ast_util::empty_generics())
}
@ -308,7 +308,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
fn item_struct(
&self, name: ident,
span: span,
+struct_def: ast::struct_def
struct_def: ast::struct_def
) -> @ast::item {
self.item_struct_poly(
name,
@ -322,14 +322,14 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
&self,
name: ident,
span: span,
+struct_def: ast::struct_def,
+generics: Generics
struct_def: ast::struct_def,
generics: Generics
) -> @ast::item {
self.item(name, span, ast::item_struct(@struct_def, generics))
}
fn struct_expr(&self, path: @ast::Path,
+fields: ~[ast::field]) -> @ast::expr {
fields: ~[ast::field]) -> @ast::expr {
@ast::expr {
id: self.next_id(),
callee_id: self.next_id(),
@ -339,7 +339,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn variant(&self, name: ident, span: span,
+tys: ~[@ast::Ty]) -> ast::variant {
tys: ~[@ast::Ty]) -> ast::variant {
let args = do tys.map |ty| {
ast::variant_arg { ty: *ty, id: self.next_id() }
};
@ -358,7 +358,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item_mod(&self, name: ident, span: span,
+items: ~[@ast::item]) -> @ast::item {
items: ~[@ast::item]) -> @ast::item {
// XXX: Total hack: import `core::kinds::Owned` to work around a
// parser bug whereby `fn f<T:::kinds::Owned>` doesn't parse.
@ -425,7 +425,7 @@ impl ext_ctxt_ast_builder for @ext_ctxt {
}
fn item_ty_poly(&self, name: ident, span: span, ty: @ast::Ty,
+generics: Generics) -> @ast::item {
generics: Generics) -> @ast::item {
self.item(name, span, ast::item_ty(ty, generics))
}

View file

@ -19,13 +19,13 @@ use parse::token;
use core::prelude::*;
pub trait proto_parser {
fn parse_proto(&self, +id: ~str) -> protocol;
fn parse_proto(&self, id: ~str) -> protocol;
fn parse_state(&self, proto: protocol);
fn parse_message(&self, state: state);
}
impl proto_parser for parser::Parser {
fn parse_proto(&self, +id: ~str) -> protocol {
fn parse_proto(&self, id: ~str) -> protocol {
let proto = protocol(id, *self.span);
self.parse_seq_to_before_end(

View file

@ -81,8 +81,8 @@ pub struct state_ {
}
pub impl state_ {
fn add_message(@self, +name: ~str, span: span,
+data: ~[@ast::Ty], +next: Option<next_state>) {
fn add_message(@self, name: ~str, span: span,
data: ~[@ast::Ty], next: Option<next_state>) {
self.messages.push(message(name, span, data, self,
next));
}
@ -119,11 +119,11 @@ pub impl state_ {
pub type protocol = @mut protocol_;
pub fn protocol(+name: ~str, +span: span) -> protocol {
pub fn protocol(name: ~str, span: span) -> protocol {
@mut protocol_(name, span)
}
pub fn protocol_(+name: ~str, span: span) -> protocol_ {
pub fn protocol_(name: ~str, span: span) -> protocol_ {
protocol_ {
name: name,
span: span,
@ -177,10 +177,10 @@ pub impl protocol_ {
pub impl protocol_ {
fn add_state_poly(@mut self,
+name: ~str,
name: ~str,
ident: ast::ident,
dir: direction,
+generics: ast::Generics)
generics: ast::Generics)
-> state {
let messages = @mut ~[];
let states = &*self.states;

View file

@ -419,7 +419,7 @@ fn ids_ext(cx: @ext_ctxt, strs: ~[~str]) -> ~[ast::ident] {
strs.map(|str| cx.parse_sess().interner.intern(@copy *str))
}
fn id_ext(cx: @ext_ctxt, +str: ~str) -> ast::ident {
fn id_ext(cx: @ext_ctxt, str: ~str) -> ast::ident {
cx.parse_sess().interner.intern(@str)
}
@ -734,8 +734,8 @@ fn expand_tts(cx: @ext_ctxt,
fn expand_parse_call(cx: @ext_ctxt,
sp: span,
+parse_method: ~str,
+arg_exprs: ~[@ast::expr],
parse_method: ~str,
arg_exprs: ~[@ast::expr],
tts: &[ast::token_tree]) -> @ast::expr {
let tts_expr = expand_tts(cx, sp, tts);

View file

@ -98,9 +98,9 @@ pub enum matcher_pos_up { /* to break a circularity */
matcher_pos_up(Option<~MatcherPos>)
}
pub fn is_some(&&mpu: matcher_pos_up) -> bool {
match &mpu {
&matcher_pos_up(None) => false,
pub fn is_some(mpu: &matcher_pos_up) -> bool {
match *mpu {
matcher_pos_up(None) => false,
_ => true
}
}
@ -115,9 +115,9 @@ pub struct MatcherPos {
sp_lo: BytePos,
}
pub fn copy_up(&& mpu: matcher_pos_up) -> ~MatcherPos {
match &mpu {
&matcher_pos_up(Some(ref mp)) => copy (*mp),
pub fn copy_up(mpu: &matcher_pos_up) -> ~MatcherPos {
match *mpu {
matcher_pos_up(Some(ref mp)) => copy (*mp),
_ => fail!()
}
}
@ -132,7 +132,7 @@ pub fn count_names(ms: &[matcher]) -> uint {
}
#[allow(non_implicitly_copyable_typarams)]
pub fn initial_matcher_pos(+ms: ~[matcher], +sep: Option<Token>, lo: BytePos)
pub fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos)
-> ~MatcherPos {
let mut match_idx_hi = 0u;
for ms.each |elt| {
@ -220,7 +220,7 @@ pub enum parse_result {
pub fn parse_or_else(
sess: @mut ParseSess,
+cfg: ast::crate_cfg,
cfg: ast::crate_cfg,
rdr: @reader,
ms: ~[matcher]
) -> HashMap<ident, @named_match> {
@ -257,7 +257,7 @@ pub fn parse(
/* at end of sequence */
if idx >= len {
// can't move out of `match`es, so:
if is_some(ei.up) {
if is_some(&ei.up) {
// hack: a matcher sequence is repeating iff it has a
// parent (the top level is just a container)
@ -267,7 +267,7 @@ pub fn parse(
if idx == len {
// pop from the matcher position
let mut new_pos = copy_up(ei.up);
let mut new_pos = copy_up(&ei.up);
// update matches (the MBE "parse tree") by appending
// each tree as a subtree.
@ -394,7 +394,7 @@ pub fn parse(
match ei.elts[ei.idx].node {
match_nonterminal(_, name, idx) => {
ei.matches[idx].push(@matched_nonterminal(
parse_nt(rust_parser, *sess.interner.get(name))));
parse_nt(&rust_parser, *sess.interner.get(name))));
ei.idx += 1u;
}
_ => fail!()
@ -411,7 +411,7 @@ pub fn parse(
}
}
pub fn parse_nt(p: Parser, name: ~str) -> nonterminal {
pub fn parse_nt(p: &Parser, name: ~str) -> nonterminal {
match name {
~"item" => match p.parse_item(~[]) {
Some(i) => token::nt_item(i),

View file

@ -53,7 +53,7 @@ pub struct TtReader {
pub fn new_tt_reader(sp_diag: @span_handler,
itr: @ident_interner,
interp: Option<HashMap<ident,@named_match>>,
+src: ~[ast::token_tree])
src: ~[ast::token_tree])
-> @mut TtReader {
let r = @mut TtReader {
sp_diag: sp_diag,
@ -109,7 +109,7 @@ pub fn dup_tt_reader(r: @mut TtReader) -> @mut TtReader {
fn lookup_cur_matched_by_matched(r: &mut TtReader,
start: @named_match)
-> @named_match {
fn red(+ad: @named_match, idx: &uint) -> @named_match {
fn red(ad: @named_match, idx: &uint) -> @named_match {
match *ad {
matched_nonterminal(_) => {
// end of the line; duplicate henceforth

View file

@ -27,11 +27,11 @@ pub enum OptVec<T> {
Vec(~[T])
}
pub fn with<T>(+t: T) -> OptVec<T> {
pub fn with<T>(t: T) -> OptVec<T> {
Vec(~[t])
}
pub fn from<T>(+t: ~[T]) -> OptVec<T> {
pub fn from<T>(t: ~[T]) -> OptVec<T> {
if t.len() == 0 {
Empty
} else {
@ -40,7 +40,7 @@ pub fn from<T>(+t: ~[T]) -> OptVec<T> {
}
impl<T> OptVec<T> {
fn push(&mut self, +t: T) {
fn push(&mut self, t: T) {
match *self {
Vec(ref mut v) => {
v.push(t);
@ -91,7 +91,7 @@ impl<T> OptVec<T> {
}
}
pub fn take_vec<T>(+v: OptVec<T>) -> ~[T] {
pub fn take_vec<T>(v: OptVec<T>) -> ~[T] {
match v {
Empty => ~[],
Vec(v) => v
@ -99,7 +99,7 @@ pub fn take_vec<T>(+v: OptVec<T>) -> ~[T] {
}
impl<T:Copy> OptVec<T> {
fn prepend(&self, +t: T) -> OptVec<T> {
fn prepend(&self, t: T) -> OptVec<T> {
let mut v0 = ~[t];
match *self {
Empty => {}
@ -157,7 +157,7 @@ impl<A> BaseIter<A> for OptVec<A> {
impl<A> iter::ExtendedIter<A> for OptVec<A> {
#[inline(always)]
fn eachi(&self, blk: &fn(+v: uint, v: &A) -> bool) {
fn eachi(&self, blk: &fn(v: uint, v: &A) -> bool) {
iter::eachi(self, blk)
}
#[inline(always)]
@ -169,7 +169,7 @@ impl<A> iter::ExtendedIter<A> for OptVec<A> {
iter::any(self, blk)
}
#[inline(always)]
fn foldl<B>(&self, +b0: B, blk: &fn(&B, &A) -> B) -> B {
fn foldl<B>(&self, b0: B, blk: &fn(&B, &A) -> B) -> B {
iter::foldl(self, b0, blk)
}
#[inline(always)]

Some files were not shown because too many files have changed in this diff Show more