提交 694f76d5 编写于 作者: V Vadim Petrochenkov

syntax: More consistent wording for some literal parsing errors

上级 fcc2f92f
......@@ -42,7 +42,7 @@ impl LitError {
.help("valid widths are 8, 16, 32, 64 and 128")
.emit();
} else {
let msg = format!("invalid suffix `{}` for numeric literal", suf);
let msg = format!("invalid suffix `{}` for integer 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)")
......@@ -71,7 +71,7 @@ impl LitError {
.emit();
}
LitError::IntTooLarge => {
diag.struct_span_err(span, "int literal is too large")
diag.struct_span_err(span, "integer literal is too large")
.emit();
}
}
......
error: invalid suffix `is` for numeric literal
error: invalid suffix `is` for integer literal
--> $DIR/old-suffixes-are-really-forbidden.rs:2:13
|
LL | let a = 1_is;
......@@ -6,7 +6,7 @@ LL | let a = 1_is;
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)
error: invalid suffix `us` for numeric literal
error: invalid suffix `us` for integer literal
--> $DIR/old-suffixes-are-really-forbidden.rs:3:13
|
LL | let b = 2_us;
......
......@@ -22,8 +22,8 @@ fn main() {
1234f1024; //~ ERROR invalid width `1024` for float literal
1234.5f1024; //~ ERROR invalid width `1024` for float literal
1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal
0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal
1234suffix; //~ ERROR invalid suffix `suffix` for integer literal
0b101suffix; //~ ERROR invalid suffix `suffix` for integer literal
1.0suffix; //~ ERROR invalid suffix `suffix` for float literal
1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal
}
......@@ -78,7 +78,7 @@ LL | 1234.5f1024;
|
= help: valid widths are 32 and 64
error: invalid suffix `suffix` for numeric literal
error: invalid suffix `suffix` for integer literal
--> $DIR/bad-lit-suffixes.rs:25:5
|
LL | 1234suffix;
......@@ -86,7 +86,7 @@ LL | 1234suffix;
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)
error: invalid suffix `suffix` for numeric literal
error: invalid suffix `suffix` for integer literal
--> $DIR/bad-lit-suffixes.rs:26:5
|
LL | 0b101suffix;
......
......@@ -2,6 +2,6 @@
fn main() {
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
//~^ ERROR int literal is too large
//~^ ERROR integer literal is too large
; // the span shouldn't point to this.
}
error: int literal is too large
error: integer literal is too large
--> $DIR/int-literal-too-large-span.rs:4:5
|
LL | 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
......
fn main() {
let __isize = 340282366920938463463374607431768211456; // 2^128
//~^ ERROR int literal is too large
//~^ ERROR integer literal is too large
}
error: int literal is too large
error: integer literal is too large
--> $DIR/issue-5544-a.rs:2:19
|
LL | let __isize = 340282366920938463463374607431768211456; // 2^128
......
fn main() {
let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff;
//~^ ERROR int literal is too large
//~^ ERROR integer literal is too large
}
error: int literal is too large
error: integer literal is too large
--> $DIR/issue-5544-b.rs:2:19
|
LL | let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff;
......
......@@ -13,8 +13,8 @@ fn main() {
0o; //~ ERROR: no valid digits
1e+; //~ ERROR: expected at least one digit in exponent
0x539.0; //~ ERROR: hexadecimal float literal is not supported
9900000000000000000000000000999999999999999999999999999999; //~ ERROR: int literal is too large
9900000000000000000000000000999999999999999999999999999999; //~ ERROR: int literal is too large
9900000000000000000000000000999999999999999999999999999999; //~ ERROR: integer literal is too large
9900000000000000000000000000999999999999999999999999999999; //~ ERROR: integer literal is too large
0x; //~ ERROR: no valid digits
0xu32; //~ ERROR: no valid digits
0ou32; //~ ERROR: no valid digits
......
......@@ -112,13 +112,13 @@ error: octal float literal is not supported
LL | 0o2f32;
| ^^^^^^ not supported
error: int literal is too large
error: integer literal is too large
--> $DIR/lex-bad-numeric-literals.rs:16:5
|
LL | 9900000000000000000000000000999999999999999999999999999999;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: int literal is too large
error: integer literal is too large
--> $DIR/lex-bad-numeric-literals.rs:17:5
|
LL | 9900000000000000000000000000999999999999999999999999999999;
......
......@@ -4,5 +4,5 @@ fn main() {
0b101.010;
//~^ ERROR binary float literal is not supported
0b101p4f64;
//~^ ERROR invalid suffix `p4f64` for numeric literal
//~^ ERROR invalid suffix `p4f64` for integer literal
}
......@@ -10,7 +10,7 @@ error: binary float literal is not supported
LL | 0b101010f64;
| ^^^^^^^^^^^ not supported
error: invalid suffix `p4f64` for numeric literal
error: invalid suffix `p4f64` for integer literal
--> $DIR/no-binary-float-literal.rs:6:5
|
LL | 0b101p4f64;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册