diff options
| author | bors <bors@rust-lang.org> | 2023-01-11 05:19:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-11 05:19:55 +0000 |
| commit | ca855e6e42787ecd062d81d53336fe6788ef51a9 (patch) | |
| tree | 15df3ac5fd47f5122bdbea20f4ed7d31ed0bd920 /library/std/src | |
| parent | bf7ea0d11b07d84cfbd18feac0ed59e6d1da87ab (diff) | |
| parent | a80498091307d8ed43f168579f1ae6aa8692bc86 (diff) | |
| download | rust-ca855e6e42787ecd062d81d53336fe6788ef51a9.tar.gz rust-ca855e6e42787ecd062d81d53336fe6788ef51a9.zip | |
Auto merge of #106708 - JohnTitor:rollup-xcmg5yv, r=JohnTitor
Rollup of 14 pull requests Successful merges: - #105194 (Add comment to cleanup_kinds) - #106521 (remove E0280) - #106628 (Remove unneeded ItemId::Primitive variant) - #106635 (std sync tests: better type name, clarifying comment) - #106642 (Add test for #106062) - #106645 ([RFC 2397] Initial implementation) - #106653 (Fix help docs for -Zallow-features) - #106657 (Remove myself from rust-lang/rust reviewers) - #106662 (specialize impl of `ToString` on `bool`) - #106669 (create helper function for `rustc_lint_defs::Level` and remove it's duplicated code) - #106671 (Change flags with a fixed default value from Option<bool> to bool) - #106689 (Fix invalid files array re-creation in rustdoc-gui tester) - #106690 (Fix scrolling for item declaration block) - #106698 (Add compiler-errors to some trait system notification groups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sync/mutex/tests.rs | 2 | ||||
| -rw-r--r-- | library/std/src/thread/local/tests.rs | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/library/std/src/sync/mutex/tests.rs b/library/std/src/sync/mutex/tests.rs index 93900566f11..1786a3c09ff 100644 --- a/library/std/src/sync/mutex/tests.rs +++ b/library/std/src/sync/mutex/tests.rs @@ -181,7 +181,7 @@ fn test_mutex_arc_poison() { let arc2 = arc.clone(); let _ = thread::spawn(move || { let lock = arc2.lock().unwrap(); - assert_eq!(*lock, 2); + assert_eq!(*lock, 2); // deliberate assertion failure to poison the mutex }) .join(); assert!(arc.lock().is_err()); diff --git a/library/std/src/thread/local/tests.rs b/library/std/src/thread/local/tests.rs index 80dc4c038d6..964c7fc5b0c 100644 --- a/library/std/src/thread/local/tests.rs +++ b/library/std/src/thread/local/tests.rs @@ -23,11 +23,11 @@ impl Signal { } } -struct Foo(Signal); +struct NotifyOnDrop(Signal); -impl Drop for Foo { +impl Drop for NotifyOnDrop { fn drop(&mut self) { - let Foo(ref f) = *self; + let NotifyOnDrop(ref f) = *self; f.notify(); } } @@ -82,18 +82,18 @@ fn states() { #[test] fn smoke_dtor() { - thread_local!(static FOO: UnsafeCell<Option<Foo>> = UnsafeCell::new(None)); + thread_local!(static FOO: UnsafeCell<Option<NotifyOnDrop>> = UnsafeCell::new(None)); run(&FOO); - thread_local!(static FOO2: UnsafeCell<Option<Foo>> = const { UnsafeCell::new(None) }); + thread_local!(static FOO2: UnsafeCell<Option<NotifyOnDrop>> = const { UnsafeCell::new(None) }); run(&FOO2); - fn run(key: &'static LocalKey<UnsafeCell<Option<Foo>>>) { + fn run(key: &'static LocalKey<UnsafeCell<Option<NotifyOnDrop>>>) { let signal = Signal::default(); let signal2 = signal.clone(); let t = thread::spawn(move || unsafe { let mut signal = Some(signal2); key.with(|f| { - *f.get() = Some(Foo(signal.take().unwrap())); + *f.get() = Some(NotifyOnDrop(signal.take().unwrap())); }); }); signal.wait(); @@ -187,13 +187,13 @@ fn self_referential() { fn dtors_in_dtors_in_dtors() { struct S1(Signal); thread_local!(static K1: UnsafeCell<Option<S1>> = UnsafeCell::new(None)); - thread_local!(static K2: UnsafeCell<Option<Foo>> = UnsafeCell::new(None)); + thread_local!(static K2: UnsafeCell<Option<NotifyOnDrop>> = UnsafeCell::new(None)); impl Drop for S1 { fn drop(&mut self) { let S1(ref signal) = *self; unsafe { - let _ = K2.try_with(|s| *s.get() = Some(Foo(signal.clone()))); + let _ = K2.try_with(|s| *s.get() = Some(NotifyOnDrop(signal.clone()))); } } } @@ -211,13 +211,13 @@ fn dtors_in_dtors_in_dtors() { fn dtors_in_dtors_in_dtors_const_init() { struct S1(Signal); thread_local!(static K1: UnsafeCell<Option<S1>> = const { UnsafeCell::new(None) }); - thread_local!(static K2: UnsafeCell<Option<Foo>> = const { UnsafeCell::new(None) }); + thread_local!(static K2: UnsafeCell<Option<NotifyOnDrop>> = const { UnsafeCell::new(None) }); impl Drop for S1 { fn drop(&mut self) { let S1(ref signal) = *self; unsafe { - let _ = K2.try_with(|s| *s.get() = Some(Foo(signal.clone()))); + let _ = K2.try_with(|s| *s.get() = Some(NotifyOnDrop(signal.clone()))); } } } |
