Add label for invalid literal suffix

This commit is contained in:
Esteban Küber 2019-01-11 23:37:49 -08:00
parent 3ead6de40d
commit 1550787b13
5 changed files with 10 additions and 8 deletions

View file

@ -520,6 +520,7 @@ fn filtered_float_lit(data: Symbol, suffix: Option<Symbol>, diag: Option<(Span,
} else {
let msg = format!("invalid suffix `{}` for float literal", suf);
diag.struct_span_err(span, &msg)
.span_label(span, format!("invalid suffix `{}`", suf))
.help("valid suffixes are `f32` and `f64`")
.emit();
}
@ -716,6 +717,7 @@ fn integer_lit(s: &str, suffix: Option<Symbol>, diag: Option<(Span, &Handler)>)
} else {
let msg = format!("invalid suffix `{}` for numeric literal", suf);
diag.struct_span_err(span, &msg)
.span_label(span, format!("invalid suffix `{}`", suf))
.help("the suffix must be one of the integral types \
(`u32`, `isize`, etc)")
.emit();

View file

@ -2,7 +2,7 @@ error: invalid suffix `is` for numeric literal
--> $DIR/old-suffixes-are-really-forbidden.rs:2:13
|
LL | let a = 1_is; //~ ERROR invalid suffix
| ^^^^
| ^^^^ invalid suffix `is`
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)
@ -10,7 +10,7 @@ error: invalid suffix `us` for numeric literal
--> $DIR/old-suffixes-are-really-forbidden.rs:3:13
|
LL | let b = 2_us; //~ ERROR invalid suffix
| ^^^^
| ^^^^ invalid suffix `us`
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)

View file

@ -82,7 +82,7 @@ error: invalid suffix `suffix` for numeric literal
--> $DIR/bad-lit-suffixes.rs:25:5
|
LL | 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal
| ^^^^^^^^^^
| ^^^^^^^^^^ invalid suffix `suffix`
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)
@ -90,7 +90,7 @@ error: invalid suffix `suffix` for numeric literal
--> $DIR/bad-lit-suffixes.rs:26:5
|
LL | 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal
| ^^^^^^^^^^^
| ^^^^^^^^^^^ invalid suffix `suffix`
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)
@ -98,7 +98,7 @@ error: invalid suffix `suffix` for float literal
--> $DIR/bad-lit-suffixes.rs:27:5
|
LL | 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal
| ^^^^^^^^^
| ^^^^^^^^^ invalid suffix `suffix`
|
= help: valid suffixes are `f32` and `f64`
@ -106,7 +106,7 @@ error: invalid suffix `suffix` for float literal
--> $DIR/bad-lit-suffixes.rs:28:5
|
LL | 1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal
| ^^^^^^^^^^^^
| ^^^^^^^^^^^^ invalid suffix `suffix`
|
= help: valid suffixes are `f32` and `f64`

View file

@ -14,7 +14,7 @@ error: invalid suffix `p4f64` for numeric literal
--> $DIR/no-binary-float-literal.rs:6:5
|
LL | 0b101p4f64;
| ^^^^^^^^^^
| ^^^^^^^^^^ invalid suffix `p4f64`
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)

View file

@ -8,7 +8,7 @@ error: invalid suffix `f` for float literal
--> $DIR/no-hex-float-literal.rs:6:18
|
LL | 0xDEAD.BEEFp-2f;
| ^^
| ^^ invalid suffix `f`
|
= help: valid suffixes are `f32` and `f64`