]> git.lizzy.rs Git - rust.git/commitdiff
Rename as_trans_item to as_mono_item
authorMaik Klein <maikklein@googlemail.com>
Thu, 26 Oct 2017 08:32:39 +0000 (10:32 +0200)
committerAriel Ben-Yehuda <ariel.byd@gmail.com>
Mon, 18 Dec 2017 15:08:49 +0000 (17:08 +0200)
src/librustc_mir/monomorphize/mono_item.rs
src/librustc_trans/trans_item.rs

index 680fad7dc579728b5a2d45c73ac527aee8ecf1aa..1c174293cca0bfcb6de1228c851344e766a5bf76 100644 (file)
@@ -82,7 +82,7 @@ pub enum InstantiationMode {
 }
 
 pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
-    fn as_trans_item(&self) -> &MonoItem<'tcx>;
+    fn as_mono_item(&self) -> &MonoItem<'tcx>;
 
     fn instantiation_mode(&self,
                           tcx: TyCtxt<'a, 'tcx, 'tcx>)
@@ -92,7 +92,7 @@ fn instantiation_mode(&self,
                 tcx.sess.opts.optimize != OptLevel::No
             });
 
-        match *self.as_trans_item() {
+        match *self.as_mono_item() {
             MonoItem::Fn(ref instance) => {
                 // If this function isn't inlined or otherwise has explicit
                 // linkage, then we'll be creating a globally shared version.
@@ -132,7 +132,7 @@ fn instantiation_mode(&self,
     }
 
     fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Linkage> {
-        let def_id = match *self.as_trans_item() {
+        let def_id = match *self.as_mono_item() {
             MonoItem::Fn(ref instance) => instance.def_id(),
             MonoItem::Static(node_id) => tcx.hir.local_def_id(node_id),
             MonoItem::GlobalAsm(..) => return None,
@@ -182,7 +182,7 @@ fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Linkage> {
     /// which will never be accessed) in its place.
     fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
         debug!("is_instantiable({:?})", self);
-        let (def_id, substs) = match *self.as_trans_item() {
+        let (def_id, substs) = match *self.as_mono_item() {
             MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs),
             MonoItem::Static(node_id) => (tcx.hir.local_def_id(node_id), Substs::empty()),
             // global asm never has predicates
@@ -196,7 +196,7 @@ fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
     fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> String {
         let hir_map = &tcx.hir;
 
-        return match *self.as_trans_item() {
+        return match *self.as_mono_item() {
             MonoItem::Fn(instance) => {
                 to_string_internal(tcx, "fn ", instance)
             },
@@ -224,7 +224,7 @@ fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 }
 
 impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
-    fn as_trans_item(&self) -> &MonoItem<'tcx> {
+    fn as_mono_item(&self) -> &MonoItem<'tcx> {
         self
     }
 }
index 4ccf46d0b733fae78beb8c3517585190949594e7..678771aae3289a6a814c5d8701f31ce9b32fba98 100644 (file)
@@ -46,7 +46,7 @@ fn define(&self, ccx: &CrateContext<'a, 'tcx>) {
                self.to_raw_string(),
                ccx.codegen_unit().name());
 
-        match *self.as_trans_item() {
+        match *self.as_mono_item() {
             MonoItem::Static(node_id) => {
                 let tcx = ccx.tcx();
                 let item = tcx.hir.expect_item(node_id);
@@ -93,7 +93,7 @@ fn predefine(&self,
 
         debug!("symbol {}", &symbol_name);
 
-        match *self.as_trans_item() {
+        match *self.as_mono_item() {
             MonoItem::Static(node_id) => {
                 predefine_static(ccx, node_id, linkage, visibility, &symbol_name);
             }
@@ -110,7 +110,7 @@ fn predefine(&self,
     }
 
     fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::SymbolName {
-        match *self.as_trans_item() {
+        match *self.as_mono_item() {
             MonoItem::Fn(instance) => tcx.symbol_name(instance),
             MonoItem::Static(node_id) => {
                 let def_id = tcx.hir.local_def_id(node_id);
@@ -126,7 +126,7 @@ fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::SymbolName {
     }
 
     fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Span> {
-        match *self.as_trans_item() {
+        match *self.as_mono_item() {
             MonoItem::Fn(Instance { def, .. }) => {
                 tcx.hir.as_local_node_id(def.def_id())
             }
@@ -138,7 +138,7 @@ fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Span> {
     }
 
     fn is_generic_fn(&self) -> bool {
-        match *self.as_trans_item() {
+        match *self.as_mono_item() {
             MonoItem::Fn(ref instance) => {
                 instance.substs.types().next().is_some()
             }
@@ -148,7 +148,7 @@ fn is_generic_fn(&self) -> bool {
     }
 
     fn to_raw_string(&self) -> String {
-        match *self.as_trans_item() {
+        match *self.as_mono_item() {
             MonoItem::Fn(instance) => {
                 format!("Fn({:?}, {})",
                          instance.def,