use syntax::ast;
use syntax::symbol::Symbol;
use syntax_pos::Span;
+use hir::def_id::DefId;
use hir::intravisit::{Visitor, NestedVisitorMap};
use hir::intravisit;
use hir;
}
}
+impl<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx> {
+ pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool {
+ let lang_items = self.lang_items();
+ let did = Some(item_def_id);
+
+ $(lang_items.$name() == did)||+
+ }
+}
+
) }
weak_lang_items! {
MonoItemCollectionMode::Lazy => {
self.entry_fn == Some(def_id) ||
self.tcx.is_reachable_non_generic(def_id) ||
+ self.tcx.is_weak_lang_item(def_id) ||
self.tcx.codegen_fn_attrs(def_id).flags.contains(
CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
}
--- /dev/null
+-include ../tools.mk
+
+ifdef IS_WINDOWS
+# Do nothing on MSVC.
+all:
+ exit 0
+else
+all:
+ $(RUSTC) --emit=obj app.rs
+ nm $(TMPDIR)/app.o | $(CGREP) rust_begin_unwind
+ nm $(TMPDIR)/app.o | $(CGREP) rust_eh_personality
+ nm $(TMPDIR)/app.o | $(CGREP) rust_oom
+endif
--- /dev/null
+#![crate_type = "bin"]
+#![feature(lang_items)]
+#![feature(panic_implementation)]
+#![no_main]
+#![no_std]
+
+use core::panic::PanicInfo;
+
+#[panic_implementation]
+fn panic(_: &PanicInfo) -> ! {
+ loop {}
+}
+
+#[lang = "eh_personality"]
+fn eh() {}
+
+#[lang = "oom"]
+fn oom() {}