You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-12
Original file line number
Diff line number
Diff line change
@@ -41,11 +41,7 @@ fn as_u16(x: u64) -> u16 {
41
41
42
42
### With a nightly compiler
43
43
44
-
**We recommend enabling Rust features [`custom_inner_attributes`] and [`proc_macro_hygiene`], and compiling with the [`procmacro2_semver_exempt`] config flag, e.g.:**
**We recommend enabling Rust features [`custom_inner_attributes`] and [`proc_macro_hygiene`].**
49
45
50
46
If you enable the [`custom_inner_attributes`] and [`proc_macro_hygiene`] features, you can use `cast_checks::enable` as an inner [attribute]. Example:
51
47
@@ -59,17 +55,15 @@ mod m {
59
55
}
60
56
```
61
57
62
-
However, in our experience, this can cause panics to refer to the wrong locations.
58
+
## `CAST_CHECKS_LOG`
63
59
64
-
To help counter the above, if you compile with the [`procmacro2_semver_exempt`] config flag, `cast_checks` will include more elaborate `expect` messages. Example:
60
+
If you are concerned that some casts are not being checked, try setting `CAST_CHECKS_LOG` and passing the [`procmacro2_semver_exempt`] config flag when compiling, e.g.:
65
61
66
-
```text
67
-
thread 'checked_truncation' panicked at 'invalid cast in `x as u8` at cast_checks/tests/basic.rs:30:13: TryFromIntError(())', cast_checks/tests/basic.rs:30:13
If you are concerned that some casts are not being checked, try setting `CAST_CHECKS_LOG` when compiling. This will cause `cast_checks` to dump to standard output:
66
+
This will cause `cast_checks` to dump to standard output:
73
67
74
68
- all rewritten locations
75
69
- all modules whose contents are not visited because they are not inlined
0 commit comments