File tree Expand file tree Collapse file tree 5 files changed +7
-7
lines changed
rustc_smir/src/rustc_smir
tests/ui-fulldeps/stable-mir Expand file tree Collapse file tree 5 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -187,9 +187,9 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
187187 new_item_kind ( tables. tcx . def_kind ( tables[ item. 0 ] ) )
188188 }
189189
190- fn is_foreign_item ( & self , item : CrateItem ) -> bool {
190+ fn is_foreign_item ( & self , item : DefId ) -> bool {
191191 let tables = self . 0 . borrow ( ) ;
192- tables. tcx . is_foreign_item ( tables[ item. 0 ] )
192+ tables. tcx . is_foreign_item ( tables[ item] )
193193 }
194194
195195 fn adt_kind ( & self , def : AdtDef ) -> AdtKind {
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ pub trait Context {
6060 fn item_kind ( & self , item : CrateItem ) -> ItemKind ;
6161
6262 /// Returns whether this is a foreign item.
63- fn is_foreign_item ( & self , item : CrateItem ) -> bool ;
63+ fn is_foreign_item ( & self , item : DefId ) -> bool ;
6464
6565 /// Returns the kind of a given algebraic data type
6666 fn adt_kind ( & self , def : AdtDef ) -> AdtKind ;
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ impl CrateItem {
120120 }
121121
122122 pub fn is_foreign_item ( & self ) -> bool {
123- with ( |cx| cx. is_foreign_item ( * self ) )
123+ with ( |cx| cx. is_foreign_item ( self . 0 ) )
124124 }
125125
126126 pub fn dump < W : io:: Write > ( & self , w : & mut W ) -> io:: Result < ( ) > {
Original file line number Diff line number Diff line change @@ -40,8 +40,7 @@ impl Instance {
4040 }
4141
4242 pub fn is_foreign_item ( & self ) -> bool {
43- let item = CrateItem :: try_from ( * self ) ;
44- item. as_ref ( ) . is_ok_and ( CrateItem :: is_foreign_item)
43+ with ( |cx| cx. is_foreign_item ( self . def . def_id ( ) ) )
4544 }
4645
4746 /// Get the instance type with generic substitutions applied and lifetimes erased.
Original file line number Diff line number Diff line change @@ -65,7 +65,8 @@ fn test_body(body: mir::Body) {
6565 let instance = Instance :: resolve ( def, & args) . unwrap ( ) ;
6666 let mangled_name = instance. mangled_name ( ) ;
6767 let body = instance. body ( ) ;
68- assert ! ( body. is_some( ) || mangled_name == "setpwent" , "Failed: {func:?}" ) ;
68+ assert ! ( body. is_some( ) || ( mangled_name == "setpwent" ) , "Failed: {func:?}" ) ;
69+ assert ! ( body. is_some( ) ^ instance. is_foreign_item( ) ) ;
6970 }
7071 Goto { .. } | Assert { .. } | SwitchInt { .. } | Return | Drop { .. } => {
7172 /* Do nothing */
You can’t perform that action at this time.
0 commit comments