fix static_ptr_ty for foreign statics, and more comments in check_unsafety
This commit is contained in:
parent
cb33f956c3
commit
c1766c6372
2 changed files with 6 additions and 0 deletions
|
@ -529,8 +529,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
// Make sure that any constants in the static's type are evaluated.
|
||||
let static_ty = self.normalize_erasing_regions(ty::ParamEnv::empty(), self.type_of(def_id));
|
||||
|
||||
// Make sure that accesses to unsafe statics end up using raw pointers.
|
||||
if self.is_mutable_static(def_id) {
|
||||
self.mk_mut_ptr(static_ty)
|
||||
} else if self.is_foreign_item(def_id) {
|
||||
self.mk_imm_ptr(static_ty)
|
||||
} else {
|
||||
self.mk_imm_ref(self.lifetimes.re_erased, static_ty)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue