Skip to content

Commit 852619d

Browse files
committed
Remove ++ mode from the compiler (it is parsed as + mode)
and obsolete `-` mode altogether (it *was* parsed as `+` mode).
1 parent efc7f82 commit 852619d

Some content is hidden

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

57 files changed

+89
-144
lines changed

src/libcore/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod rusti {
1212
#[abi = "rust-intrinsic"]
1313
#[link_name = "rusti"]
1414
pub extern {
15-
fn forget<T>(-x: T);
15+
fn forget<T>(+x: T);
1616
fn reinterpret_cast<T, U>(&&e: T) -> U;
1717
}
1818
}

src/libcore/unstable/intrinsics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ pub extern {
3434

3535
pub fn size_of<T>() -> uint;
3636

37-
pub fn move_val<T>(dst: &mut T, -src: T);
38-
pub fn move_val_init<T>(dst: &mut T, -src: T);
37+
pub fn move_val<T>(dst: &mut T, +src: T);
38+
pub fn move_val_init<T>(dst: &mut T, +src: T);
3939

4040
pub fn min_align_of<T>() -> uint;
4141
pub fn pref_align_of<T>() -> uint;

src/librustc/back/link.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
486486

487487
// This calculates CMH as defined above
488488
fn crate_meta_extras_hash(symbol_hasher: &hash::State,
489-
-cmh_items: ~[@ast::meta_item],
489+
+cmh_items: ~[@ast::meta_item],
490490
dep_hashes: ~[~str]) -> @str {
491491
fn len_and_str(s: &str) -> ~str {
492492
fmt!("%u_%s", s.len(), s)
@@ -535,7 +535,7 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
535535
name, default));
536536
}
537537

