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
|
@ -204,6 +204,9 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
|
|||
if let [] = proj_base {
|
||||
let decl = &self.body.local_decls[place.local];
|
||||
if decl.internal {
|
||||
// If the projection root is an artifical local that we introduced when
|
||||
// desugaring `static`, give a more specific error message
|
||||
// (avoid the general "raw pointer" clause below, that would only be confusing).
|
||||
if let Some(box LocalInfo::StaticRef { def_id, .. }) = decl.local_info {
|
||||
if self.tcx.is_mutable_static(def_id) {
|
||||
self.require_unsafe(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue