Skip to content

Commit 2e75932

Browse files
committed
---
yaml --- r: 150996 b: refs/heads/try2 c: 250ae79 h: refs/heads/master v: v3
1 parent cfc64dd commit 2e75932

File tree

5 files changed

+61
-67
lines changed

5 files changed

+61
-67
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 45c8cb3597256390c69ff5ad6a7ee565114a1ec7
8+
refs/heads/try2: 250ae7923f9b41d826463d21a8187f1b5f0592ab
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ impl<'a> GatherLoanCtxt<'a> {
381381
Some(method) => {
382382
// Treat overloaded autoderefs as if an AutoRef adjustment
383383
// was applied on the base type, as that is always the case.
384-
let mut mc = self.bccx.mc();
385-
let cmt = match mc.cat_expr_autoderefd(expr, i) {
384+
let cmt = match self.bccx.mc().cat_expr_autoderefd(expr, i) {
386385
Ok(v) => v,
387386
Err(()) => self.tcx().sess.span_bug(expr.span, "Err from mc")
388387
};
@@ -431,7 +430,7 @@ impl<'a> GatherLoanCtxt<'a> {
431430
autoref: Some(ref autoref),
432431
autoderefs}) => {
433432
self.guarantee_autoderefs(expr, autoderefs);
434-
let mut mc = self.bccx.mc();
433+
let mc = self.bccx.mc();
435434
let cmt = match mc.cat_expr_autoderefd(expr, autoderefs) {
436435
Ok(v) => v,
437436
Err(()) => self.tcx().sess.span_bug(expr.span, "Err from mc")
@@ -793,7 +792,7 @@ impl<'a> GatherLoanCtxt<'a> {
793792
* `gather_pat()`.
794793
*/
795794

796-
let mut mc = self.bccx.mc();
795+
let mc = self.bccx.mc();
797796
for arg in decl.inputs.iter() {
798797
let arg_ty = ty::node_id_to_type(self.tcx(), arg.pat.id);
799798

branches/try2/src/librustc/middle/borrowck/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ impl<'a> mc::Typer for &'a ty::ctxt {
910910
*self
911911
}
912912

913-
fn node_ty(&mut self, id: ast::NodeId) -> mc::McResult<ty::t> {
913+
fn node_ty(&self, id: ast::NodeId) -> mc::McResult<ty::t> {
914914
Ok(ty::node_id_to_type(*self, id))
915915
}
916916

@@ -922,15 +922,15 @@ impl<'a> mc::Typer for &'a ty::ctxt {
922922
&self.adjustments
923923
}
924924

925-
fn is_method_call(&mut self, id: ast::NodeId) -> bool {
925+
fn is_method_call(&self, id: ast::NodeId) -> bool {
926926
self.method_map.borrow().contains_key(&typeck::MethodCall::expr(id))
927927
}
928928

929-
fn temporary_scope(&mut self, id: ast::NodeId) -> Option<ast::NodeId> {
929+
fn temporary_scope(&self, id: ast::NodeId) -> Option<ast::NodeId> {
930930
self.region_maps.temporary_scope(id)
931931
}
932932

933-
fn upvar_borrow(&mut self, id: ty::UpvarId) -> ty::UpvarBorrow {
933+
fn upvar_borrow(&self, id: ty::UpvarId) -> ty::UpvarBorrow {
934934
self.upvar_borrow_map.borrow().get_copy(&id)
935935
}
936936
}

branches/try2/src/librustc/middle/mem_categorization.rs

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,12 @@ pub type McResult<T> = Result<T, ()>;
266266
*/
267267
pub trait Typer {
268268
fn tcx<'a>(&'a self) -> &'a ty::ctxt;
269-
fn node_ty(&mut self, id: ast::NodeId) -> McResult<ty::t>;
269+
fn node_ty(&self, id: ast::NodeId) -> McResult<ty::t>;
270270
fn node_method_ty(&self, method_call: typeck::MethodCall) -> Option<ty::t>;
271-
fn is_method_call(&mut self, id: ast::NodeId) -> bool;
272-
fn temporary_scope(&mut self, rvalue_id: ast::NodeId) -> Option<ast::NodeId>;
273-
fn upvar_borrow(&mut self, upvar_id: ty::UpvarId) -> ty::UpvarBorrow;
274271
fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<ty::AutoAdjustment>>;
272+
fn is_method_call(&self, id: ast::NodeId) -> bool;
273+
fn temporary_scope(&self, rvalue_id: ast::NodeId) -> Option<ast::NodeId>;
274+
fn upvar_borrow(&self, upvar_id: ty::UpvarId) -> ty::UpvarBorrow;
275275
}
276276

277277
impl MutabilityCategory {
@@ -353,30 +353,26 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
353353
self.typer.tcx()
354354
}
355355

356-
fn adjustment(&mut self, id: ast::NodeId) -> Option<@ty::AutoAdjustment> {
357-
self.typer.adjustment(id)
358-
}
359-
360-
fn expr_ty(&mut self, expr: &ast::Expr) -> McResult<ty::t> {
356+
fn expr_ty(&self, expr: &ast::Expr) -> McResult<ty::t> {
361357
self.typer.node_ty(expr.id)
362358
}
363359

364-
fn expr_ty_adjusted(&mut self, expr: &ast::Expr) -> McResult<ty::t> {
360+
fn expr_ty_adjusted(&self, expr: &ast::Expr) -> McResult<ty::t> {
365361
let unadjusted_ty = if_ok!(self.expr_ty(expr));
366362
Ok(ty::adjust_ty(self.tcx(), expr.span, expr.id, unadjusted_ty,
367363
self.typer.adjustments().borrow().find(&expr.id),
368364
|method_call| self.typer.node_method_ty(method_call)))
369365
}
370366

371-
fn node_ty(&mut self, id: ast::NodeId) -> McResult<ty::t> {
367+
fn node_ty(&self, id: ast::NodeId) -> McResult<ty::t> {
372368
self.typer.node_ty(id)
373369
}
374370

375-
fn pat_ty(&mut self, pat: @ast::Pat) -> McResult<ty::t> {
371+
fn pat_ty(&self, pat: @ast::Pat) -> McResult<ty::t> {
376372
self.typer.node_ty(pat.id)
377373
}
378374

379-
pub fn cat_expr(&mut self, expr: &ast::Expr) -> McResult<cmt> {
375+
pub fn cat_expr(&self, expr: &ast::Expr) -> McResult<cmt> {
380376
match self.typer.adjustments().borrow().find(&expr.id) {
381377
None => {
382378
// No adjustments.
@@ -420,7 +416,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
420416
}
421417
}
422418

423-
pub fn cat_expr_autoderefd(&mut self, expr: &ast::Expr, autoderefs: uint)
419+
pub fn cat_expr_autoderefd(&self, expr: &ast::Expr, autoderefs: uint)
424420
-> McResult<cmt> {
425421
let mut cmt = if_ok!(self.cat_expr_unadjusted(expr));
426422
for deref in range(1u, autoderefs + 1) {
@@ -429,7 +425,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
429425
return Ok(cmt);
430426
}
431427

432-
pub fn cat_expr_unadjusted(&mut self, expr: &ast::Expr) -> McResult<cmt> {
428+
pub fn cat_expr_unadjusted(&self, expr: &ast::Expr) -> McResult<cmt> {
433429
debug!("cat_expr: id={} expr={}", expr.id, expr.repr(self.tcx()));
434430

435431
let expr_ty = if_ok!(self.expr_ty(expr));
@@ -478,7 +474,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
478474
}
479475
}
480476

481-
pub fn cat_def(&mut self,
477+
pub fn cat_def(&self,
482478
id: ast::NodeId,
483479
span: Span,
484480
expr_ty: ty::t,
@@ -593,7 +589,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
593589
}
594590
}
595591

596-
fn cat_upvar(&mut self,
592+
fn cat_upvar(&self,
597593
id: ast::NodeId,
598594
span: Span,
599595
var_id: ast::NodeId,
@@ -643,7 +639,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
643639
Ok(deref_cmt)
644640
}
645641

646-
pub fn cat_rvalue_node(&mut self,
642+
pub fn cat_rvalue_node(&self,
647643
id: ast::NodeId,
648644
span: Span,
649645
expr_ty: ty::t)
@@ -658,7 +654,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
658654
}
659655
}
660656

661-
pub fn cat_rvalue(&mut self,
657+
pub fn cat_rvalue(&self,
662658
cmt_id: ast::NodeId,
663659
span: Span,
664660
temp_scope: ty::Region,
@@ -672,7 +668,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
672668
}
673669
}
674670

675-
pub fn cat_field<N:ast_node>(&mut self,
671+
pub fn cat_field<N:ast_node>(&self,
676672
node: &N,
677673
base_cmt: cmt,
678674
f_name: ast::Ident,
@@ -687,11 +683,11 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
687683
}
688684
}
689685

690-
pub fn cat_deref_obj<N:ast_node>(&mut self, node: &N, base_cmt: cmt) -> cmt {
686+
pub fn cat_deref_obj<N:ast_node>(&self, node: &N, base_cmt: cmt) -> cmt {
691687
self.cat_deref_common(node, base_cmt, 0, ty::mk_nil())
692688
}
693689

694-
fn cat_deref<N:ast_node>(&mut self,
690+
fn cat_deref<N:ast_node>(&self,
695691
node: &N,
696692
base_cmt: cmt,
697693
deref_cnt: uint)
@@ -723,7 +719,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
723719
}
724720
}
725721

726-
fn cat_deref_common<N:ast_node>(&mut self,
722+
fn cat_deref_common<N:ast_node>(&self,
727723
node: &N,
728724
base_cmt: cmt,
729725
deref_cnt: uint,
@@ -749,7 +745,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
749745
}
750746
}
751747

752-
pub fn cat_index<N:ast_node>(&mut self,
748+
pub fn cat_index<N:ast_node>(&self,
753749
elt: &N,
754750
base_cmt: cmt,
755751
derefs: uint)
@@ -836,7 +832,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
836832
}
837833
}
838834

839-
pub fn cat_slice_pattern(&mut self,
835+
pub fn cat_slice_pattern(&self,
840836
vec_cmt: cmt,
841837
slice_pat: @ast::Pat)
842838
-> McResult<(cmt, ast::Mutability, ty::Region)> {
@@ -883,7 +879,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
883879
}
884880
}
885881

886-
pub fn cat_imm_interior<N:ast_node>(&mut self,
882+
pub fn cat_imm_interior<N:ast_node>(&self,
887883
node: &N,
888884
base_cmt: cmt,
889885
interior_ty: ty::t,
@@ -898,7 +894,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
898894
}
899895
}
900896

901-
pub fn cat_downcast<N:ast_node>(&mut self,
897+
pub fn cat_downcast<N:ast_node>(&self,
902898
node: &N,
903899
base_cmt: cmt,
904900
downcast_ty: ty::t)
@@ -912,12 +908,12 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
912908
}
913909
}
914910

915-
pub fn cat_pattern(&mut self,
911+
pub fn cat_pattern(&self,
916912
cmt: cmt,
917-
pat: @ast::Pat,
918-
op: |&mut MemCategorizationContext<TYPER>,
913+
pat: &ast::Pat,
914+
op: |&MemCategorizationContext<TYPER>,
919915
cmt,
920-
@ast::Pat|)
916+
&ast::Pat|)
921917
-> McResult<()> {
922918
// Here, `cmt` is the categorization for the value being
923919
// matched and pat is the pattern it is being matched against.

0 commit comments

Comments
 (0)