538-
fn crate_meta_name(sess: Session, output: &Path, -opt_name: Option<@str>)
538+
fn crate_meta_name(sess: Session, output: &Path, +opt_name: Option<@str>)
539539
-> @str {
540540
return match opt_name {
541541
Some(v) => v,

src/librustc/driver/driver.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ pub fn pretty_print_input(sess: Session, +cfg: ast::crate_cfg, input: input,
440440
}
441441
}
442442
443-
pub fn get_os(triple: ~str) -> Option<session::os> {
443+
pub fn get_os(triple: &str) -> Option<session::os> {
444444
if str::contains(triple, ~"win32") ||
445445
str::contains(triple, ~"mingw32") {
446446
Some(session::os_win32)
@@ -455,7 +455,7 @@ pub fn get_os(triple: ~str) -> Option<session::os> {
455455
} else { None }
456456
}
457457

458-
pub fn get_arch(triple: ~str) -> Option<session::arch> {
458+
pub fn get_arch(triple: &str) -> Option<session::arch> {
459459
if str::contains(triple, ~"i386") ||
460460
str::contains(triple, ~"i486") ||
461461
str::contains(triple, ~"i586") ||

src/librustc/metadata/creader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ fn metas_with_ident(ident: @~str, +metas: ~[@ast::meta_item])
222222
metas_with(ident, @~"name", metas)
223223
}
224224

225-
fn existing_match(e: @mut Env, metas: ~[@ast::meta_item], hash: @~str)
225+
fn existing_match(e: @mut Env, metas: &[@ast::meta_item], hash: @~str)
226226
-> Option<int> {
227227
for e.crate_cache.each |c| {
228228
if loader::metadata_matches(*c.metas, metas)

src/librustc/metadata/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ pub fn maybe_get_item_ast(intr: @ident_interner, cdata: cmd, tcx: ty::ctxt,
560560
let item_path = item_path(intr, item_doc);
561561
vec::from_slice(item_path.init())
562562
};
563-
match decode_inlined_item(cdata, tcx, path, item_doc) {
563+
match decode_inlined_item(cdata, tcx, copy path, item_doc) {
564564
Some(ref ii) => csearch::found((/*bad*/copy *ii)),
565565
None => {
566566
match item_parent_item(item_doc) {

src/librustc/metadata/loader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn crate_matches(crate_data: @~[u8],
176176
metadata_matches(linkage_metas, metas)
177177
}
178178
179-
pub fn metadata_matches(extern_metas: ~[@ast::meta_item],
179+
pub fn metadata_matches(extern_metas: &[@ast::meta_item],
180180
local_metas: &[@ast::meta_item]) -> bool {
181181
182182
debug!("matching %u metadata requirements against %u items",

src/librustc/metadata/tydecode.rs

-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ fn parse_mode(st: @mut PState) -> ast::mode {
427427
let m = ast::expl(match next(st) {
428428
'+' => ast::by_copy,
429429
'=' => ast::by_ref,
430-
'#' => ast::by_val,
431430
_ => fail!(~"bad mode")
432431
});
433432
return m;

src/librustc/metadata/tyencode.rs

-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ pub fn enc_mode(w: io::Writer, cx: @ctxt, m: mode) {
342342
match ty::resolved_mode(cx.tcx, m) {
343343
by_copy => w.write_char('+'),
344344
by_ref => w.write_char('='),
345-
by_val => w.write_char('#')
346345
}
347346
}
348347

src/librustc/middle/astencode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn encode_inlined_item(ecx: @e::EncodeContext,
105105
pub fn decode_inlined_item(cdata: @cstore::crate_metadata,
106106
tcx: ty::ctxt,
107107
maps: Maps,
108-
path: ast_map::path,
108+
+path: ast_map::path,
109109
par_doc: ebml::Doc)
110110
-> Option<ast::inlined_item> {
111111
let dcx = @DecodeContext {

src/librustc/middle/borrowck/gather_loans.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ fn req_loans_in_expr(ex: @ast::expr,
156156
let arg_cmt = self.bccx.cat_expr(*arg);
157157
self.guarantee_valid(arg_cmt, m_imm, scope_r);
158158
}
159-
ast::by_val | ast::by_copy => {}
159+
ast::by_copy => {}
160160
}
161161
}
162162
visit::visit_expr(ex, self, vt);
@@ -172,7 +172,7 @@ fn req_loans_in_expr(ex: @ast::expr,
172172
let arg_cmt = self.bccx.cat_expr(*arg);
173173
self.guarantee_valid(arg_cmt, m_imm, scope_r);
174174
}
175-
ast::by_val | ast::by_copy => {}
175+
ast::by_copy => {}
176176
}
177177
}
178178

src/librustc/middle/lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {
765765
// deprecated and because its semantics have changed recently:
766766
for decl.inputs.eachi |i, arg| {
767767
match ty::resolved_mode(cx, arg.mode) {
768-
ast::by_val | ast::by_copy => {}
768+
ast::by_copy => {}
769769
ast::by_ref => {
770770
cx.sess.span_lint(
771771
foreign_mode, fn_id, fn_id, arg.ty.span,

src/librustc/middle/liveness.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ pub impl IrMaps {
427427
v.push(id);
428428
}
429429
Arg(_, _, by_ref) |
430-
Arg(_, _, by_val) | ImplicitRet => {
430+
ImplicitRet => {
431431
debug!("--but it is not owned");
432432
}
433433
}
@@ -1006,7 +1006,7 @@ pub impl Liveness {
10061006
// inputs passed by & mode should be considered live on exit:
10071007
for decl.inputs.each |arg| {
10081008
match ty::resolved_mode(self.tcx, arg.mode) {
1009-
by_val | by_ref => {
1009+
by_ref => {
10101010
// By val and by ref do not own, so register a
10111011
// read at the end. This will prevent us from
10121012
// moving out of such variables but also prevent

src/librustc/middle/mem_categorization.rs

-8
Original file line numberDiff line numberDiff line change
@@ -486,14 +486,6 @@ pub impl mem_categorization_ctxt {
486486
let lp = match ty::resolved_mode(self.tcx, mode) {
487487
ast::by_copy => Some(@lp_arg(vid)),
488488
ast::by_ref => None,
489-
ast::by_val => {
490-
// by-value is this hybrid mode where we have a
491-
// pointer but we do not own it. This is not
492-
// considered loanable because, for example, a by-ref
493-
// and and by-val argument might both actually contain
494-
// the same unique ptr.
495-
None
496-
}
497489
};
498490
@cmt_ {
499491
id:id,

src/librustc/middle/moves.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ pub impl VisitContext {
782782
*/
783783

784784
match arg_mode {
785-
by_val | by_ref => self.use_expr(arg_expr, Read, visitor),
785+
by_ref => self.use_expr(arg_expr, Read, visitor),
786786
by_copy => self.consume_expr(arg_expr, visitor)
787787
}
788788
}

src/librustc/middle/resolve.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ pub impl Resolver {
20212021
}
20222022
20232023
fn import_path_to_str(@mut self,
2024-
idents: ~[ident],
2024+
idents: &[ident],
20252025
subclass: ImportDirectiveSubclass)
20262026
-> @~str {
20272027
if idents.is_empty() {
@@ -2573,7 +2573,7 @@ pub impl Resolver {
25732573
/// Resolves the given module path from the given root `module_`.
25742574
fn resolve_module_path_from_root(@mut self,
25752575
module_: @mut Module,
2576-
module_path: ~[ident],
2576+
module_path: &[ident],
25772577
index: uint,
25782578
span: span,
25792579
mut name_search_type: NameSearchType)
@@ -2658,7 +2658,7 @@ pub impl Resolver {
26582658
/// rooted at the given module.
26592659
fn resolve_module_path_for_import(@mut self,
26602660
module_: @mut Module,
2661-
module_path: ~[ident],
2661+
module_path: &[ident],
26622662
use_lexical_scope: UseLexicalScopeFlag,
26632663
span: span)
26642664
-> ResolveResult<@mut Module> {
@@ -2944,7 +2944,7 @@ pub impl Resolver {
29442944
*/
29452945
fn resolve_module_prefix(@mut self,
29462946
module_: @mut Module,
2947-
module_path: ~[ident])
2947+
module_path: &[ident])
29482948
-> ResolveResult<ModulePrefixResult> {
29492949
let interner = self.session.parse_sess.interner;
29502950

@@ -3876,7 +3876,7 @@ pub impl Resolver {
38763876
generics: &Generics,
38773877
opt_trait_reference: Option<@trait_ref>,
38783878
self_type: @Ty,
3879-
methods: ~[@method],
3879+
methods: &[@method],
38803880
visitor: ResolveVisitor) {
38813881
// If applicable, create a rib for the type parameters.
38823882
let outer_type_parameter_count = generics.ty_params.len();

src/librustc/middle/trans/_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ pub fn enter_rec_or_struct(bcx: block,
599599
dm: DefMap,
600600
m: &[@Match/&r],
601601
col: uint,
602-
fields: ~[ast::ident],
602+
fields: &[ast::ident],
603603
val: ValueRef)
604604
-> ~[@Match/&r] {
605605
debug!("enter_rec_or_struct(bcx=%s, m=%s, col=%u, val=%?)",

src/librustc/middle/trans/base.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1682,12 +1682,6 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
16821682

16831683
add_clean(bcx, llarg, arg_ty.ty);
16841684
}
1685-
ast::by_val => {
1686-
// always by value, also not owned, so don't add a cleanup:
1687-
let alloc = alloc_ty(bcx, arg_ty.ty);
1688-
Store(bcx, raw_llarg, alloc);
1689-
llarg = alloc;
1690-
}
16911685
}
16921686

16931687
bcx = _match::bind_irrefutable_pat(bcx,
@@ -1812,7 +1806,7 @@ pub fn trans_fn(ccx: @CrateContext,
18121806
debug!("trans_fn(ty_self=%?)", ty_self);
18131807
let _icx = ccx.insn_ctxt("trans_fn");
18141808
ccx.stats.n_fns += 1;
1815-
let the_path_str = path_str(ccx.sess, &path);
1809+
let the_path_str = path_str(ccx.sess, path);
18161810
trans_closure(ccx, path, decl, body, llfndecl, ty_self,
18171811
param_substs, id, impl_id,
18181812
|fcx| {

src/librustc/middle/trans/callee.rs

-8
Original file line numberDiff line numberDiff line change
@@ -720,14 +720,6 @@ pub fn trans_arg_expr(bcx: block,
720720
val = arg_datum.to_ref_llval(bcx);
721721
}
722722

723-
ast::by_val => {
724-
// NB: avoid running the take glue.
725-
726-
fail_unless!(!bcx.ccx().maps.moves_map.contains_key(
727-
&arg_expr.id));
728-
val = arg_datum.to_value_llval(bcx);
729-
}
730-
731723
ast::by_copy => {
732724
debug!("by copy arg with type %s, storing to scratch",
733725
bcx.ty_to_str(arg_datum.ty));

src/librustc/middle/trans/common.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use core::vec::raw::to_ptr;
5454
use core::vec;
5555
use std::oldmap::{HashMap, Set};
5656
use syntax::ast::ident;
57-
use syntax::ast_map::path;
57+
use syntax::ast_map::{path, path_elt};
5858
use syntax::codemap::span;
5959
use syntax::parse::token::ident_interner;
6060
use syntax::{ast, ast_map};
@@ -590,7 +590,7 @@ pub struct block_ {
590590
fcx: fn_ctxt
591591
}
592592

593-
pub fn block_(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind,
593+
pub fn block_(llbb: BasicBlockRef, parent: Option<block>, +kind: block_kind,
594594
is_lpad: bool, node_info: Option<NodeInfo>, fcx: fn_ctxt)
595595
-> block_ {
596596

@@ -608,7 +608,7 @@ pub fn block_(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind,
608608

609609
pub type block = @mut block_;
610610

611-
pub fn mk_block(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind,
611+
pub fn mk_block(llbb: BasicBlockRef, parent: Option<block>, +kind: block_kind,
612612
is_lpad: bool, node_info: Option<NodeInfo>, fcx: fn_ctxt)
613613
-> block {
614614
@mut block_(llbb, parent, kind, is_lpad, node_info, fcx)
@@ -1320,9 +1320,9 @@ pub fn align_to(cx: block, off: ValueRef, align: ValueRef) -> ValueRef {
13201320
return build::And(cx, bumped, build::Not(cx, mask));
13211321
}
13221322
1323-
pub fn path_str(sess: session::Session, p: &path) -> ~str {
1323+
pub fn path_str(sess: session::Session, p: &[path_elt]) -> ~str {
13241324
let mut r = ~"", first = true;
1325-
for vec::each(*p) |e| {
1325+
for p.each |e| {
13261326
match *e {
13271327
ast_map::path_name(s) | ast_map::path_mod(s) => {
13281328
if first { first = false; }

src/librustc/middle/trans/controlflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub fn trans_log(log_ex: @ast::expr,
192192
bcx.fcx.path.filtered(|e|
193193
match *e { path_mod(_) => true, _ => false }
194194
));
195-
let modname = path_str(ccx.sess, &modpath);
195+
let modname = path_str(ccx.sess, modpath);
196196

197197
let global = if ccx.module_data.contains_key(&modname) {
198198
ccx.module_data.get(&modname)

src/librustc/middle/trans/meth.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ be generated once they are invoked with specific type parameters,
4444
see `trans::base::lval_static_fn()` or `trans::base::monomorphic_fn()`.
4545
*/
4646
pub fn trans_impl(ccx: @CrateContext, +path: path, name: ast::ident,
47-
methods: ~[@ast::method], generics: &ast::Generics,
47+
methods: &[@ast::method], generics: &ast::Generics,
4848
self_ty: Option<ty::t>, id: ast::node_id) {
4949
let _icx = ccx.insn_ctxt("impl::trans_impl");
5050
if !generics.ty_params.is_empty() { return; }

src/librustc/middle/trans/reflect.rs

-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ pub impl Reflector {
313313
ast::infer(_) => 0u,
314314
ast::expl(e) => match e {
315315
ast::by_ref => 1u,
316-
ast::by_val => 2u,
317316
ast::by_copy => 5u
318317
}
319318
};

src/librustc/middle/trans/type_of.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use syntax::ast;
2323

2424
pub fn arg_is_indirect(ccx: @CrateContext, arg: &ty::arg) -> bool {
2525
match ty::resolved_mode(ccx.tcx, arg.mode) {
26-
ast::by_val => false,
2726
ast::by_copy => !ty::type_is_immediate(arg.ty),
2827
ast::by_ref => true
2928
}

src/librustc/middle/trans/type_use.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
8181
ty::ty_closure(ty::ClosureTy {sig: ref sig, _}) => {
8282
for vec::each(sig.inputs) |arg| {
8383
match ty::resolved_mode(ccx.tcx, arg.mode) {
84-
by_val | by_copy => {
84+
by_copy => {
8585
type_needs(cx, use_repr, arg.ty);
8686
}
8787
by_ref => {}
@@ -326,7 +326,7 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
326326
ty::ty_fn_args(ty::node_id_to_type(cx.ccx.tcx, f.id))
327327
) |a| {
328328
match a.mode {
329-
expl(by_copy) | expl(by_val) => {
329+
expl(by_copy) => {
330330
type_needs(cx, use_repr, a.ty);
331331
}
332332
_ => ()
@@ -340,7 +340,7 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
340340
for ty::ty_fn_args(ty::node_id_to_type(cx.ccx.tcx,
341341
e.callee_id)).each |a| {
342342
match a.mode {
343-
expl(by_copy) | expl(by_val) => {
343+
expl(by_copy) => {
344344
type_needs(cx, use_repr, a.ty);
345345
}
346346
_ => ()

src/librustc/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ pub fn default_arg_mode_for_ty(tcx: ctxt, ty: ty::t) -> ast::rmode {
11101110
// forward-compatible with non-legacy, we should use +
11111111
ast::by_copy
11121112
} else if ty::type_is_immediate(ty) {
1113-
ast::by_val
1113+
ast::by_copy
11141114
} else {
11151115
ast::by_ref
11161116
}

src/librustc/middle/typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3207,7 +3207,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
32073207
let (_, visitor_trait) = tcx.intrinsic_defs.get(&ty_visitor_name);
32083208
let td_ptr = ty::mk_ptr(ccx.tcx, ty::mt {ty: tydesc_ty,
32093209
mutbl: ast::m_imm});
3210-
(0u, ~[arg(ast::by_val, td_ptr),
3210+
(0u, ~[arg(ast::by_copy, td_ptr),
32113211
arg(ast::by_ref, visitor_trait)], ty::mk_nil(tcx))
32123212
}
32133213
~"frame_address" => {
@@ -3217,7 +3217,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
32173217
onceness: ast::Once,
32183218
region: ty::re_bound(ty::br_anon(0)),
32193219
sig: ty::FnSig {
3220-
inputs: ~[arg {mode: ast::expl(ast::by_val),
3220+
inputs: ~[arg {mode: ast::expl(ast::by_copy),
32213221
ty: ty::mk_imm_ptr(
32223222
ccx.tcx,
32233223
ty::mk_mach_uint(ccx.tcx, ast::ty_u8))}],

0 commit comments

Comments
 (0)