Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for `thread_local` stabilization #29594
Comments
aturon
added
T-lang
B-unstable
labels
Nov 5, 2015
This comment was marked as resolved.
This comment was marked as resolved.
|
@alexcrichton Can you elaborate on the blockers? |
This comment was marked as resolved.
This comment was marked as resolved.
|
Certainly! Known issues to me:
That's at least what I can think of at this time! |
This comment has been minimized.
This comment has been minimized.
|
A note, we've since implemented |
This comment has been minimized.
This comment has been minimized.
|
Hi! Is there any update on the status? Nightly still requires statics to be
|
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Any news on |
This comment has been minimized.
This comment has been minimized.
|
@mneumann no, no progress. I'd recommend a C shim for now. |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton thanks. I am doing a shim now https://github.com/mneumann/errno-dragonfly-rs. |
Mark-Simulacrum
added
the
C-tracking-issue
label
Jul 22, 2017
kennytm
referenced this issue
Aug 11, 2017
Merged
RFC: Implicit caller location (third try to the unwrap/expect line info problem) #2091
This comment has been minimized.
This comment has been minimized.
Boiethios
commented
Sep 8, 2017
•
|
The optimizations are too aggressive ;) See this code:
The compiler does not detect the side effect in
|
This comment has been minimized.
This comment has been minimized.
|
cc @eddyb, @Boiethios your example shouldn't actually compile because it should require |
This comment has been minimized.
This comment has been minimized.
Boiethios
commented
Sep 8, 2017
|
It compiles with the last nightly rustc. |
This comment has been minimized.
This comment has been minimized.
|
Oh, drat, this is from my shortening of the lifetime, i.e rust/src/librustc/middle/mem_categorization.rs Lines 657 to 662 in dead08c @nikomatsakis what should we do here? I want a static lvalue, with a non- 'static lifetime.
|
mneumann
added a commit
to mneumann/nix-rust
that referenced
this issue
Nov 20, 2017
mneumann
added a commit
to mneumann/nix-rust
that referenced
this issue
Dec 5, 2017
mneumann
added a commit
to mneumann/nix-rust
that referenced
this issue
Dec 19, 2017
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
There's some emulation And there's #47053 which results from my initial attempt to limit references to thread-local statics to the function they were created in. |
This comment has been minimized.
This comment has been minimized.
|
@cramertj I've personally been under the impression that we're holding out on stabilizing this for as long as possible. We've stabilized very few (AFAIK) platform-specific attributes like this and I at least personally haven't ever looked to hard into stabilizing this. One blocker (in my mind at least) is what @eddyb mentioned where this is a "portable" attribute yet LLVM has a bunch of emulation on targets that don't actually support it (I think MinGW is an example). I don't believe we should allow the attribute on such targets, but we'd have to do a lot of investigation to figure out those targets. Is there motivation for stabilizing this though? That'd certainly provide some good motivation for digging out any remaining issues and looking at it very closely. I'd just personally been under the impression that there's little motivation to stabilize this other than it'd be a "nice to have" in situations here and there. |
This comment has been minimized.
This comment has been minimized.
|
I am using The only thing that I'm not too happy about is that |
This comment has been minimized.
This comment has been minimized.
|
@Amanieu Signal/interrupt-safe code has other requirements which are not satisfied by current Rust. |
This comment has been minimized.
This comment has been minimized.
|
@eddyb Not really, all you need to do is treat the signal handler as a separate thread of execution. The only requirement you need to enforce safety is that objects which are accessed by both the main thread and the signal handler must be Of course you can still cause deadlocks if the main thread and signal handler both try to grab the same lock, but that's not a safety issue. |
dcuddeback
added a commit
to dcuddeback/serial-rs
that referenced
this issue
Jun 22, 2018
This comment has been minimized.
This comment has been minimized.
|
@cramertj regarding remaining blockers, I would consider the behavior that @Boiethios reported above needs to be fixed before stabilization. I filed #54901 to follow up. |
aturon commentedNov 5, 2015
•
edited by nikomatsakis
The
#[thread_local]attribute is currently feature-gated. This issue tracks its stabilization.Known problems:
#[thread_local]translates directly to thethread_localattribute in LLVM. This isn't supported on all platforms, and it's not even supported on all distributions within the same platform (e.g. 10.6 doesn't support it but 10.7 does). I don't think this is necessarily a blocker, but I also don't think we have many attributes and such which are so platform specific like this.Sync- #18001'staticlifetime or should be unsafe to access - #17954'staticlifetime with NLL (#54366)