Skip to content

Commit 28f7d22

Browse files
MaikKleinarielb1
authored andcommitted
Rename as_trans_item to as_mono_item
1 parent 17bfd74 commit 28f7d22

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/librustc_mir/monomorphize/mono_item.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub enum InstantiationMode {
8282
}
8383

8484
pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
85-
fn as_trans_item(&self) -> &MonoItem<'tcx>;
85+
fn as_mono_item(&self) -> &MonoItem<'tcx>;
8686

8787
fn instantiation_mode(&self,
8888
tcx: TyCtxt<'a, 'tcx, 'tcx>)
@@ -92,7 +92,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
9292
tcx.sess.opts.optimize != OptLevel::No
9393
});
9494

95-
match *self.as_trans_item() {
95+
match *self.as_mono_item() {
9696
MonoItem::Fn(ref instance) => {
9797
// If this function isn't inlined or otherwise has explicit
9898
// linkage, then we'll be creating a globally shared version.
@@ -132,7 +132,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
132132
}
133133

134134
fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Linkage> {
135-
let def_id = match *self.as_trans_item() {
135+
let def_id = match *self.as_mono_item() {
136136
MonoItem::Fn(ref instance) => instance.def_id(),
137137
MonoItem::Static(node_id) => tcx.hir.local_def_id(node_id),
138138
MonoItem::GlobalAsm(..) => return None,
@@ -182,7 +182,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
182182
/// which will never be accessed) in its place.
183183
fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
184184
debug!("is_instantiable({:?})", self);
185-
let (def_id, substs) = match *self.as_trans_item() {
185+
let (def_id, substs) = match *self.as_mono_item() {
186186
MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs),
187187
MonoItem::Static(node_id) => (tcx.hir.local_def_id(node_id), Substs::empty()),
188188
// global asm never has predicates
@@ -196,7 +196,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
196196
fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> String {
197197
let hir_map = &tcx.hir;
198198

199-
return match *self.as_trans_item() {
199+
return match *self.as_mono_item() {
200200
MonoItem::Fn(instance) => {
201201
to_string_internal(tcx, "fn ", instance)
202202
},
@@ -224,7 +224,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
224224
}
225225

226226
impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
227-
fn as_trans_item(&self) -> &MonoItem<'tcx> {
227+
fn as_mono_item(&self) -> &MonoItem<'tcx> {
228228
self
229229
}
230230
}

src/librustc_trans/trans_item.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
4646
self.to_raw_string(),
4747
ccx.codegen_unit().name());
4848

49-
match *self.as_trans_item() {
49+
match *self.as_mono_item() {
5050
MonoItem::Static(node_id) => {
5151
let tcx = ccx.tcx();
5252
let item = tcx.hir.expect_item(node_id);
@@ -93,7 +93,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
9393

9494
debug!("symbol {}", &symbol_name);
9595

96-
match *self.as_trans_item() {
96+
match *self.as_mono_item() {
9797
MonoItem::Static(node_id) => {
9898
predefine_static(ccx, node_id, linkage, visibility, &symbol_name);
9999
}
@@ -110,7 +110,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
110110
}
111111

112112
fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::SymbolName {
113-
match *self.as_trans_item() {
113+
match *self.as_mono_item() {
114114
MonoItem::Fn(instance) => tcx.symbol_name(instance),
115115
MonoItem::Static(node_id) => {
116116
let def_id = tcx.hir.local_def_id(node_id);
@@ -126,7 +126,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
126126
}
127127

128128
fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Span> {
129-
match *self.as_trans_item() {
129+
match *self.as_mono_item() {
130130
MonoItem::Fn(Instance { def, .. }) => {
131131
tcx.hir.as_local_node_id(def.def_id())
132132
}
@@ -138,7 +138,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
138138
}
139139

140140
fn is_generic_fn(&self) -> bool {
141-
match *self.as_trans_item() {
141+
match *self.as_mono_item() {
142142
MonoItem::Fn(ref instance) => {
143143
instance.substs.types().next().is_some()
144144
}
@@ -148,7 +148,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
148148
}
149149

150150
fn to_raw_string(&self) -> String {
151-
match *self.as_trans_item() {
151+
match *self.as_mono_item() {
152152
MonoItem::Fn(instance) => {
153153
format!("Fn({:?}, {})",
154154
instance.def,

0 commit comments

Comments
 (0)