From 8b64988575d4b71616620bd78d9c2e9a4f526232 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 30 Jul 2022 09:41:19 +0000 Subject: Fix error message with non-tupled bare fn trait --- src/test/ui/mismatched_types/E0631.rs | 4 ++-- src/test/ui/mismatched_types/E0631.stderr | 24 ++++++++----------- src/test/ui/mismatched_types/closure-arg-count.rs | 4 ++-- .../ui/mismatched_types/closure-arg-count.stderr | 27 ++++++++-------------- .../ui/unboxed-closures/non-tupled-arg-mismatch.rs | 8 +++++++ .../non-tupled-arg-mismatch.stderr | 17 ++++++++++++++ 6 files changed, 49 insertions(+), 35 deletions(-) create mode 100644 src/test/ui/unboxed-closures/non-tupled-arg-mismatch.rs create mode 100644 src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr (limited to 'src') diff --git a/src/test/ui/mismatched_types/E0631.rs b/src/test/ui/mismatched_types/E0631.rs index a2939465830..e66ef6aaeda 100644 --- a/src/test/ui/mismatched_types/E0631.rs +++ b/src/test/ui/mismatched_types/E0631.rs @@ -5,7 +5,7 @@ fn bar>(_: F) {} fn main() { fn f(_: u64) {} foo(|_: isize| {}); //~ ERROR type mismatch - bar(|_: isize| {}); //~ ERROR type mismatch + bar(|_: isize| {}); //~ ERROR mismatched types foo(f); //~ ERROR type mismatch - bar(f); //~ ERROR type mismatch + bar(f); //~ ERROR mismatched types } diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 4d673d45559..fefb6fea4eb 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -14,16 +14,14 @@ note: required by a bound in `foo` LL | fn foo(_: F) {} | ^^^^^^^^^ required by this bound in `foo` -error[E0631]: type mismatch in closure arguments +error[E0308]: mismatched types --> $DIR/E0631.rs:8:5 | LL | bar(|_: isize| {}); - | ^^^ ---------- found signature defined here - | | - | expected due to this + | ^^^ types differ | - = note: expected closure signature `fn(usize) -> _` - found closure signature `fn(isize) -> _` + = note: expected trait `Fn` + found trait `Fn<(isize,)>` note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | @@ -49,19 +47,16 @@ note: required by a bound in `foo` LL | fn foo(_: F) {} | ^^^^^^^^^ required by this bound in `foo` -error[E0631]: type mismatch in function arguments +error[E0308]: mismatched types --> $DIR/E0631.rs:10:9 | -LL | fn f(_: u64) {} - | ------------ found signature defined here -... LL | bar(f); - | --- ^ expected due to this + | --- ^ types differ | | | required by a bound introduced by this call | - = note: expected function signature `fn(usize) -> _` - found function signature `fn(u64) -> _` + = note: expected trait `Fn` + found trait `Fn<(u64,)>` note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | @@ -70,4 +65,5 @@ LL | fn bar>(_: F) {} error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0631`. +Some errors have detailed explanations: E0308, E0631. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs index e817631ad5d..b6759d750c8 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.rs +++ b/src/test/ui/mismatched_types/closure-arg-count.rs @@ -11,9 +11,9 @@ fn main() { [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!()); //~^ ERROR closure is expected to take f(|| panic!()); - //~^ ERROR closure is expected to take + //~^ ERROR mismatched types f( move || panic!()); - //~^ ERROR closure is expected to take + //~^ ERROR mismatched types let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); //~^ ERROR closure is expected to take diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index 3968774e357..d13e5d682da 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -45,41 +45,33 @@ help: change the closure to take multiple arguments instead of a single tuple LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); | ~~~~~~~~~~~~~~~ -error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments +error[E0308]: mismatched types --> $DIR/closure-arg-count.rs:13:5 | LL | f(|| panic!()); - | ^ -- takes 0 arguments - | | - | expected closure that takes 1 argument + | ^ types differ | + = note: expected trait `Fn` + found trait `Fn<()>` note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 | LL | fn f>(_: F) {} | ^^^^^^^^^ required by this bound in `f` -help: consider changing the closure to take and ignore the expected argument - | -LL | f(|_| panic!()); - | ~~~ -error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments +error[E0308]: mismatched types --> $DIR/closure-arg-count.rs:15:5 | LL | f( move || panic!()); - | ^ ---------- takes 0 arguments - | | - | expected closure that takes 1 argument + | ^ types differ | + = note: expected trait `Fn` + found trait `Fn<()>` note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 | LL | fn f>(_: F) {} | ^^^^^^^^^ required by this bound in `f` -help: consider changing the closure to take and ignore the expected argument - | -LL | f( move |_| panic!()); - | ~~~ error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:18:53 @@ -198,4 +190,5 @@ LL | fn call(_: F) where F: FnOnce() -> R {} error: aborting due to 14 previous errors -For more information about this error, try `rustc --explain E0593`. +Some errors have detailed explanations: E0308, E0593. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.rs b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.rs new file mode 100644 index 00000000000..925463d6dee --- /dev/null +++ b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.rs @@ -0,0 +1,8 @@ +#![feature(unboxed_closures)] + +fn a>(f: F) {} + +fn main() { + a(|_: usize| {}); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr new file mode 100644 index 00000000000..9a24fb8c2be --- /dev/null +++ b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/non-tupled-arg-mismatch.rs:6:5 + | +LL | a(|_: usize| {}); + | ^ types differ + | + = note: expected trait `Fn` + found trait `Fn<(usize,)>` +note: required by a bound in `a` + --> $DIR/non-tupled-arg-mismatch.rs:3:9 + | +LL | fn a>(f: F) {} + | ^^^^^^^^^ required by this bound in `a` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. -- cgit 1.4.1-3-g733a5 From 1c084f15f308f1d977fd763c3d8bed831b44abf2 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 30 Jul 2022 09:44:22 +0000 Subject: Correct meaning of two UI tests --- src/test/ui/mismatched_types/E0631.rs | 6 ++-- src/test/ui/mismatched_types/E0631.stderr | 32 +++++++++++--------- src/test/ui/mismatched_types/closure-arg-count.rs | 6 ++-- .../ui/mismatched_types/closure-arg-count.stderr | 35 +++++++++++++--------- 4 files changed, 45 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/test/ui/mismatched_types/E0631.rs b/src/test/ui/mismatched_types/E0631.rs index e66ef6aaeda..83dbdb77abe 100644 --- a/src/test/ui/mismatched_types/E0631.rs +++ b/src/test/ui/mismatched_types/E0631.rs @@ -1,11 +1,11 @@ #![feature(unboxed_closures)] fn foo(_: F) {} -fn bar>(_: F) {} +fn bar>(_: F) {} fn main() { fn f(_: u64) {} foo(|_: isize| {}); //~ ERROR type mismatch - bar(|_: isize| {}); //~ ERROR mismatched types + bar(|_: isize| {}); //~ ERROR type mismatch foo(f); //~ ERROR type mismatch - bar(f); //~ ERROR mismatched types + bar(f); //~ ERROR type mismatch } diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index fefb6fea4eb..410ea4b0b34 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -14,19 +14,21 @@ note: required by a bound in `foo` LL | fn foo(_: F) {} | ^^^^^^^^^ required by this bound in `foo` -error[E0308]: mismatched types +error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:8:5 | LL | bar(|_: isize| {}); - | ^^^ types differ + | ^^^ ---------- found signature defined here + | | + | expected due to this | - = note: expected trait `Fn` - found trait `Fn<(isize,)>` + = note: expected closure signature `fn(usize) -> _` + found closure signature `fn(isize) -> _` note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | -LL | fn bar>(_: F) {} - | ^^^^^^^^^ required by this bound in `bar` +LL | fn bar>(_: F) {} + | ^^^^^^^^^^^^ required by this bound in `bar` error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:9:9 @@ -47,23 +49,25 @@ note: required by a bound in `foo` LL | fn foo(_: F) {} | ^^^^^^^^^ required by this bound in `foo` -error[E0308]: mismatched types +error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:10:9 | +LL | fn f(_: u64) {} + | ------------ found signature defined here +... LL | bar(f); - | --- ^ types differ + | --- ^ expected due to this | | | required by a bound introduced by this call | - = note: expected trait `Fn` - found trait `Fn<(u64,)>` + = note: expected function signature `fn(usize) -> _` + found function signature `fn(u64) -> _` note: required by a bound in `bar` --> $DIR/E0631.rs:4:11 | -LL | fn bar>(_: F) {} - | ^^^^^^^^^ required by this bound in `bar` +LL | fn bar>(_: F) {} + | ^^^^^^^^^^^^ required by this bound in `bar` error: aborting due to 4 previous errors -Some errors have detailed explanations: E0308, E0631. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0631`. diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs index b6759d750c8..65c8d6a7e93 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.rs +++ b/src/test/ui/mismatched_types/closure-arg-count.rs @@ -1,6 +1,6 @@ #![feature(unboxed_closures)] -fn f>(_: F) {} +fn f>(_: F) {} fn main() { [1, 2, 3].sort_by(|| panic!()); //~^ ERROR closure is expected to take @@ -11,9 +11,9 @@ fn main() { [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!()); //~^ ERROR closure is expected to take f(|| panic!()); - //~^ ERROR mismatched types + //~^ ERROR closure is expected to take f( move || panic!()); - //~^ ERROR mismatched types + //~^ ERROR closure is expected to take let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); //~^ ERROR closure is expected to take diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index d13e5d682da..a02ec819838 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -45,33 +45,41 @@ help: change the closure to take multiple arguments instead of a single tuple LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); | ~~~~~~~~~~~~~~~ -error[E0308]: mismatched types +error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:13:5 | LL | f(|| panic!()); - | ^ types differ + | ^ -- takes 0 arguments + | | + | expected closure that takes 1 argument | - = note: expected trait `Fn` - found trait `Fn<()>` note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 | -LL | fn f>(_: F) {} - | ^^^^^^^^^ required by this bound in `f` +LL | fn f>(_: F) {} + | ^^^^^^^^^^^^ required by this bound in `f` +help: consider changing the closure to take and ignore the expected argument + | +LL | f(|_| panic!()); + | ~~~ -error[E0308]: mismatched types +error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:15:5 | LL | f( move || panic!()); - | ^ types differ + | ^ ---------- takes 0 arguments + | | + | expected closure that takes 1 argument | - = note: expected trait `Fn` - found trait `Fn<()>` note: required by a bound in `f` --> $DIR/closure-arg-count.rs:3:9 | -LL | fn f>(_: F) {} - | ^^^^^^^^^ required by this bound in `f` +LL | fn f>(_: F) {} + | ^^^^^^^^^^^^ required by this bound in `f` +help: consider changing the closure to take and ignore the expected argument + | +LL | f( move |_| panic!()); + | ~~~ error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:18:53 @@ -190,5 +198,4 @@ LL | fn call(_: F) where F: FnOnce() -> R {} error: aborting due to 14 previous errors -Some errors have detailed explanations: E0308, E0593. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0593`. -- cgit 1.4.1-3-g733a5 From 84629a5ab1b9e93c631c25a002b08c57ae8c1d4e Mon Sep 17 00:00:00 2001 From: yukang Date: Tue, 16 Aug 2022 10:50:04 +0800 Subject: Extend invalid floating point literal suffix suggestion --- compiler/rustc_typeck/src/check/expr.rs | 30 ++++++++++++----- src/test/ui/attempted-access-non-fatal.rs | 4 +++ src/test/ui/attempted-access-non-fatal.stderr | 46 ++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index a685add7f56..92bf03ea665 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -2159,7 +2159,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { E0610, "`{expr_t}` is a primitive type and therefore doesn't have fields", ); - let is_valid_suffix = |field: String| { + let is_valid_suffix = |field: &str| { if field == "f32" || field == "f64" { return true; } @@ -2184,20 +2184,34 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let suffix = chars.collect::(); suffix.is_empty() || suffix == "f32" || suffix == "f64" }; + let is_likely_suffix = |fist_chars: &[char], field: &str| { + field.len() >= 1 + && field.to_lowercase().starts_with(fist_chars) + && field[1..].chars().all(|c| c.is_ascii_digit()) + }; if let ty::Infer(ty::IntVar(_)) = expr_t.kind() && let ExprKind::Lit(Spanned { node: ast::LitKind::Int(_, ast::LitIntType::Unsuffixed), .. }) = base.kind && !base.span.from_expansion() - && is_valid_suffix(field_name) { - err.span_suggestion_verbose( - field.span.shrink_to_lo(), - "If the number is meant to be a floating point number, consider adding a `0` after the period", - '0', - Applicability::MaybeIncorrect, - ); + let msg = "If the number is meant to be a floating point number, consider adding a `0` after the period"; + if is_valid_suffix(&field_name) { + err.span_suggestion_verbose( + field.span.shrink_to_lo(), + msg, + '0', + Applicability::MaybeIncorrect, + ); + } else if is_likely_suffix(&['f', 'l'], &field_name) { + err.span_suggestion_verbose( + field.span, + format!("{}, valid float format are `f32` and `f64`", msg), + "0f32", + Applicability::MaybeIncorrect, + ); + } } err.emit(); } diff --git a/src/test/ui/attempted-access-non-fatal.rs b/src/test/ui/attempted-access-non-fatal.rs index e50c1f23c51..15deb9e2f60 100644 --- a/src/test/ui/attempted-access-non-fatal.rs +++ b/src/test/ui/attempted-access-non-fatal.rs @@ -3,4 +3,8 @@ fn main() { let x = 0; let _ = x.foo; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] let _ = x.bar; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 0.f; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 2.l; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 12.F; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 34.L; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] } diff --git a/src/test/ui/attempted-access-non-fatal.stderr b/src/test/ui/attempted-access-non-fatal.stderr index 5b7db0e9d6f..856dba2b2e4 100644 --- a/src/test/ui/attempted-access-non-fatal.stderr +++ b/src/test/ui/attempted-access-non-fatal.stderr @@ -10,6 +10,50 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | let _ = x.bar; | ^^^ -error: aborting due to 2 previous errors +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/attempted-access-non-fatal.rs:6:15 + | +LL | let _ = 0.f; + | ^ + | +help: If the number is meant to be a floating point number, consider adding a `0` after the period, valid float format are `f32` and `f64` + | +LL | let _ = 0.0f32; + | ~~~~ + +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/attempted-access-non-fatal.rs:7:15 + | +LL | let _ = 2.l; + | ^ + | +help: If the number is meant to be a floating point number, consider adding a `0` after the period, valid float format are `f32` and `f64` + | +LL | let _ = 2.0f32; + | ~~~~ + +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/attempted-access-non-fatal.rs:8:16 + | +LL | let _ = 12.F; + | ^ + | +help: If the number is meant to be a floating point number, consider adding a `0` after the period, valid float format are `f32` and `f64` + | +LL | let _ = 12.0f32; + | ~~~~ + +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/attempted-access-non-fatal.rs:9:16 + | +LL | let _ = 34.L; + | ^ + | +help: If the number is meant to be a floating point number, consider adding a `0` after the period, valid float format are `f32` and `f64` + | +LL | let _ = 34.0f32; + | ~~~~ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0610`. -- cgit 1.4.1-3-g733a5 From 96c91afebb5a01e6076a7f3de44ea3f2584d9099 Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Tue, 16 Aug 2022 16:51:52 +0900 Subject: compiletest: fix typo in runtest.rs nonexistant -> nonexistent --- src/tools/compiletest/src/runtest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 47f2a2d3482..3e9e5a03d5e 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3761,7 +3761,7 @@ impl<'test> TestCx<'test> { fn delete_file(&self, file: &PathBuf) { if !file.exists() { - // Deleting a nonexistant file would error. + // Deleting a nonexistent file would error. return; } if let Err(e) = fs::remove_file(file) { -- cgit 1.4.1-3-g733a5 From 89a51a1a483fcf411ab0d9e6416b6d91600d69d9 Mon Sep 17 00:00:00 2001 From: yukang Date: Tue, 16 Aug 2022 19:12:36 +0800 Subject: use proper words in help message for floating point --- compiler/rustc_typeck/src/check/expr.rs | 21 +++++++++++++-------- src/test/ui/attempted-access-non-fatal.stderr | 12 ++++++------ ...ing-missing-zero-to-floating-point-number.stderr | 14 +++++++------- 3 files changed, 26 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index 92bf03ea665..51182d2a40d 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -2184,10 +2184,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let suffix = chars.collect::(); suffix.is_empty() || suffix == "f32" || suffix == "f64" }; - let is_likely_suffix = |fist_chars: &[char], field: &str| { - field.len() >= 1 - && field.to_lowercase().starts_with(fist_chars) + let maybe_partial_suffix = |field: &str| -> Option<&str> { + let first_chars = ['f', 'l']; + if field.len() >= 1 + && field.to_lowercase().starts_with(first_chars) && field[1..].chars().all(|c| c.is_ascii_digit()) + { + if field.to_lowercase().starts_with(['f']) { Some("f32") } else { Some("f64") } + } else { + None + } }; if let ty::Infer(ty::IntVar(_)) = expr_t.kind() && let ExprKind::Lit(Spanned { @@ -2196,19 +2202,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }) = base.kind && !base.span.from_expansion() { - let msg = "If the number is meant to be a floating point number, consider adding a `0` after the period"; if is_valid_suffix(&field_name) { err.span_suggestion_verbose( field.span.shrink_to_lo(), - msg, + "if intended to be a floating point literal, consider adding a `0` after the period", '0', Applicability::MaybeIncorrect, ); - } else if is_likely_suffix(&['f', 'l'], &field_name) { + } else if let Some(correct_suffix) = maybe_partial_suffix(&field_name) { err.span_suggestion_verbose( field.span, - format!("{}, valid float format are `f32` and `f64`", msg), - "0f32", + format!("if intended to be a floating point literal, consider adding a `0` after the period and a `{correct_suffix}` suffix"), + format!("0{correct_suffix}"), Applicability::MaybeIncorrect, ); } diff --git a/src/test/ui/attempted-access-non-fatal.stderr b/src/test/ui/attempted-access-non-fatal.stderr index 856dba2b2e4..bff669727a1 100644 --- a/src/test/ui/attempted-access-non-fatal.stderr +++ b/src/test/ui/attempted-access-non-fatal.stderr @@ -16,7 +16,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | let _ = 0.f; | ^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period, valid float format are `f32` and `f64` +help: if intended to be a floating point literal, consider adding a `0` after the period and a `f32` suffix | LL | let _ = 0.0f32; | ~~~~ @@ -27,9 +27,9 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | let _ = 2.l; | ^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period, valid float format are `f32` and `f64` +help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | -LL | let _ = 2.0f32; +LL | let _ = 2.0f64; | ~~~~ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields @@ -38,7 +38,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | let _ = 12.F; | ^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period, valid float format are `f32` and `f64` +help: if intended to be a floating point literal, consider adding a `0` after the period and a `f32` suffix | LL | let _ = 12.0f32; | ~~~~ @@ -49,9 +49,9 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | let _ = 34.L; | ^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period, valid float format are `f32` and `f64` +help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | -LL | let _ = 34.0f32; +LL | let _ = 34.0f64; | ~~~~ error: aborting due to 6 previous errors diff --git a/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr b/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr index e8e069708a8..503015f3bec 100644 --- a/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr +++ b/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr @@ -4,7 +4,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.e1; | ^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0e1; | + @@ -15,7 +15,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.E1; | ^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0E1; | + @@ -26,7 +26,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.f32; | ^^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0f32; | + @@ -37,7 +37,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.f64; | ^^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0f64; | + @@ -48,7 +48,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.e+12; | ^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0e+12; | + @@ -59,7 +59,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.e-12; | ^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0e-12; | + @@ -70,7 +70,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields LL | 2.e1f32; | ^^^^^ | -help: If the number is meant to be a floating point number, consider adding a `0` after the period +help: if intended to be a floating point literal, consider adding a `0` after the period | LL | 2.0e1f32; | + -- cgit 1.4.1-3-g733a5