Skip to content

Commit 9d0364c

Browse files
committed
Ignore lang items
1 parent babaa7d commit 9d0364c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/librustc/ty/instance.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,15 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
258258
return self;
259259
}
260260
match self.ty(tcx).sty {
261-
ty::TyFnDef(_def_id, _) => {
262-
// TODO: is fn a lang_item?
261+
ty::TyFnDef(def_id, _) => {
262+
let attrs = tcx.item_attrs(def_id);
263+
if attrs.iter().find(|attr| {
264+
attr.name().map(|n|n.as_str() == "lang").unwrap_or(false)
265+
}).is_some() {
266+
return self; // Lang items dont work otherwise
267+
}
263268
}
264-
_ => return self,
269+
_ => return self, // Closures dont work otherwise
265270
}
266271

267272
let used_substs = used_substs_for_instance(tcx, self);

0 commit comments

Comments
 (0)