diff options
| author | Florian Hartwig <florian.j.hartwig@gmail.com> | 2016-01-27 21:10:35 +0100 |
|---|---|---|
| committer | Florian Hartwig <florian.j.hartwig@gmail.com> | 2016-01-27 21:10:35 +0100 |
| commit | cee96fab39299449f877c3db997d1cf421abc8af (patch) | |
| tree | 6e48ea5188e2ba500209c78c3b734a25d1f008c2 /src | |
| parent | 23dfb2fbc0e10150ec00053406d372321a09bbd6 (diff) | |
| download | rust-cee96fab39299449f877c3db997d1cf421abc8af.tar.gz rust-cee96fab39299449f877c3db997d1cf421abc8af.zip | |
Point out that char is 32 bit value
Diffstat (limited to 'src')
| -rw-r--r-- | src/types.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/types.rs b/src/types.rs index 42824c36ec6..d41896cd490 100644 --- a/src/types.rs +++ b/src/types.rs @@ -544,7 +544,9 @@ impl LateLintPass for CharLitAsU8 { if let ExprLit(ref l) = e.node { if let Lit_::LitChar(_) = l.node { if ty::TyUint(UintTy::TyU8) == cx.tcx.expr_ty(expr).sty && !in_macro(cx, expr.span) { - let msg = "casting character literal to u8."; + let msg = "casting character literal to u8. `char`s \ + are 4 bytes wide in rust, so casting to u8 \ + truncates them"; let help = format!("Consider using a byte literal \ instead:\nb{}", snippet(cx, e.span, "'x'")); |
