Rollup merge of #78101 - RalfJung:foreign-static, r=oli-obk
fix static_ptr_ty for foreign statics Cc https://github.com/rust-lang/rust/issues/74840 This does not fix that issue but fixes a problem in `static_ptr_ty` that we noticed while discussing that issue. I also added and updated a few comments. The one about `internal` locals being ignored does not seem to have been true [even in the commit that introduced it](https://github.com/rust-lang/rust/pull/44700/files#diff-ae2f3c7e2f9744f7ef43e96072b10e98d4e3fe74a3a399a3ad8a810fbe56c520R139). r? @oli-obk
This commit is contained in:
commit
83f126bedf
6 changed files with 25 additions and 17 deletions
|
@ -821,9 +821,6 @@ pub struct LocalDecl<'tcx> {
|
|||
/// flag drop flags to avoid triggering this check as they are introduced
|
||||
/// after typeck.
|
||||
///
|
||||
/// Unsafety checking will also ignore dereferences of these locals,
|
||||
/// so they can be used for raw pointers only used in a desugaring.
|
||||
///
|
||||
/// This should be sound because the drop flags are fully algebraic, and
|
||||
/// therefore don't affect the OIBIT or outlives properties of the
|
||||
/// generator.
|
||||
|
@ -1010,13 +1007,13 @@ impl<'tcx> LocalDecl<'tcx> {
|
|||
}
|
||||
|
||||
/// Returns `Some` if this is a reference to a static item that is used to
|
||||
/// access that static
|
||||
/// access that static.
|
||||
pub fn is_ref_to_static(&self) -> bool {
|
||||
matches!(self.local_info, Some(box LocalInfo::StaticRef { .. }))
|
||||
}
|
||||
|
||||
/// Returns `Some` if this is a reference to a static item that is used to
|
||||
/// access that static
|
||||
/// Returns `Some` if this is a reference to a thread-local static item that is used to
|
||||
/// access that static.
|
||||
pub fn is_ref_to_thread_local(&self) -> bool {
|
||||
match self.local_info {
|
||||
Some(box LocalInfo::StaticRef { is_thread_local, .. }) => is_thread_local,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue