1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::LangItem;
use rustc_span::symbol::{sym, Symbol};
macro_rules! weak_lang_items {
($($item:ident, $sym:ident;)*) => {
pub static WEAK_LANG_ITEMS: &[LangItem] = &[$(LangItem::$item,)*];
impl LangItem {
pub fn is_weak(self) -> bool {
matches!(self, $(LangItem::$item)|*)
}
pub fn link_name(self) -> Option<Symbol> {
match self {
$( LangItem::$item => Some(sym::$sym),)*
_ => None,
}
}
}
}
}
weak_lang_items! {
PanicImpl, rust_begin_unwind;
EhPersonality, rust_eh_personality;
EhCatchTypeinfo, rust_eh_catch_typeinfo;
}