Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
72a5cbb
Edit documentation for `std::{f32,f64}::mul_add`.
fu5ha Sep 21, 2020
a6d98d8
generalize warning
fu5ha Oct 13, 2020
87c1fdb
Make the kernel_copy tests more robust/concurrent.
vext01 Nov 24, 2020
36363e5
Refine E0212 error message
sasurau4 Dec 4, 2020
a1e94cd
Add long explanation for E0212
sasurau4 Dec 2, 2020
87c6216
Update some associated-types ui test suites
sasurau4 Dec 2, 2020
12db222
Dogfood 'str_split_once() with `compiler/`
Eric-Arellano Dec 7, 2020
d6baf38
Dogfood 'str_split_once() with Tidy
Eric-Arellano Dec 7, 2020
7bd47bd
Dogfood 'str_split_once() with linkchecker
Eric-Arellano Dec 7, 2020
85e9ea0
Dogfood 'str_split_once() with librustdoc
Eric-Arellano Dec 7, 2020
d2de69d
Dogfood 'str_split_once()` in the std lib
Eric-Arellano Dec 7, 2020
f68cc68
Review feedback for collect_intra_doc_links.rs
Eric-Arellano Dec 7, 2020
a3174de
Fix net.rs - rsplitn() returns a reverse iterator
Eric-Arellano Dec 7, 2020
989edf4
Review feedback
Eric-Arellano Dec 8, 2020
4e21942
Clarify the 'default is only allowed on...' error
camelid Dec 9, 2020
33ae62c
Clarify that String::split_at takes a byte index.
frewsxcv Dec 9, 2020
56d9784
Fix typo in `wrapping_shl` documentation
Pratyush Dec 9, 2020
594b451
Windows TLS: ManuallyDrop instead of mem::forget
RalfJung Dec 10, 2020
2363a20
Make search results tab and help button focusable with keyboard
GuillaumeGomez Dec 10, 2020
caab16f
Update const-fn doc in unstable-book
sasurau4 Dec 9, 2020
169c59f
Add some core::cmp::Ordering helpers
jnqnfe Dec 10, 2020
3918b82
Use `def_path_hash_to_def_id` when re-using a `RawDefId`
Aaron1011 Dec 10, 2020
40ed0f6
Use Symbol for inline asm register class names
sivadeilra Dec 10, 2020
f7306b1
Add tracking issue template for library features.
m-ou-se Dec 4, 2020
56c46f8
Rollup merge of #77027 - termhn:mul_add_doc_change, r=m-ou-se
Dylan-DPC Dec 10, 2020
d7502b4
Rollup merge of #79375 - vext01:kernel-copy-temps, r=bjorn3
Dylan-DPC Dec 10, 2020
c124229
Rollup merge of #79639 - sasurau4:feature/add-long-explanation-E0212,…
Dylan-DPC Dec 10, 2020
57a2216
Rollup merge of #79656 - jnqnfe:ordering, r=sfackler
Dylan-DPC Dec 10, 2020
6e26af9
Rollup merge of #79698 - m-ou-se:libs-tracking-issue-template, r=KodrAus
Dylan-DPC Dec 10, 2020
63bc8ce
Rollup merge of #79809 - Eric-Arellano:split-once, r=matklad
Dylan-DPC Dec 10, 2020
d278665
Rollup merge of #79851 - camelid:better-error-for-default-fn, r=david…
Dylan-DPC Dec 10, 2020
d2e11c5
Rollup merge of #79858 - sasurau4:doc/update-unstable-book-const-fn, …
Dylan-DPC Dec 10, 2020
f053d6b
Rollup merge of #79860 - rust-lang:frewsxcv-patch-2, r=jyn514
Dylan-DPC Dec 10, 2020
e28134c
Rollup merge of #79871 - Pratyush:patch-1, r=joshtriplett
Dylan-DPC Dec 10, 2020
e72720b
Rollup merge of #79893 - RalfJung:forget-windows, r=oli-obk
Dylan-DPC Dec 10, 2020
dfc3dc1
Rollup merge of #79896 - GuillaumeGomez:more-elements-focus, r=Manish…
Dylan-DPC Dec 10, 2020
75e5d21
Rollup merge of #79915 - Aaron1011:fix/fix-reuse-def-path-hash, r=pet…
Dylan-DPC Dec 10, 2020
c0c879e
Rollup merge of #79917 - sivadeilra:asm_symbols, r=petrochenkov
Dylan-DPC Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Windows TLS: ManuallyDrop instead of mem::forget
  • Loading branch information
RalfJung committed Dec 10, 2020
commit 594b451ccc65329a3f5e60f5b6690bcd0f7e9e7b
11 changes: 4 additions & 7 deletions library/std/src/sys/windows/thread_local_key.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::mem;
use crate::mem::ManuallyDrop;
use crate::ptr;
use crate::sync::atomic::AtomicPtr;
use crate::sync::atomic::Ordering::SeqCst;
Expand Down Expand Up @@ -111,16 +111,13 @@ struct Node {
}

unsafe fn register_dtor(key: Key, dtor: Dtor) {
let mut node = Box::new(Node { key, dtor, next: ptr::null_mut() });
let mut node = ManuallyDrop::new(Box::new(Node { key, dtor, next: ptr::null_mut() }));

let mut head = DTORS.load(SeqCst);
loop {
node.next = head;
match DTORS.compare_exchange(head, &mut *node, SeqCst, SeqCst) {
Ok(_) => {
mem::forget(node);
return;
}
match DTORS.compare_exchange(head, &mut **node, SeqCst, SeqCst) {
Ok(_) => return, // nothing to drop, we successfully added the node to the list
Err(cur) => head = cur,
}
}
Expand Down