Skip to content

Commit 305f507

Browse files
sanxiyncatamorphism
authored andcommitted
---
yaml --- r: 52447 b: refs/heads/dist-snap c: 800b8a7 h: refs/heads/master i: 52445: f026369 52443: e397908 52439: 245cf21 52431: fb1dc18 52415: 7a931d0 v: v3
1 parent b9aee3e commit 305f507

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
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: d10b5c725b927c94ab73e74f036d622fdc14f4c5
10+
refs/heads/dist-snap: 800b8a759d7d22de9ff49a5bd680f36407123298
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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,

branches/dist-snap/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)