about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-07-12 13:15:29 -0700
committerRalf Jung <post@ralfj.de>2017-07-12 13:15:29 -0700
commite1ad1909db65562c6289bf692722d4b31b555125 (patch)
tree4dd75f9dda64fc0e2ed0dcc20f24538c3798d691
parent66fce33ecb56c8aae8d77ffd4fc0562aadf66a0b (diff)
downloadrust-e1ad1909db65562c6289bf692722d4b31b555125.tar.gz
rust-e1ad1909db65562c6289bf692722d4b31b555125.zip
rename trait to conform with 'getter trait' pattern
-rw-r--r--src/librustc/mir/mod.rs12
-rw-r--r--src/librustc/mir/tcx.rs8
2 files changed, 10 insertions, 10 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index ba38d97d092..d176ae761e1 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -69,18 +69,18 @@ macro_rules! newtype_index {
 /// Types for locals
 type LocalDecls<'tcx> = IndexVec<Local, LocalDecl<'tcx>>;
 
-pub trait AsLocalDeclsRef<'tcx> {
-    fn as_ref(&self) -> &LocalDecls<'tcx>;
+pub trait HasLocalDecls<'tcx> {
+    fn local_decls(&self) -> &LocalDecls<'tcx>;
 }
 
-impl<'tcx> AsLocalDeclsRef<'tcx> for LocalDecls<'tcx> {
-    fn as_ref(&self) -> &LocalDecls<'tcx> {
+impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
+    fn local_decls(&self) -> &LocalDecls<'tcx> {
         self
     }
 }
 
-impl<'tcx> AsLocalDeclsRef<'tcx> for Mir<'tcx> {
-    fn as_ref(&self) -> &LocalDecls<'tcx> {
+impl<'tcx> HasLocalDecls<'tcx> for Mir<'tcx> {
+    fn local_decls(&self) -> &LocalDecls<'tcx> {
         &self.local_decls
     }
 }
diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs
index c99fffe2198..d3b87c1201d 100644
--- a/src/librustc/mir/tcx.rs
+++ b/src/librustc/mir/tcx.rs
@@ -121,10 +121,10 @@ impl<'tcx> TypeFoldable<'tcx> for LvalueTy<'tcx> {
 }
 
 impl<'tcx> Lvalue<'tcx> {
-    pub fn ty<'a, 'gcx, D: AsLocalDeclsRef<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> LvalueTy<'tcx> {
+    pub fn ty<'a, 'gcx, D: HasLocalDecls<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> LvalueTy<'tcx> {
         match *self {
             Lvalue::Local(index) =>
-                LvalueTy::Ty { ty: local_decls.as_ref()[index].ty },
+                LvalueTy::Ty { ty: local_decls.local_decls()[index].ty },
             Lvalue::Static(ref data) =>
                 LvalueTy::Ty { ty: data.ty },
             Lvalue::Projection(ref proj) =>
@@ -134,7 +134,7 @@ impl<'tcx> Lvalue<'tcx> {
 }
 
 impl<'tcx> Rvalue<'tcx> {
-    pub fn ty<'a, 'gcx, D: AsLocalDeclsRef<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>
+    pub fn ty<'a, 'gcx, D: HasLocalDecls<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>
     {
         match *self {
             Rvalue::Use(ref operand) => operand.ty(local_decls, tcx),
@@ -206,7 +206,7 @@ impl<'tcx> Rvalue<'tcx> {
 }
 
 impl<'tcx> Operand<'tcx> {
-    pub fn ty<'a, 'gcx, D: AsLocalDeclsRef<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {
+    pub fn ty<'a, 'gcx, D: HasLocalDecls<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {
         match self {
             &Operand::Consume(ref l) => l.ty(local_decls, tcx).to_ty(tcx),
             &Operand::Constant(ref c) => c.ty,