Skip to content

Commit 846e2e7

Browse files
sanxiyncatamorphism
authored andcommitted
---
yaml --- r: 41899 b: refs/heads/master c: 800b8a7 h: refs/heads/master i: 41897: e3cfb1d 41895: a299c26 v: v3
1 parent 663066d commit 846e2e7

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: d10b5c725b927c94ab73e74f036d622fdc14f4c5
2+
refs/heads/master: 800b8a759d7d22de9ff49a5bd680f36407123298
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/src/librustc/middle/mem_categorization.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,26 +453,27 @@ impl &mem_categorization_ctxt {
453453
mutbl:m_imm, ty:expr_ty}
454454
}
455455

456-
ast::def_arg(vid, mode, _) => {
456+
ast::def_arg(vid, mode, mutbl) => {
457457
// Idea: make this could be rewritten to model by-ref
458458
// stuff as `&const` and `&mut`?
459459

460460
// m: mutability of the argument
461461
// lp: loan path, must be none for aliasable things
462-
let {m,lp} = match ty::resolved_mode(self.tcx, mode) {
462+
let m = if mutbl {m_mutbl} else {m_imm};
463+
let lp = match ty::resolved_mode(self.tcx, mode) {
463464
ast::by_move | ast::by_copy => {
464-
{m: m_imm, lp: Some(@lp_arg(vid))}
465+
Some(@lp_arg(vid))
465466
}
466467
ast::by_ref => {
467-
{m: m_imm, lp: None}
468+
None
468469
}
469470
ast::by_val => {
470471
// by-value is this hybrid mode where we have a
471472
// pointer but we do not own it. This is not
472473
// considered loanable because, for example, a by-ref
473474
// and and by-val argument might both actually contain
474475
// the same unique ptr.
475-
{m: m_imm, lp: None}
476+
None
476477
}
477478
};
478479
@{id:id, span:span,

trunk/src/librustc/middle/resolve.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4104,9 +4104,11 @@ impl Resolver {
41044104
for declaration.inputs.each |argument| {
41054105
let binding_mode =
41064106
ArgumentIrrefutableMode(argument.mode);
4107+
let mutability =
4108+
if argument.is_mutbl {Mutable} else {Immutable};
41074109
self.resolve_pattern(argument.pat,
41084110
binding_mode,
4109-
Immutable,
4111+
mutability,
41104112
None,
41114113
visitor);
41124114

@@ -4295,12 +4297,7 @@ impl Resolver {
42954297
}
42964298

42974299
fn resolve_local(local: @local, visitor: ResolveVisitor) {
4298-
let mut mutability;
4299-
if local.node.is_mutbl {
4300-
mutability = Mutable;
4301-
} else {
4302-
mutability = Immutable;
4303-
}
4300+
let mutability = if local.node.is_mutbl {Mutable} else {Immutable};
43044301

43054302
// Resolve the type.
43064303
self.resolve_type(local.node.ty, visitor);

0 commit comments

Comments
 (0)