Skip to content

Commit 7f6b3fd

Browse files
committed
---
yaml --- r: 95581 b: refs/heads/dist-snap c: c979575 h: refs/heads/master i: 95579: b284fdb v: v3
1 parent 357cca4 commit 7f6b3fd

File tree

39 files changed

+549
-271
lines changed

39 files changed

+549
-271
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 78573149cbeb0d0b626d128a8950f1220ed551ad
9+
refs/heads/dist-snap: c97957588b7e26d32e7800072df4c31da56703ef
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/rust.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3395,23 +3395,16 @@ a [temporary](#lvalues-rvalues-and-temporaries), or a local variable.
33953395
A _local variable_ (or *stack-local* allocation) holds a value directly,
33963396
allocated within the stack's memory. The value is a part of the stack frame.
33973397

3398-
Local variables are immutable unless declared otherwise like: `let mut x = ...`.
3398+
Local variables are immutable unless declared with `let mut`. The
3399+
`mut` keyword applies to all local variables declared within that
3400+
declaration (so `let mut (x, y) = ...` declares two mutable variables, `x` and
3401+
`y`).
33993402

34003403
Function parameters are immutable unless declared with `mut`. The
34013404
`mut` keyword applies only to the following parameter (so `|mut x, y|`
34023405
and `fn f(mut x: ~int, y: ~int)` declare one mutable variable `x` and
34033406
one immutable variable `y`).
34043407

3405-
Methods that take either `self` or `~self` can optionally place them in a
3406-
mutable slot by prefixing them with `mut` (similar to regular arguments):
3407-
3408-
~~~
3409-
trait Changer {
3410-
fn change(mut self) -> Self;
3411-
fn modify(mut ~self) -> ~Self;
3412-
}
3413-
~~~
3414-
34153408
Local variables are not initialized when allocated; the entire frame worth of
34163409
local variables are allocated at once, on frame-entry, in an uninitialized
34173410
state. Subsequent statements within a function may or may not initialize the

branches/dist-snap/mk/tests.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ $(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)): \
370370
$$(SREQ$(1)_T_$(2)_H_$(3)) \
371371
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2)) \
372372
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2)) \
373+
$$(HBIN$(1)_H_$(3))/rustpkg$$(X_$(2)) \
373374
$$(TBIN$(1)_T_$(2)_H_$(3))/rustpkg$$(X_$(2)) \
374375
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(2))
375376
@$$(call E, compile_and_link: $$@)

