println/format strings only support a bare {} (no float precision, width or radix)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start by locating the parser and formatter implementation for println format strings, then trace how placeholders are parsed and how f64 values are rendered. The issue gives a reproducer using {:.2} and describes desired precision, width, padding, alignment, and integer radix support. Add the supported formatting behavior and tests for those cases; done when the reproducer formats the float as requested and unsupported syntax is handled consistently.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Feature request: println / format strings accept only a bare {}. There is no way to control the number of fraction digits of a float, width or padding.
Repro
fun main() {
var c: f64 = 0.1;
println("{:.2}", c);
}
error[E2001]: failed to parse Wave source: unsupported format placeholder `{:.2}`
The error is clear, so this is not a diagnostics problem. The gap is that {} on an f64 always prints six fraction digits (0.100000), so a program that wants 0.10, or the full precision of a double, has to format the number by hand.
I hit this while writing a JSON library in Wave: I had to implement shortest round-trip and fixed-precision double formatting myself just to print a number the way I wanted.
Suggestion
Support at least {:.N} (precision) for floats, and ideally width/fill/alignment ({:5}, {:>8}, {:08}) and an integer radix ({:x}), or document that formatting is expected to be done in library code.
Version
wavec 0.2.1-pre-beta (LLVM 21.1.8), Ubuntu 26.04, x86_64.
- Lingua principale
- Rust
- Stelle
- 56
- Fork
- 21
- Merge medio
- 23h 20m
- PR unite (30g)
- 45
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wavefnd/Wave
-
Reject unrepresentable POSIX listener descriptors before Unix-domain acceptForse già presa @ShahadatTest l’ha presa 6 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
wavefnd/Wave#1082 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Preserve expression assembly result types when recording HIR conversionsForse già presa @hiyouwhatsapp l’ha presa 1 giorno fa. Apertabug help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 53/100
I maintainer di solito rispondono entro 1 giorno
-
Preserve the previous build output when writing its Cargo receipt failsForse già presa @hiyouwhatsapp l’ha presa 2 giorni fa. Apertabug build help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
I maintainer di solito rispondono entro 1 giorno
-
Reconcile obsolete staging assets before verifying a new Nightly generationForse già presa @hiyouwhatsapp l’ha presa 2 giorni fa. Apertabug ci help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di wavefnd/Wave
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
area:frontend kind:bug priority:p3 ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug priority: medium ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
storytold/vectorcraft#6333 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug lexer
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
yara-x fails to build with rsa 0.10.0: unresolved import rsa::Pkcs1v15SignForse già presa @CfirTsabari l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 87/100
VirusTotal/yara-x#865 ·
I maintainer di solito rispondono entro 1 giorno