Continue evaluating after incorrect float literal
This commit is contained in:
parent
65a8d7b1d8
commit
8bede50f23
@ -673,7 +673,11 @@ fn integer_lit(s: &str, suffix: Option<Symbol>, diag: Option<(Span, &Handler)>)
|
|||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
if let Some(err) = err {
|
if let Some(err) = err {
|
||||||
err!(diag, |span, diag| diag.span_err(span, err));
|
err!(diag, |span, diag| {
|
||||||
|
diag.struct_span_err(span, err)
|
||||||
|
.span_label(span, "not supported")
|
||||||
|
.emit();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return filtered_float_lit(Symbol::intern(s), Some(suf), diag)
|
return filtered_float_lit(Symbol::intern(s), Some(suf), diag)
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ error: octal float literal is not supported
|
|||||||
--> $DIR/lex-bad-numeric-literals.rs:5:5
|
--> $DIR/lex-bad-numeric-literals.rs:5:5
|
||||||
|
|
|
|
||||||
LL | 0o2f32; //~ ERROR: octal float literal is not supported
|
LL | 0o2f32; //~ ERROR: octal float literal is not supported
|
||||||
| ^^^^^^
|
| ^^^^^^ not supported
|
||||||
|
|
||||||
error: int literal is too large
|
error: int literal is too large
|
||||||
--> $DIR/lex-bad-numeric-literals.rs:16:5
|
--> $DIR/lex-bad-numeric-literals.rs:16:5
|
||||||
@ -128,13 +128,13 @@ error: octal float literal is not supported
|
|||||||
--> $DIR/lex-bad-numeric-literals.rs:23:5
|
--> $DIR/lex-bad-numeric-literals.rs:23:5
|
||||||
|
|
|
|
||||||
LL | 0o123f64; //~ ERROR: octal float literal is not supported
|
LL | 0o123f64; //~ ERROR: octal float literal is not supported
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^ not supported
|
||||||
|
|
||||||
error: binary float literal is not supported
|
error: binary float literal is not supported
|
||||||
--> $DIR/lex-bad-numeric-literals.rs:25:5
|
--> $DIR/lex-bad-numeric-literals.rs:25:5
|
||||||
|
|
|
|
||||||
LL | 0b101f64; //~ ERROR: binary float literal is not supported
|
LL | 0b101f64; //~ ERROR: binary float literal is not supported
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^ not supported
|
||||||
|
|
||||||
error: aborting due to 23 previous errors
|
error: aborting due to 23 previous errors
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
// error-pattern:binary float literal is not supported
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
0b101010f64;
|
0b101010f64;
|
||||||
|
//~^ ERROR binary float literal is not supported
|
||||||
0b101.010;
|
0b101.010;
|
||||||
|
//~^ ERROR binary float literal is not supported
|
||||||
0b101p4f64;
|
0b101p4f64;
|
||||||
|
//~^ ERROR invalid suffix `p4f64` for numeric literal
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,22 @@
|
|||||||
error: binary float literal is not supported
|
error: binary float literal is not supported
|
||||||
--> $DIR/no-binary-float-literal.rs:5:5
|
--> $DIR/no-binary-float-literal.rs:4:5
|
||||||
|
|
|
|
||||||
LL | 0b101.010;
|
LL | 0b101.010;
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: binary float literal is not supported
|
||||||
|
--> $DIR/no-binary-float-literal.rs:2:5
|
||||||
|
|
|
||||||
|
LL | 0b101010f64;
|
||||||
|
| ^^^^^^^^^^^ not supported
|
||||||
|
|
||||||
|
error: invalid suffix `p4f64` for numeric literal
|
||||||
|
--> $DIR/no-binary-float-literal.rs:6:5
|
||||||
|
|
|
||||||
|
LL | 0b101p4f64;
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: the suffix must be one of the integral types (`u32`, `isize`, etc)
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// error-pattern:hexadecimal float literal is not supported
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
0xABC.Df;
|
0xABC.Df;
|
||||||
|
//~^ ERROR `{integer}` is a primitive type and therefore doesn't have fields
|
||||||
0x567.89;
|
0x567.89;
|
||||||
|
//~^ ERROR hexadecimal float literal is not supported
|
||||||
0xDEAD.BEEFp-2f;
|
0xDEAD.BEEFp-2f;
|
||||||
|
//~^ ERROR invalid suffix `f` for float literal
|
||||||
|
//~| ERROR `{integer}` is a primitive type and therefore doesn't have fields
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,29 @@
|
|||||||
error: hexadecimal float literal is not supported
|
error: hexadecimal float literal is not supported
|
||||||
--> $DIR/no-hex-float-literal.rs:5:5
|
--> $DIR/no-hex-float-literal.rs:4:5
|
||||||
|
|
|
|
||||||
LL | 0x567.89;
|
LL | 0x567.89;
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: invalid suffix `f` for float literal
|
||||||
|
--> $DIR/no-hex-float-literal.rs:6:18
|
||||||
|
|
|
||||||
|
LL | 0xDEAD.BEEFp-2f;
|
||||||
|
| ^^
|
||||||
|
|
|
||||||
|
= help: valid suffixes are `f32` and `f64`
|
||||||
|
|
||||||
|
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
|
||||||
|
--> $DIR/no-hex-float-literal.rs:2:11
|
||||||
|
|
|
||||||
|
LL | 0xABC.Df;
|
||||||
|
| ^^
|
||||||
|
|
||||||
|
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
|
||||||
|
--> $DIR/no-hex-float-literal.rs:6:12
|
||||||
|
|
|
||||||
|
LL | 0xDEAD.BEEFp-2f;
|
||||||
|
| ^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0610`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user