about summary refs log tree commit diff
path: root/src/test/ui/suggestions
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2022-11-10 07:24:22 +0900
committerTakayuki Maeda <takoyaki0316@gmail.com>2022-11-11 10:51:02 +0900
commit6018f115aa7365db39a9df1f883123076403a97b (patch)
tree7307a96b871152d5c6b6442b895a424ad8e15807 /src/test/ui/suggestions
parent004986b79b933a5c9ec160b977f791b154c8d275 (diff)
downloadrust-6018f115aa7365db39a9df1f883123076403a97b.tar.gz
rust-6018f115aa7365db39a9df1f883123076403a97b.zip
emit errors when using `RangeFrom` and `RangeTo`
Diffstat (limited to 'src/test/ui/suggestions')
-rw-r--r--src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.rs2
-rw-r--r--src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr17
2 files changed, 13 insertions, 6 deletions
diff --git a/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.rs b/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.rs
index b1eda63d56e..c1a94456268 100644
--- a/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.rs
+++ b/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.rs
@@ -1,6 +1,6 @@
 fn main() {
     let _: f64 = 0..10; //~ ERROR mismatched types
-    let _: f64 = 0..; //~ ERROR mismatched types
+    let _: f64 = 1..; //~ ERROR mismatched types
     let _: f64 = ..10; //~ ERROR mismatched types
     let _: f64 = std::ops::Range { start: 0, end: 1 }; //~ ERROR mismatched types
 }
diff --git a/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr b/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr
index 2f1d7dc230f..773f1392ae7 100644
--- a/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr
+++ b/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr
@@ -8,22 +8,25 @@ LL |     let _: f64 = 0..10;
    |
    = note: expected type `f64`
             found struct `std::ops::Range<{integer}>`
-help: remove the unnecessary `.` operator to to use a floating point literal
-   |
-LL -     let _: f64 = 0..10;
-LL +     let _: f64 = 0.10;
+help: remove the unnecessary `.` operator for a floating point literal
    |
+LL |     let _: f64 = 0.10;
+   |                   ~
 
 error[E0308]: mismatched types
   --> $DIR/unnecessary_dot_for_floating_point_literal.rs:3:18
    |
-LL |     let _: f64 = 0..;
+LL |     let _: f64 = 1..;
    |            ---   ^^^ expected `f64`, found struct `RangeFrom`
    |            |
    |            expected due to this
    |
    = note: expected type `f64`
             found struct `RangeFrom<{integer}>`
+help: remove the unnecessary `.` operator for a floating point literal
+   |
+LL |     let _: f64 = 1.;
+   |                   ~
 
 error[E0308]: mismatched types
   --> $DIR/unnecessary_dot_for_floating_point_literal.rs:4:18
@@ -35,6 +38,10 @@ LL |     let _: f64 = ..10;
    |
    = note: expected type `f64`
             found struct `RangeTo<{integer}>`
+help: remove the unnecessary `.` operator and add an integer part for a floating point literal
+   |
+LL |     let _: f64 = 0.10;
+   |                  ~~
 
 error[E0308]: mismatched types
   --> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18