Skip to content

Commit 1e4a439

Browse files
committed
rustc: de-mode + fallout from libsyntax changes
1 parent 3c7aea3 commit 1e4a439

Some content is hidden

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

64 files changed

+547
-553
lines changed

src/librustc/back/link.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub enum output_type {
4848
output_type_exe,
4949
}
5050

51-
pub fn llvm_err(sess: Session, +msg: ~str) -> ! {
51+
pub fn llvm_err(sess: Session, msg: ~str) -> ! {
5252
unsafe {
5353
let cstr = llvm::LLVMRustGetLastError();
5454
if cstr == ptr::null() {
@@ -153,7 +153,7 @@ pub mod jit {
153153
code: entry,
154154
env: ptr::null()
155155
};
156-
let func: &fn(++argv: ~[@~str]) = cast::transmute(closure);
156+
let func: &fn(argv: ~[@~str]) = cast::transmute(closure);
157157

158158
func(~[sess.opts.binary]);
159159
}
@@ -519,7 +519,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
519519
520520
// This calculates CMH as defined above
521521
fn crate_meta_extras_hash(symbol_hasher: &hash::State,
522-
+cmh_items: ~[@ast::meta_item],
522+
cmh_items: ~[@ast::meta_item],
523523
dep_hashes: ~[~str]) -> @str {
524524
fn len_and_str(s: &str) -> ~str {
525525
fmt!("%u_%s", s.len(), s)
@@ -568,7 +568,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
568568
name, default));
569569
}
570570
571-
fn crate_meta_name(sess: Session, output: &Path, +opt_name: Option<@str>)
571+
fn crate_meta_name(sess: Session, output: &Path, opt_name: Option<@str>)
572572
-> @str {
573573
return match opt_name {
574574
Some(v) => v,
@@ -703,7 +703,7 @@ pub fn mangle(sess: Session, ss: path) -> ~str {
703703
}
704704
705705
pub fn exported_name(sess: Session,
706-
+path: path,
706+
path: path,
707707
hash: &str,
708708
vers: &str) -> ~str {
709709
return mangle(sess,
@@ -713,7 +713,7 @@ pub fn exported_name(sess: Session,
713713
}
714714
715715
pub fn mangle_exported_name(ccx: @CrateContext,
716-
+path: path,
716+
path: path,
717717
t: ty::t) -> ~str {
718718
let hash = get_symbol_hash(ccx, t);
719719
return exported_name(ccx.sess, path,
@@ -733,17 +733,17 @@ pub fn mangle_internal_name_by_type_only(ccx: @CrateContext,
733733
}
734734
735735
pub fn mangle_internal_name_by_path_and_seq(ccx: @CrateContext,
736-
+path: path,
737-
+flav: ~str) -> ~str {
736+
path: path,
737+
flav: ~str) -> ~str {
738738
return mangle(ccx.sess,
739739
vec::append_one(path, path_name((ccx.names)(flav))));
740740
}
741741
742-
pub fn mangle_internal_name_by_path(ccx: @CrateContext, +path: path) -> ~str {
742+
pub fn mangle_internal_name_by_path(ccx: @CrateContext, path: path) -> ~str {
743743
return mangle(ccx.sess, path);
744744
}
745745
746-
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, +flav: ~str) -> ~str {
746+
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, flav: ~str) -> ~str {
747747
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
748748
}
749749
@@ -768,7 +768,7 @@ pub fn link_binary(sess: Session,
768768
out_filename: &Path,
769769
lm: LinkMeta) {
770770
// Converts a library file-stem into a cc -l argument
771-
fn unlib(config: @session::config, +stem: ~str) -> ~str {
771+
fn unlib(config: @session::config, stem: ~str) -> ~str {
772772
if stem.starts_with("lib") &&
773773
config.os != session::os_win32 {
774774
stem.slice(3, stem.len()).to_owned()

src/librustc/driver/driver.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ pub enum pp_mode {
5555
*/
5656
pub fn anon_src() -> ~str { ~"<anon>" }
5757
58-
pub fn source_name(input: input) -> ~str {
59-
match input {
58+
pub fn source_name(input: &input) -> ~str {
59+
match *input {
6060
file_input(ref ifile) => ifile.to_str(),
6161
str_input(_) => anon_src()
6262
}
6363
}
6464
65-
pub fn default_configuration(sess: Session, argv0: @~str, input: input) ->
65+
pub fn default_configuration(sess: Session, argv0: @~str, input: &input) ->
6666
ast::crate_cfg {
6767
let libc = match sess.targ_cfg.os {
6868
session::os_win32 => ~"msvcrt.dll",
@@ -105,7 +105,7 @@ pub fn default_configuration(sess: Session, argv0: @~str, input: input) ->
105105
mk(@~"build_input", @source_name(input))];
106106
}
107107

108-
pub fn append_configuration(+cfg: ast::crate_cfg, +name: ~str)
108+
pub fn append_configuration(cfg: ast::crate_cfg, name: ~str)
109109
-> ast::crate_cfg {
110110
if attr::contains_name(cfg, name) {
111111
cfg
@@ -114,7 +114,7 @@ pub fn append_configuration(+cfg: ast::crate_cfg, +name: ~str)
114114
}
115115
}
116116

117-
pub fn build_configuration(sess: Session, argv0: @~str, input: input) ->
117+
pub fn build_configuration(sess: Session, argv0: @~str, input: &input) ->
118118
ast::crate_cfg {
119119
// Combine the configuration requested by the session (command line) with
120120
// some default and generated configuration items
@@ -132,7 +132,7 @@ pub fn build_configuration(sess: Session, argv0: @~str, input: input) ->
132132
}
133133

134134
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
135-
fn parse_cfgspecs(+cfgspecs: ~[~str],
135+
fn parse_cfgspecs(cfgspecs: ~[~str],
136136
demitter: diagnostic::Emitter) -> ast::crate_cfg {
137137
do vec::map_consume(cfgspecs) |s| {
138138
let sess = parse::new_parse_sess(Some(demitter));
@@ -147,9 +147,9 @@ pub enum input {
147147
str_input(~str)
148148
}
149149

150-
pub fn parse_input(sess: Session, +cfg: ast::crate_cfg, input: input)
150+
pub fn parse_input(sess: Session, cfg: ast::crate_cfg, input: &input)
151151
-> @ast::crate {
152-
match input {
152+
match *input {
153153
file_input(ref file) => {
154154
parse::parse_crate_from_file_using_tts(&(*file), cfg, sess.parse_sess)
155155
}
@@ -207,10 +207,10 @@ pub fn compile_rest(sess: Session,
207207
lint::build_settings_crate(sess, crate));
208208

209209
let ast_map = time(time_passes, ~"ast indexing", ||
210-
syntax::ast_map::map_crate(sess.diagnostic(), *crate));
210+
syntax::ast_map::map_crate(sess.diagnostic(), crate));
211211

212212
time(time_passes, ~"external crate/lib resolution", ||
213-
creader::read_crates(sess.diagnostic(), *crate, sess.cstore,
213+
creader::read_crates(sess.diagnostic(), crate, sess.cstore,
214214
sess.filesearch,
215215
session::sess_os_to_meta_os(sess.targ_cfg.os),
216216
sess.opts.is_static,
@@ -344,8 +344,8 @@ pub fn compile_rest(sess: Session,
344344
return (crate, None);
345345
}
346346

347-
pub fn compile_upto(sess: Session, +cfg: ast::crate_cfg,
348-
input: input, upto: compile_upto,
347+
pub fn compile_upto(sess: Session, cfg: ast::crate_cfg,
348+
input: &input, upto: compile_upto,
349349
outputs: Option<@OutputFilenames>)
350350
-> (@ast::crate, Option<ty::ctxt>) {
351351
let time_passes = sess.time_passes();
@@ -356,7 +356,7 @@ pub fn compile_upto(sess: Session, +cfg: ast::crate_cfg,
356356
compile_rest(sess, cfg, upto, outputs, Some(crate))
357357
}
358358

359-
pub fn compile_input(sess: Session, +cfg: ast::crate_cfg, input: input,
359+
pub fn compile_input(sess: Session, cfg: ast::crate_cfg, input: &input,
360360
outdir: &Option<Path>, output: &Option<Path>) {
361361
let upto = if sess.opts.parse_only { cu_parse }
362362
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,
365365
compile_upto(sess, cfg, input, upto, Some(outputs));
366366
}
367367

368-
pub fn pretty_print_input(sess: Session, +cfg: ast::crate_cfg, input: input,
368+
pub fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: &input,
369369
ppm: pp_mode) {
370370
fn ann_paren_for_expr(node: pprust::ann_node) {
371371
match node {
@@ -690,7 +690,7 @@ pub fn build_session_(sopts: @session::options,
690690
cm);
691691
let cstore = @mut cstore::mk_cstore(p_s.interner);
692692
let filesearch = filesearch::mk_filesearch(
693-
sopts.maybe_sysroot,
693+
&sopts.maybe_sysroot,
694694
sopts.target_triple,
695695
/*bad*/copy sopts.addl_lib_search_paths);
696696
let lint_settings = lint::mk_lint_settings();
@@ -711,13 +711,13 @@ pub fn build_session_(sopts: @session::options,
711711
}
712712
}
713713
714-
pub fn parse_pretty(sess: Session, &&name: ~str) -> pp_mode {
714+
pub fn parse_pretty(sess: Session, name: &str) -> pp_mode {
715715
match name {
716-
~"normal" => ppm_normal,
717-
~"expanded" => ppm_expanded,
718-
~"typed" => ppm_typed,
719-
~"expanded,identified" => ppm_expanded_identified,
720-
~"identified" => ppm_identified,
716+
&"normal" => ppm_normal,
717+
&"expanded" => ppm_expanded,
718+
&"typed" => ppm_typed,
719+
&"expanded,identified" => ppm_expanded_identified,
720+
&"identified" => ppm_identified,
721721
_ => {
722722
sess.fatal(~"argument to `pretty` must be one of `normal`, \
723723
`expanded`, `typed`, `identified`, \
@@ -790,7 +790,7 @@ pub struct OutputFilenames {
790790
obj_filename: Path
791791
}
792792

793-
pub fn build_output_filenames(input: input,
793+
pub fn build_output_filenames(input: &input,
794794
odir: &Option<Path>,
795795
ofile: &Option<Path>,
796796
sess: Session)
@@ -820,13 +820,13 @@ pub fn build_output_filenames(input: input,
820820
// We want to toss everything after the final '.'
821821
let dirpath = match *odir {
822822
Some(ref d) => (/*bad*/copy *d),
823-
None => match input {
823+
None => match *input {
824824
str_input(_) => os::getcwd(),
825825
file_input(ref ifile) => (*ifile).dir_path()
826826
}
827827
};
828828

829-
let stem = match input {
829+
let stem = match *input {
830830
file_input(ref ifile) => (*ifile).filestem().get(),
831831
str_input(_) => ~"rust_out"
832832
};
@@ -903,7 +903,7 @@ mod test {
903903
let sessopts = build_session_options(
904904
@~"rustc", matches, diagnostic::emit);
905905
let sess = build_session(sessopts, diagnostic::emit);
906-
let cfg = build_configuration(sess, @~"whatever", str_input(~""));
906+
let cfg = build_configuration(sess, @~"whatever", &str_input(~""));
907907
assert!((attr::contains_name(cfg, ~"test")));
908908
}
909909
@@ -922,7 +922,7 @@ mod test {
922922
let sessopts = build_session_options(
923923
@~"rustc", matches, diagnostic::emit);
924924
let sess = build_session(sessopts, diagnostic::emit);
925-
let cfg = build_configuration(sess, @~"whatever", str_input(~""));
925+
let cfg = build_configuration(sess, @~"whatever", &str_input(~""));
926926
let test_items = attr::find_meta_items_by_name(cfg, ~"test");
927927
assert!((vec::len(test_items) == 1u));
928928
}

src/librustc/driver/session.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ pub impl Session_ {
215215
fn unimpl(@self, msg: ~str) -> ! {
216216
self.span_diagnostic.handler().unimpl(msg)
217217
}
218-
fn span_lint_level(@self, level: lint::level, sp: span, +msg: ~str) {
218+
fn span_lint_level(@self, level: lint::level, sp: span, msg: ~str) {
219219
match level {
220220
lint::allow => { },
221221
lint::warn => self.span_warn(sp, msg),
@@ -228,7 +228,7 @@ pub impl Session_ {
228228
expr_id: ast::node_id,
229229
item_id: ast::node_id,
230230
span: span,
231-
+msg: ~str) {
231+
msg: ~str) {
232232
let level = lint::get_lint_settings_level(
233233
self.lint_settings, lint_mode, expr_id, item_id);
234234
self.span_lint_level(level, span, msg);
@@ -278,7 +278,7 @@ pub impl Session_ {
278278
fn str_of(@self, id: ast::ident) -> @~str {
279279
self.parse_sess.interner.get(id)
280280
}
281-
fn ident_of(@self, +st: ~str) -> ast::ident {
281+
fn ident_of(@self, st: ~str) -> ast::ident {
282282
self.parse_sess.interner.intern(@st)
283283
}
284284
fn intr(@self) -> @syntax::parse::token::ident_interner {
@@ -361,7 +361,7 @@ mod test {
361361
use syntax::ast;
362362
use syntax::codemap;
363363

364-
fn make_crate_type_attr(+t: ~str) -> ast::attribute {
364+
fn make_crate_type_attr(t: ~str) -> ast::attribute {
365365
codemap::respan(codemap::dummy_sp(), ast::attribute_ {
366366
style: ast::attr_outer,
367367
value: @codemap::respan(codemap::dummy_sp(),

src/librustc/front/config.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use syntax::{ast, fold, attr};
1515
use core::option;
1616
use core::vec;
1717

18-
type in_cfg_pred = @fn(+attrs: ~[ast::attribute]) -> bool;
18+
type in_cfg_pred = @fn(attrs: ~[ast::attribute]) -> bool;
1919

2020
struct Context {
2121
in_cfg: in_cfg_pred
@@ -49,12 +49,12 @@ pub fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
4949
return res;
5050
}
5151

52-
fn filter_item(cx: @Context, &&item: @ast::item) ->
52+
fn filter_item(cx: @Context, item: @ast::item) ->
5353
Option<@ast::item> {
5454
if item_in_cfg(cx, item) { option::Some(item) } else { option::None }
5555
}
5656

57-
fn filter_view_item(cx: @Context, &&view_item: @ast::view_item
57+
fn filter_view_item(cx: @Context, view_item: @ast::view_item
5858
)-> Option<@ast::view_item> {
5959
if view_item_in_cfg(cx, view_item) {
6060
option::Some(view_item)
@@ -74,7 +74,7 @@ fn fold_mod(cx: @Context, m: &ast::_mod, fld: @fold::ast_fold) -> ast::_mod {
7474
}
7575
}
7676

77-
fn filter_foreign_item(cx: @Context, &&item: @ast::foreign_item) ->
77+
fn filter_foreign_item(cx: @Context, item: @ast::foreign_item) ->
7878
Option<@ast::foreign_item> {
7979
if foreign_item_in_cfg(cx, item) {
8080
option::Some(item)
@@ -115,7 +115,7 @@ fn fold_item_underscore(cx: @Context, item: &ast::item_,
115115
fold::noop_fold_item_underscore(&item, fld)
116116
}
117117

118-
fn filter_stmt(cx: @Context, &&stmt: @ast::stmt) ->
118+
fn filter_stmt(cx: @Context, stmt: @ast::stmt) ->
119119
Option<@ast::stmt> {
120120
match stmt.node {
121121
ast::stmt_decl(decl, _) => {
@@ -173,12 +173,12 @@ fn trait_method_in_cfg(cx: @Context, meth: &ast::trait_method) -> bool {
173173

174174
// Determine if an item should be translated in the current crate
175175
// configuration based on the item's attributes
176-
fn in_cfg(+cfg: ast::crate_cfg, +attrs: ~[ast::attribute]) -> bool {
176+
fn in_cfg(cfg: ast::crate_cfg, attrs: ~[ast::attribute]) -> bool {
177177
metas_in_cfg(cfg, attr::attr_metas(attrs))
178178
}
179179

180180
pub fn metas_in_cfg(cfg: ast::crate_cfg,
181-
+metas: ~[@ast::meta_item]) -> bool {
181+
metas: ~[@ast::meta_item]) -> bool {
182182
// The "cfg" attributes on the item
183183
let cfg_metas = attr::find_meta_items_by_name(metas, ~"cfg");
184184

src/librustc/front/test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn fold_crate(cx: @mut TestCtxt,
138138
}
139139

140140

141-
fn fold_item(cx: @mut TestCtxt, &&i: @ast::item, fld: @fold::ast_fold)
141+
fn fold_item(cx: @mut TestCtxt, i: @ast::item, fld: @fold::ast_fold)
142142
-> Option<@ast::item> {
143143
cx.path.push(i.ident);
144144
debug!("current path: %s",
@@ -336,15 +336,15 @@ fn nospan<T:Copy>(t: T) -> codemap::spanned<T> {
336336
codemap::spanned { node: t, span: dummy_sp() }
337337
}
338338

339-
fn path_node(+ids: ~[ast::ident]) -> @ast::Path {
339+
fn path_node(ids: ~[ast::ident]) -> @ast::Path {
340340
@ast::Path { span: dummy_sp(),
341341
global: false,
342342
idents: ids,
343343
rp: None,
344344
types: ~[] }
345345
}
346346

347-
fn path_node_global(+ids: ~[ast::ident]) -> @ast::Path {
347+
fn path_node_global(ids: ~[ast::ident]) -> @ast::Path {
348348
@ast::Path { span: dummy_sp(),
349349
global: true,
350350
idents: ids,
@@ -381,7 +381,7 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::expr {
381381
debug!("building test vector from %u tests", cx.testfns.len());
382382
let mut descs = ~[];
383383
for cx.testfns.each |test| {
384-
descs.push(mk_test_desc_and_fn_rec(cx, *test));
384+
descs.push(mk_test_desc_and_fn_rec(cx, test));
385385
}
386386

387387
let sess = cx.sess;
@@ -400,7 +400,7 @@ fn mk_test_descs(cx: &TestCtxt) -> @ast::expr {
400400
}
401401
}
402402

403-
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: Test) -> @ast::expr {
403+
fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
404404
let span = test.span;
405405
let path = /*bad*/copy test.path;
406406

0 commit comments

Comments
 (0)