Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Confusing use of the term "undefined behavior" in the note of `type.str.value`

Aperta Adatta ai principianti
#2,266 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
rust
Ambito
documentation

Direzione di ricerca

Inizia dalla nota in src/types/str.md alle righe collegate, quindi leggi la sezione introduttiva citata su ciò che Reference non documenta. Modifica la nota in modo che non usi “undefined behavior” per il comportamento della libreria standard, mantenendo l’avvertenza sui buffer non UTF-8; il lavoro è completato quando la terminologia distingue chiaramente gli aspetti del linguaggio da quelli della libreria.

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

Descrizione

The note of type.str.value uses the term "undefined behavior" for what is usually denoted as "library undefined behavior" (which is by the way not a concept in the reference):

https://github.com/rust-lang/reference/blob/cf0e3915cb84e9903ef1294fc64a50b70a1da82c/src/types/str.md?plain=1#L15-L19

I believe this is confusing. The term "undefined behavior" in the reference should only be used for what is usually denoted as "language undefined behavior" since the reference is about the language. It is explicitly said in the introduction (under "what the reference is not") that the standard library is not documented by the reference:

https://github.com/rust-lang/reference/blob/cf0e3915cb84e9903ef1294fc64a50b70a1da82c/src/introduction.md?plain=1#L24-L26

Unless there is already a plan to talk about library UB in the reference (which I guess would be restricted to notes), I believe it would be preferable to avoid the terminology "undefined behavior" for library UB, and use a more evasive terminology, like "calling a str method with a non-UTF-8 buffer violates assumptions and invariants of the standard library and could result in unexpected behaviors down the line".

Lingua principale
Rust
Stelle
1.6k
Fork
607
Merge medio
6h 47m
PR unite (30g)
14

Guida per i contributori

Apri la guida per i contributori

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/reference

Tutte le issue di rust-lang/reference

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.