Commit 1932353
(bufix) debug_printf macros don't escape '{' and '}' correctly. (#167)
* Fixes a bug with the `debug_printf` and `debug_printfln` macros not escaping '{' and '}' correctly.
The `debug_printf` and `debug_printfln` passes its format string to the `asm!` macro, which uses `{` and `}` to separate its arguments. Passing `{` and `}` to `asm!` directly is incorrect, and leads to compilation issues:
```
error: invalid asm template string: expected `'}'`, found `'"'`
--> examples/shaders/sky-shader/src/lib.rs:13016:2
|
13015 | unsafe{debug_printf!("Variant3{")};
| -------------------------- in this macro invocation
13016 | unsafe{debug_printf!("fld0:")};
| ----^ expected `'}'` in asm template string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
= note: this error originates in the macro `debug_printf` (in Nightly builds, run with -Z macro-backtrace for more info)
```
This commit escapes those characters using `{{` and `}}`, which removes this issue and produces correct behaviour.
* Fix formatting
---------
Co-authored-by: FractalFir <michkos2005@gmail.com>1 parent d3f9af7 commit 1932353
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
616 | 620 | | |
617 | 621 | | |
618 | 622 | | |
| |||
0 commit comments