Fix is_foreign_item
for StableMIR instance
Change the implementation of `Instance::is_foreign_item` to directly query the compiler for the instance `def_id` instead of incorrectly relying on the conversion to `CrateItem`. Background: - In pull https://github.com/rust-lang/rust/pull/118524, I fixed the conversion from Instance to CrateItem to avoid the conversion if the instance didn't have a body available. This broke the `is_foreign_item`.
This commit is contained in:
parent
f32d29837d
commit
1bcd162465
5 changed files with 7 additions and 7 deletions
|
@ -187,9 +187,9 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
|
|||
new_item_kind(tables.tcx.def_kind(tables[item.0]))
|
||||
}
|
||||
|
||||
fn is_foreign_item(&self, item: CrateItem) -> bool {
|
||||
fn is_foreign_item(&self, item: DefId) -> bool {
|
||||
let tables = self.0.borrow();
|
||||
tables.tcx.is_foreign_item(tables[item.0])
|
||||
tables.tcx.is_foreign_item(tables[item])
|
||||
}
|
||||
|
||||
fn adt_kind(&self, def: AdtDef) -> AdtKind {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue