Use Symbol in weak_lang_items!.

This commit is contained in:
Nicholas Nethercote 2019-09-05 11:35:39 +10:00
parent fe08ac6da4
commit 5e5611ab43

View File

@ -116,8 +116,8 @@ fn verify<'tcx>(tcx: TyCtxt<'tcx>,
} }
impl<'a, 'tcx> Context<'a, 'tcx> { impl<'a, 'tcx> Context<'a, 'tcx> {
fn register(&mut self, name: &str, span: Span) { fn register(&mut self, name: Symbol, span: Span) {
$(if name == stringify!($name) { $(if name == sym::$name {
if self.items.$name().is_none() { if self.items.$name().is_none() {
self.items.missing.push(lang_items::$item); self.items.missing.push(lang_items::$item);
} }
@ -136,7 +136,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v> {
fn visit_foreign_item(&mut self, i: &hir::ForeignItem) { fn visit_foreign_item(&mut self, i: &hir::ForeignItem) {
if let Some((lang_item, _)) = lang_items::extract(&i.attrs) { if let Some((lang_item, _)) = lang_items::extract(&i.attrs) {
self.register(&lang_item.as_str(), i.span); self.register(lang_item, i.span);
} }
intravisit::walk_foreign_item(self, i) intravisit::walk_foreign_item(self, i)
} }