diff options
| author | Celina G. Val <celinval@amazon.com> | 2023-12-06 10:48:18 -0800 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2023-12-06 10:48:18 -0800 |
| commit | 1bcd162465dc98a2264138d145ecf3033d7e2108 (patch) | |
| tree | 4b6760828accb6aa920c0f230f4909b9514086aa /compiler/stable_mir/src/compiler_interface.rs | |
| parent | f32d29837d3642475e23716cd8af5711d00c01ae (diff) | |
| download | rust-1bcd162465dc98a2264138d145ecf3033d7e2108.tar.gz rust-1bcd162465dc98a2264138d145ecf3033d7e2108.zip | |
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`.
Diffstat (limited to 'compiler/stable_mir/src/compiler_interface.rs')
| -rw-r--r-- | compiler/stable_mir/src/compiler_interface.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/stable_mir/src/compiler_interface.rs b/compiler/stable_mir/src/compiler_interface.rs index daf4465963e..1bbcc257dfc 100644 --- a/compiler/stable_mir/src/compiler_interface.rs +++ b/compiler/stable_mir/src/compiler_interface.rs @@ -60,7 +60,7 @@ pub trait Context { fn item_kind(&self, item: CrateItem) -> ItemKind; /// Returns whether this is a foreign item. - fn is_foreign_item(&self, item: CrateItem) -> bool; + fn is_foreign_item(&self, item: DefId) -> bool; /// Returns the kind of a given algebraic data type fn adt_kind(&self, def: AdtDef) -> AdtKind; |
