alexcrichton / alexcrichton/scoped-tls

Example does not make it clear whether one can use short-lived references

Aperta
#29 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
65
Fork
10
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

The example uses `&1`, which (due to promotion) is a `&'static` reference. So the example code could easily be written with regular `std` `thread_local!`s. `static FOO: u32` also makes it look like the thread-local stores a value, not a reference.

I think the entire point of this crate is to allow thread-locals storing short-lived references, but the example doesn't really make that clear.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.