Crates.io | scrub |
lib.rs | scrub |
version | 0.1.0 |
source | src |
created_at | 2023-12-27 12:12:55.669261 |
updated_at | 2023-12-27 12:12:55.669261 |
description | Remove span information to improve error messages |
homepage | |
repository | https://github.com/Kyuuhachi/scrub |
max_upload_size | |
id | 1081621 |
size | 6,860 |
A macro for letting macros absolve themselves of guilt, blaming any and all errors on their callers.
For example, consider a macro that has as its contract that the input must be an expression of a specific type. If a caller breaks this contract, a part of the macro body is highlighted as the error cause, even though it obviously was the caller's fault.
error[E0308]: mismatched types
--> examples/blame.rs:3:7
|
3 | let () = $e;
| ^^ expected `A`, found `()`
...
9 | b!(A);
| -----
| | |
| | this expression has type `A`
| in this macro invocation
Now you can finally tell those callers whose fault it really is.
error[E0308]: mismatched types
--> examples/blameless.rs:11:2
|
11 | b!(A);
| ^^^-^
| | |
| | this expression has type `A`
| expected `A`, found `()`
Due to using the proc_macro_span
feature, this crate requires nightly.