File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -453,26 +453,27 @@ impl &mem_categorization_ctxt {
453
453
mutbl: m_imm, ty: expr_ty}
454
454
}
455
455
456
- ast:: def_arg( vid, mode, _ ) => {
456
+ ast:: def_arg( vid, mode, mutbl ) => {
457
457
// Idea: make this could be rewritten to model by-ref
458
458
// stuff as `&const` and `&mut`?
459
459
460
460
// m: mutability of the argument
461
461
// 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) {
463
464
ast:: by_move | ast:: by_copy => {
464
- { m : m_imm , lp : Some ( @lp_arg ( vid) ) }
465
+ Some ( @lp_arg ( vid) )
465
466
}
466
467
ast:: by_ref => {
467
- { m : m_imm , lp : None }
468
+ None
468
469
}
469
470
ast:: by_val => {
470
471
// by-value is this hybrid mode where we have a
471
472
// pointer but we do not own it. This is not
472
473
// considered loanable because, for example, a by-ref
473
474
// and and by-val argument might both actually contain
474
475
// the same unique ptr.
475
- { m : m_imm , lp : None }
476
+ None
476
477
}
477
478
} ;
478
479
@{ id: id, span: span,
Original file line number Diff line number Diff line change @@ -4104,9 +4104,11 @@ impl Resolver {
4104
4104
for declaration. inputs. each |argument| {
4105
4105
let binding_mode =
4106
4106
ArgumentIrrefutableMode ( argument. mode) ;
4107
+ let mutability =
4108
+ if argument. is_mutbl { Mutable} else { Immutable } ;
4107
4109
self . resolve_pattern( argument. pat,
4108
4110
binding_mode,
4109
- Immutable ,
4111
+ mutability ,
4110
4112
None ,
4111
4113
visitor) ;
4112
4114
@@ -4295,12 +4297,7 @@ impl Resolver {
4295
4297
}
4296
4298
4297
4299
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 } ;
4304
4301
4305
4302
// Resolve the type.
4306
4303
self . resolve_type( local. node. ty, visitor) ;
You can’t perform that action at this time.
0 commit comments