Add TyCtxt::is_lang_item
This commit is contained in:
parent
f8e5660532
commit
d5c48ebc71
6 changed files with 42 additions and 40 deletions
|
@ -23,6 +23,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn is_lang_item(self, def_id: DefId, lang_item: LangItem) -> bool {
|
||||
self.lang_items().get(lang_item) == Some(def_id)
|
||||
}
|
||||
|
||||
/// Given a [`DefId`] of one of the [`Fn`], [`FnMut`] or [`FnOnce`] traits,
|
||||
/// returns a corresponding [`ty::ClosureKind`].
|
||||
/// For any other [`DefId`] return `None`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue