Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errors · qinheping/verify-rust-std@3e5c662 (original) (raw)

10 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
2 +#![allow(static_mut_refs)]
3 +
1 4 use std::panic::{catch_unwind, AssertUnwindSafe};
2 5 use std::thread;
3 6
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
2 +#![allow(static_mut_refs)]
3 +
1 4 use core::iter::TrustedLen;
2 5
3 6 use super::*;
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
1 1 #![deny(warnings)]
2 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
3 +#![allow(static_mut_refs)]
2 4
3 5 use std::cell::RefCell;
4 6 use std::fmt::{self, Write};
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
2 +#![allow(static_mut_refs)]
3 +
1 4 use core::alloc::{Allocator, Layout};
2 5 use core::num::NonZero;
3 6 use core::ptr::NonNull;
@@ -1284,6 +1287,8 @@ fn test_from_iter_specialization_panic_during_iteration_drops() {
1284 1287
1285 1288 #[test]
1286 1289 #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
1290 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
1291 +#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
1287 1292 fn test_from_iter_specialization_panic_during_drop_doesnt_leak() {
1288 1293 static mut DROP_COUNTER_OLD: [usize; 5] = [0; 5];
1289 1294 static mut DROP_COUNTER_NEW: [usize; 2] = [0; 2];
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
2 +#![allow(static_mut_refs)]
3 +
1 4 use core::num::NonZero;
2 5 use std::assert_matches::assert_matches;
3 6 use std::collections::vec_deque::Drain;
Original file line number Diff line number Diff line change
@@ -228,6 +228,8 @@ fn static_init() {
228 228 }
229 229
230 230 #[test]
231 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
232 +#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
231 233 fn atomic_access_bool() {
232 234 static mut ATOMIC: AtomicBool = AtomicBool::new(false);
233 235
Original file line number Diff line number Diff line change
@@ -291,6 +291,8 @@ cfg_if::cfg_if! {
291 291 }
292 292 }
293 293
294 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
295 +#[allow(static_mut_refs)]
294 296 pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
295 297 use core::intrinsics::atomic_store_seqcst;
296 298
Original file line number Diff line number Diff line change
@@ -9,6 +9,9 @@
9 9 //! Consider the following code, operating on some global static variables:
10 10 //!
11 11 //! ```rust
12 +//! // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
13 +//! #![allow(static_mut_refs)]
14 +//!
12 15 //! static mut A: u32 = 0;
13 16 //! static mut B: u32 = 0;
14 17 //! static mut C: u32 = 0;
Original file line number Diff line number Diff line change
@@ -16,6 +16,9 @@
16 16 //! The crate itself provides a global allocator which on wasm has no
17 17 //! synchronization as there are no threads!
18 18
19 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
20 +#![allow(static_mut_refs)]
21 +
19 22 use crate::alloc::{GlobalAlloc, Layout, System};
20 23
21 24 static mut DLMALLOC: dlmalloc::Dlmalloc = dlmalloc::Dlmalloc::new();
Original file line number Diff line number Diff line change
@@ -103,6 +103,9 @@ fn smoke_dtor() {
103 103
104 104 #[test]
105 105 fn circular() {
106 +// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
107 +#![allow(static_mut_refs)]
108 +
106 109 struct S1(&'static LocalKey<UnsafeCell<Option<S1>>>, &'static LocalKey<UnsafeCell<Option<S2>>>);
107 110 struct S2(&'static LocalKey<UnsafeCell<Option<S1>>>, &'static LocalKey<UnsafeCell<Option<S2>>>);
108 111 thread_local!(static K1: UnsafeCell<Option<S1>> = UnsafeCell::new(None));