branches/dist-snap/src/librustc/metadata/decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,9 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
975975
let explicit_self_kind = string[0];
976976
match explicit_self_kind as char {
977977
's' => { return ast::sty_static; }
978-
'v' => { return ast::sty_value(get_mutability(string[1])); }
978+
'v' => { return ast::sty_value; }
979979
'@' => { return ast::sty_box(get_mutability(string[1])); }
980-
'~' => { return ast::sty_uniq(get_mutability(string[1])); }
980+
'~' => { return ast::sty_uniq; }
981981
'&' => {
982982
// FIXME(#4846) expl. region
983983
return ast::sty_region(None, get_mutability(string[1]));

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,8 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::explic
662662
sty_static => {
663663
ebml_w.writer.write(&[ 's' as u8 ]);
664664
}
665-
sty_value(m) => {
665+
sty_value => {
666666
ebml_w.writer.write(&[ 'v' as u8 ]);
667-
encode_mutability(ebml_w, m);
668667
}
669668
sty_region(_, m) => {
670669
// FIXME(#4846) encode custom lifetime
@@ -675,9 +674,8 @@ fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::explic
675674
ebml_w.writer.write(&[ '@' as u8 ]);
676675
encode_mutability(ebml_w, m);
677676
}
678-
sty_uniq(m) => {
677+
sty_uniq => {
679678
ebml_w.writer.write(&[ '~' as u8 ]);
680-
encode_mutability(ebml_w, m);
681679
}
682680
}
683681

branches/dist-snap/src/librustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl tr for ast::Def {
410410
ast::DefMethod(did0.tr(xcx), did1.map(|did1| did1.tr(xcx)))
411411
}
412412
ast::DefSelfTy(nid) => { ast::DefSelfTy(xcx.tr_id(nid)) }
413-
ast::DefSelf(nid, m) => { ast::DefSelf(xcx.tr_id(nid), m) }
413+
ast::DefSelf(nid) => { ast::DefSelf(xcx.tr_id(nid)) }
414414
ast::DefMod(did) => { ast::DefMod(did.tr(xcx)) }
415415
ast::DefForeignMod(did) => { ast::DefForeignMod(did.tr(xcx)) }
416416
ast::DefStatic(did, m) => { ast::DefStatic(did.tr(xcx), m) }

branches/dist-snap/src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ fn visit_fn(v: &mut LivenessVisitor,
392392
match *fk {
393393
visit::fk_method(_, _, method) => {
394394
match method.explicit_self.node {
395-
sty_value(_) | sty_region(*) | sty_box(_) | sty_uniq(_) => {
395+
sty_value | sty_region(*) | sty_box(_) | sty_uniq => {
396396
fn_maps.add_variable(Arg(method.self_id,
397397
special_idents::self_));
398398
}

branches/dist-snap/src/librustc/middle/mem_categorization.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,12 @@ impl mem_categorization_ctxt {
488488
}
489489
}
490490

491-
ast::DefSelf(self_id, mutbl) => {
491+
ast::DefSelf(self_id) => {
492492
@cmt_ {
493493
id:id,
494494
span:span,
495495
cat:cat_self(self_id),
496-
mutbl: if mutbl { McDeclared } else { McImmutable },
496+
mutbl: McImmutable,
497497
ty:expr_ty
498498
}
499499
}

branches/dist-snap/src/librustc/middle/moves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ pub fn moved_variable_node_id_from_def(def: Def) -> Option<NodeId> {
227227
DefBinding(nid, _) |
228228
DefArg(nid, _) |
229229
DefLocal(nid, _) |
230-
DefSelf(nid, _) => Some(nid),
230+
DefSelf(nid) => Some(nid),
231231

232232
_ => None
233233
}

branches/dist-snap/src/librustc/middle/resolve.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ enum Mutability {
150150

151151
enum SelfBinding {
152152
NoSelfBinding,
153-
HasSelfBinding(NodeId, explicit_self)
153+
HasSelfBinding(NodeId)
154154
}
155155

156156
impl Visitor<()> for Resolver {
@@ -3799,12 +3799,8 @@ impl Resolver {
37993799
NoSelfBinding => {
38003800
// Nothing to do.
38013801
}
3802-
HasSelfBinding(self_node_id, explicit_self) => {
3803-
let mutable = match explicit_self.node {
3804-
sty_uniq(m) | sty_value(m) if m == MutMutable => true,
3805-
_ => false
3806-
};
3807-
let def_like = DlDef(DefSelf(self_node_id, mutable));
3802+
HasSelfBinding(self_node_id) => {
3803+
let def_like = DlDef(DefSelf(self_node_id));
38083804
*function_value_rib.self_binding = Some(def_like);
38093805
}
38103806
}
@@ -3941,7 +3937,7 @@ impl Resolver {
39413937
// we only have self ty if it is a non static method
39423938
let self_binding = match method.explicit_self.node {
39433939
sty_static => { NoSelfBinding }
3944-
_ => { HasSelfBinding(method.self_id, method.explicit_self) }
3940+
_ => { HasSelfBinding(method.self_id) }
39453941
};
39463942

39473943
self.resolve_function(rib_kind,

branches/dist-snap/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ pub fn trans_local_var(bcx: @mut Block, def: ast::Def) -> Datum {
10991099
ast::DefLocal(nid, _) | ast::DefBinding(nid, _) => {
11001100
take_local(bcx, bcx.fcx.lllocals, nid)
11011101
}
1102-
ast::DefSelf(nid, _) => {
1102+
ast::DefSelf(nid) => {
11031103
let self_info: ValSelfData = match bcx.fcx.llself {
11041104
Some(ref self_info) => *self_info,
11051105
None => {

branches/dist-snap/src/librustc/middle/trans/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn maybe_instantiate_inline(ccx: @mut CrateContext, fn_id: ast::DefId)
144144
debug!("calling inline trans_fn with self_ty {}",
145145
ty_to_str(ccx.tcx, self_ty));
146146
match mth.explicit_self.node {
147-
ast::sty_value(_) => impl_self(self_ty, ty::ByRef),
147+
ast::sty_value => impl_self(self_ty, ty::ByRef),
148148
_ => impl_self(self_ty, ty::ByCopy),
149149
}
150150
}

branches/dist-snap/src/librustc/middle/trans/meth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn trans_method(ccx: @mut CrateContext,
120120
debug!("calling trans_fn with self_ty {}",
121121
self_ty.repr(ccx.tcx));
122122
match method.explicit_self.node {
123-
ast::sty_value(_) => impl_self(self_ty, ty::ByRef),
123+
ast::sty_value => impl_self(self_ty, ty::ByRef),
124124
_ => impl_self(self_ty, ty::ByCopy),
125125
}
126126
}

branches/dist-snap/src/librustc/middle/typeck/astconv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ fn ty_of_method_or_bare_fn<AC:AstConv,RS:RegionScope + Clone + 'static>(
672672
{
673673
match self_info.explicit_self.node {
674674
ast::sty_static => None,
675-
ast::sty_value(_) => {
675+
ast::sty_value => {
676676
Some(self_info.untransformed_self_ty)
677677
}
678678
ast::sty_region(ref lifetime, mutability) => {
@@ -689,7 +689,7 @@ fn ty_of_method_or_bare_fn<AC:AstConv,RS:RegionScope + Clone + 'static>(
689689
ty::mt {ty: self_info.untransformed_self_ty,
690690
mutbl: mutability}))
691691
}
692-
ast::sty_uniq(_) => {
692+
ast::sty_uniq => {
693693
Some(ty::mk_uniq(this.tcx(),
694694
ty::mt {ty: self_info.untransformed_self_ty,
695695
mutbl: ast::MutImmutable}))

branches/dist-snap/src/librustc/middle/typeck/check/method.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ impl<'self> LookupContext<'self> {
10821082
ast::sty_static => {
10831083
self.bug(~"static method for object type receiver");
10841084
}
1085-
ast::sty_value(_) => {
1085+
ast::sty_value => {
10861086
ty::mk_err() // error reported in `enforce_object_limitations()`
10871087
}
10881088
ast::sty_region(*) | ast::sty_box(*) | ast::sty_uniq(*) => {
@@ -1141,7 +1141,7 @@ impl<'self> LookupContext<'self> {
11411141
through an object");
11421142
}
11431143

1144-
ast::sty_value(_) => { // reason (a) above
1144+
ast::sty_value => { // reason (a) above
11451145
self.tcx().sess.span_err(
11461146
self.expr.span,
11471147
"cannot call a method with a by-value receiver \
@@ -1198,7 +1198,7 @@ impl<'self> LookupContext<'self> {
11981198
false
11991199
}
12001200

1201-
sty_value(_) => {
1201+
sty_value => {
12021202
rcvr_matches_ty(self.fcx, rcvr_ty, candidate)
12031203
}
12041204

@@ -1236,7 +1236,7 @@ impl<'self> LookupContext<'self> {
12361236
}
12371237
}
12381238

1239-
sty_uniq(_) => {
1239+
sty_uniq => {
12401240
debug!("(is relevant?) explicit self is a unique pointer");
12411241
match ty::get(rcvr_ty).sty {
12421242
ty::ty_uniq(mt) => {
@@ -1369,7 +1369,7 @@ impl<'self> LookupContext<'self> {
13691369

13701370
pub fn get_mode_from_explicit_self(explicit_self: ast::explicit_self_) -> SelfMode {
13711371
match explicit_self {
1372-
sty_value(_) => ty::ByRef,
1372+
sty_value => ty::ByRef,
13731373
_ => ty::ByCopy,
13741374
}
13751375
}

branches/dist-snap/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3254,7 +3254,7 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt,
32543254
defn: ast::Def)
32553255
-> ty_param_bounds_and_ty {
32563256
match defn {
3257-
ast::DefArg(nid, _) | ast::DefLocal(nid, _) | ast::DefSelf(nid, _) |
3257+
ast::DefArg(nid, _) | ast::DefLocal(nid, _) | ast::DefSelf(nid) |
32583258
ast::DefBinding(nid, _) => {
32593259
let typ = fcx.local_ty(sp, nid);
32603260
return no_params(typ);

branches/dist-snap/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn encl_region_of_def(fcx: @mut FnCtxt, def: ast::Def) -> ty::Region {
5858
let tcx = fcx.tcx();
5959
match def {
6060
DefLocal(node_id, _) | DefArg(node_id, _) |
61-
DefSelf(node_id, _) | DefBinding(node_id, _) => {
61+
DefSelf(node_id) | DefBinding(node_id, _) => {
6262
tcx.region_maps.encl_region(node_id)
6363
}
6464
DefUpvar(_, subdef, closure_id, body_id) => {

branches/dist-snap/src/librustdoc/clean.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ impl Clean<SelfTy> for ast::explicit_self {
388388
fn clean(&self) -> SelfTy {
389389
match self.node {
390390
ast::sty_static => SelfStatic,
391-
ast::sty_value(_) => SelfValue,
392-
ast::sty_uniq(_) => SelfOwned,
391+
ast::sty_value => SelfValue,
392+
ast::sty_uniq => SelfOwned,
393393
ast::sty_region(lt, mt) => SelfBorrowed(lt.clean(), mt.clean()),
394394
ast::sty_box(mt) => SelfManaged(mt.clean()),
395395
}
@@ -1171,7 +1171,7 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
11711171

11721172
let (def_id, kind) = match *d {
11731173
ast::DefFn(i, _) => (i, TypeFunction),
1174-
ast::DefSelf(i, _) | ast::DefSelfTy(i) => return Self(i),
1174+
ast::DefSelf(i) | ast::DefSelfTy(i) => return Self(i),
11751175
ast::DefTy(i) => (i, TypeEnum),
11761176
ast::DefTrait(i) => {
11771177
debug!("saw DefTrait in def_to_id");

0 commit comments

Comments
 (0)