Skip to content

Task-local data should not require managed boxes #6004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brson opened this issue Apr 22, 2013 · 3 comments
Closed

Task-local data should not require managed boxes #6004

brson opened this issue Apr 22, 2013 · 3 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@brson
Copy link
Contributor

brson commented Apr 22, 2013

As written, using task local data at all, even to store owned data, involves allocating on the local heap, turning on the GC. Because of this, many tasks that otherwise would not use GC are forced to.

Rewrite the TLS implementation and interface to not require the local heap.

@brson
Copy link
Contributor Author

brson commented Apr 22, 2013

Nominating this for a 1.0 milestone.

@nikomatsakis
Copy link
Contributor

Also we should not be using fns as keys, perhaps type descriptors

@alexcrichton
Copy link
Member

Although not the same issue, #3273 has some interesting information which may be related to this (especially if there ends up being a complete rewrite of task-local data)

bors added a commit that referenced this issue Jul 12, 2013
cc #6004 and #3273

This is a rewrite of TLS to get towards not requiring `@` when using task local storage. Most of the rewrite is straightforward, although there are two caveats:

1. Changing `local_set` to not require `@` is blocked on #7673
2. The code in `local_pop` is some of the most unsafe code I've written. A second set of eyes should definitely scrutinize it...

The public-facing interface currently hasn't changed, although it will have to change because `local_data::get` cannot return `Option<T>`, nor can it return `Option<&T>` (the lifetime isn't known). This will have to be changed to be given a closure which yield `&T` (or as an Option). I didn't do this part of the api rewrite in this pull request as I figured that it could wait until when `@` is fully removed.

This also doesn't deal with the issue of using something other than functions as keys, but I'm looking into using static slices (as mentioned in the issues).
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 10, 2020
…, r=ebroto

Simplify `clippy::default_trait_access`

Remove repeated matching on the same QPath.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

3 participants