Should regular assignments really retag?

Aperta
#601 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
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
compilers

Direzione di ricerca

Start with the parent unsafe-code-guidelines issue #371 and Rust issue #151728, then compare the retagging questions for assignments, function calls, and returns described here. The issue is resolved when the project reaches and records a decision about which operations should retag references and boxes.

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

Descrizione

A-aliasing-model

This issue is a part of https://github.com/rust-lang/unsafe-code-guidelines/issues/371, but it seems to me this particular design decision warrants its own thread as it is a fairly well-defined self-contained question: should a plain "e1 = e2" really retag all references (and boxes) that are being copied here?

This makes assignment a surprisingly rich operation, and even gives it a non-trivial side-effect. It is the cause of the UB in https://github.com/rust-lang/rust/issues/151728 and probably others.

The main reason we're doing this is to be consistent with function calls: there, we pretty much have to do such retags if we want to add noalias attributes for references that are being passed in fields of structs/enums. But assignments are a lot more common than function calls, so maybe it is justified to special-case function calls? Retags would then basically only happen on function calls and when there are (implicit or explicit) reference-of operators being executed. There's a lot of implicit reference-of operators inserted all over the place, but not in generic code where this issue is particularly nasty since one can easily forget reasoning about the case where T = &mut _/T = Box<_>.

Function returns are different from assignments, so the question also arises for them.

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.