summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2020-11-22 14:29:46 -0800
committerCamelid <camelidcamel@gmail.com>2020-11-27 19:08:24 -0800
commita3cde636fc46bbd9ac4a66cda04349fad26f75c9 (patch)
treeee237f74a276bcdb54670f16c635ef55f4c75867 /compiler/rustc_parse/src/parser/expr.rs
parent52e3cf13aa9716f6648b1cad286ccd8d37aa315f (diff)
downloadrust-a3cde636fc46bbd9ac4a66cda04349fad26f75c9.tar.gz
rust-a3cde636fc46bbd9ac4a66cda04349fad26f75c9.zip
Update error to reflect that integer literals can have float suffixes
For example, `1` is parsed as an integer literal, but it can be turned
into a float with the suffix `f32`. Now the error calls them "numeric
literals" and notes that you can add a float suffix since they can be
either integers or floats.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index ffbf786491d..93be478fc8c 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1450,10 +1450,10 @@ impl<'a> Parser<'a> {
                         .help("valid widths are 8, 16, 32, 64 and 128")
                         .emit();
                 } else {
-                    let msg = format!("invalid suffix `{}` for integer literal", suf);
+                    let msg = format!("invalid suffix `{}` for number literal", suf);
                     self.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)")
+                        .help("the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)")
                         .emit();
                 }
             }