-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add a try_with method to LocalKey #2030
Conversation
Is it normal for an RFC to go this long without comments? Is there something I can do to help the process? |
I think having a |
Another thing I didn't previously consider about the state is that it's thread local, so if you check |
It's been another two weeks since a comment - bump again. Should I continue bumping this, or is there just no interest in this? I'd do the implementation. |
The process description has this bullet point:
The first part of this has happened but the second has not (and it should, for every RFC). I'm not sure if they're just busy and haven't gotten to it, or if they accidentally overlooked the RFC. In any case I hope they don't mind if I ping them about it: @brson @alexcrichton @sfackler @BurntSushi @Kimundi @dtolnay @aturon [as far as I'm aware I can't ping @rust-lang/libs directly because I'm not on a team myself] |
Thanks for the RFC @PlasmaPower but I'm not sure that this will satisfy all current use cases for the |
@alexcrichton The RFC as it stands doesn't deprecate state. While I still haven't found a use case for state, I see why there might be one, so the RFC currently keeps it as is. |
If that's the case then this probably doesn't need an RFC and can likely just be a PR. If you'd like you can close this an submit a PR to rust-lang/rust. |
I was wondering about that! The readme did say additions to std needed an rfc, but I guess this is pretty small. I'll just wrap it into the existing state feature I guess. |
Thread local try with rust-lang/rfcs#2030 was turned into this PR (the RFC was closed, but it looks like just a PR should be good). See also: state stabilization issue: #27716 `try_with` is used in two places in std: stdio and thread_info. In stdio, it would be better if the result was passed to the closure, but in thread_info, it's better as is where the result is returned from the function call. I'm not sure which is better, but I prefer the current way as it better represents the scope.
Rendered
You probably know
LocalKey
as being the creation of thethread_local!
macro.This is my first RFC, so let me know if I'm doing anything wrong.