Rollup merge of #64481 - tomtau:fix/tls-error-message, r=KodrAus
A more explanatory thread local storage panic message Outside rust-std internals, TLS is usually understood as Transport Layer Security, so the existing message could be a bit puzzling when one has TLS sessions in `thread_local!`.
This commit is contained in:
commit
bc3afb76bb
@ -236,8 +236,8 @@ impl<T: 'static> LocalKey<T> {
|
|||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn with<F, R>(&'static self, f: F) -> R
|
pub fn with<F, R>(&'static self, f: F) -> R
|
||||||
where F: FnOnce(&T) -> R {
|
where F: FnOnce(&T) -> R {
|
||||||
self.try_with(f).expect("cannot access a TLS value during or \
|
self.try_with(f).expect("cannot access a Thread Local Storage value \
|
||||||
after it is destroyed")
|
during or after destruction")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Acquires a reference to the value in this TLS key.
|
/// Acquires a reference to the value in this TLS key.
|
||||||
|
Loading…
Reference in New Issue
Block a user