Skip to content

Commit e1ad190

Browse files
committed
rename trait to conform with 'getter trait' pattern
1 parent 66fce33 commit e1ad190

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/librustc/mir/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@ macro_rules! newtype_index {
6969
/// Types for locals
7070
type LocalDecls<'tcx> = IndexVec<Local, LocalDecl<'tcx>>;
7171

72-
pub trait AsLocalDeclsRef<'tcx> {
73-
fn as_ref(&self) -> &LocalDecls<'tcx>;
72+
pub trait HasLocalDecls<'tcx> {
73+
fn local_decls(&self) -> &LocalDecls<'tcx>;
7474
}
7575

76-
impl<'tcx> AsLocalDeclsRef<'tcx> for LocalDecls<'tcx> {
77-
fn as_ref(&self) -> &LocalDecls<'tcx> {
76+
impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
77+
fn local_decls(&self) -> &LocalDecls<'tcx> {
7878
self
7979
}
8080
}
8181

82-
impl<'tcx> AsLocalDeclsRef<'tcx> for Mir<'tcx> {
83-
fn as_ref(&self) -> &LocalDecls<'tcx> {
82+
impl<'tcx> HasLocalDecls<'tcx> for Mir<'tcx> {
83+
fn local_decls(&self) -> &LocalDecls<'tcx> {
8484
&self.local_decls
8585
}
8686
}

src/librustc/mir/tcx.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ impl<'tcx> TypeFoldable<'tcx> for LvalueTy<'tcx> {
121121
}
122122

123123
impl<'tcx> Lvalue<'tcx> {
124-
pub fn ty<'a, 'gcx, D: AsLocalDeclsRef<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> LvalueTy<'tcx> {
124+
pub fn ty<'a, 'gcx, D: HasLocalDecls<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> LvalueTy<'tcx> {
125125
match *self {
126126
Lvalue::Local(index) =>
127-
LvalueTy::Ty { ty: local_decls.as_ref()[index].ty },
127+
LvalueTy::Ty { ty: local_decls.local_decls()[index].ty },
128128
Lvalue::Static(ref data) =>
129129
LvalueTy::Ty { ty: data.ty },
130130
Lvalue::Projection(ref proj) =>
@@ -134,7 +134,7 @@ impl<'tcx> Lvalue<'tcx> {
134134
}
135135

136136
impl<'tcx> Rvalue<'tcx> {
137-
pub fn ty<'a, 'gcx, D: AsLocalDeclsRef<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>
137+
pub fn ty<'a, 'gcx, D: HasLocalDecls<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>
138138
{
139139
match *self {
140140
Rvalue::Use(ref operand) => operand.ty(local_decls, tcx),
@@ -206,7 +206,7 @@ impl<'tcx> Rvalue<'tcx> {
206206
}
207207

208208
impl<'tcx> Operand<'tcx> {
209-
pub fn ty<'a, 'gcx, D: AsLocalDeclsRef<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {
209+
pub fn ty<'a, 'gcx, D: HasLocalDecls<'tcx>>(&self, local_decls: &D, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {
210210
match self {
211211
&Operand::Consume(ref l) => l.ty(local_decls, tcx).to_ty(tcx),
212212
&Operand::Constant(ref c) => c.ty,

0 commit comments

Comments
 (0)