Rename as_trans_item to as_mono_item
This commit is contained in:
parent
17bfd74955
commit
28f7d223f4
2 changed files with 12 additions and 12 deletions
|
|
@ -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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
|
|||
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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
|
|||
}
|
||||
|
||||
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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
|
|||
/// 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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
|
|||
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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
|
||||
fn as_trans_item(&self) -> &MonoItem<'tcx> {
|
||||
fn as_mono_item(&self) -> &MonoItem<'tcx> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
|
|||
|
||||
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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
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 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
fn to_raw_string(&self) -> String {
|
||||
match *self.as_trans_item() {
|
||||
match *self.as_mono_item() {
|
||||
MonoItem::Fn(instance) => {
|
||||
format!("Fn({:?}, {})",
|
||||
instance.def,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue