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> {
187
187
new_item_kind ( tables. tcx . def_kind ( tables[ item. 0 ] ) )
188
188
}
189
189
190
- fn is_foreign_item ( & self , item : CrateItem ) -> bool {
190
+ fn is_foreign_item ( & self , item : DefId ) -> bool {
191
191
let tables = self . 0 . borrow ( ) ;
192
- tables. tcx . is_foreign_item ( tables[ item. 0 ] )
192
+ tables. tcx . is_foreign_item ( tables[ item] )
193
193
}
194
194
195
195
fn adt_kind ( & self , def : AdtDef ) -> AdtKind {
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ pub trait Context {
60
60
fn item_kind ( & self , item : CrateItem ) -> ItemKind ;
61
61
62
62
/// 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 ;
64
64
65
65
/// Returns the kind of a given algebraic data type
66
66
fn adt_kind ( & self , def : AdtDef ) -> AdtKind ;
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ impl CrateItem {
120
120
}
121
121
122
122
pub fn is_foreign_item ( & self ) -> bool {
123
- with ( |cx| cx. is_foreign_item ( * self ) )
123
+ with ( |cx| cx. is_foreign_item ( self . 0 ) )
124
124
}
125
125
126
126
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 {
40
40
}
41
41
42
42
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 ( ) ) )
45
44
}
46
45
47
46
/// 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) {
65
65
let instance = Instance :: resolve ( def, & args) . unwrap ( ) ;
66
66
let mangled_name = instance. mangled_name ( ) ;
67
67
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( ) ) ;
69
70
}
70
71
Goto { .. } | Assert { .. } | SwitchInt { .. } | Return | Drop { .. } => {
71
72
/* Do nothing */
You can’t perform that action at this time.
0 commit comments