Does `&raw const/mut $path` invalidate mutable references

Aperta
#613 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
rust
Ambito
compilers

Direzione di ricerca

The issue names no files or tests. Start by reading the aliasing question and comparing the stated TB and SB behavior for creating a raw pointer from an outstanding mutable reference; done means the project reaches a documented resolution for whether this invalidates the reference.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Here is a formal aliasing model question. It seems like this should be easy - I'm pretty sure the answer is guaranteed to be yes on TB, though it is currently no on SB.

Basically, if you have an outstanding mutable reference to some memory region, then use &raw mut $path to get a raw pointer to the same memory, but do not dereference it (for example, calling .addr() on the pointer), does this invalidate the outstanding mutable reference?

I'm using this currently as a form of thread id on a thread_local value, while initializing the same value.

Lingua principale
Nessun dato sulla lingua
Stelle
760
Fork
68
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/unsafe-code-guidelines

Tutte le issue di rust-lang/unsafe-code-guidelines

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.