Skip to content

Commit 650e3cb

Browse files
committed
Prefer new associated numeric consts in float error messages
1 parent 28f03ac commit 650e3cb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/rustc_lint/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ fn lint_literal<'tcx>(
439439
cx.struct_span_lint(OVERFLOWING_LITERALS, e.span, |lint| {
440440
lint.build(&format!("literal out of range for `{}`", t.name_str()))
441441
.note(&format!(
442-
"the literal `{}` does not fit into the type `{}` and will be converted to `std::{}::INFINITY`",
442+
"the literal `{}` does not fit into the type `{}` and will be converted to `{}::INFINITY`",
443443
cx.sess()
444444
.source_map()
445445
.span_to_snippet(lit.span)

src/test/ui/lint/lint-type-overflow2.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ error: literal out of range for `f32`
1717
LL | let x = -3.40282357e+38_f32;
1818
| ^^^^^^^^^^^^^^^^^^
1919
|
20-
= note: the literal `3.40282357e+38_f32` does not fit into the type `f32` and will be converted to `std::f32::INFINITY`
20+
= note: the literal `3.40282357e+38_f32` does not fit into the type `f32` and will be converted to `f32::INFINITY`
2121

2222
error: literal out of range for `f32`
2323
--> $DIR/lint-type-overflow2.rs:10:14
2424
|
2525
LL | let x = 3.40282357e+38_f32;
2626
| ^^^^^^^^^^^^^^^^^^
2727
|
28-
= note: the literal `3.40282357e+38_f32` does not fit into the type `f32` and will be converted to `std::f32::INFINITY`
28+
= note: the literal `3.40282357e+38_f32` does not fit into the type `f32` and will be converted to `f32::INFINITY`
2929

3030
error: literal out of range for `f64`
3131
--> $DIR/lint-type-overflow2.rs:11:14
3232
|
3333
LL | let x = -1.7976931348623159e+308_f64;
3434
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
3535
|
36-
= note: the literal `1.7976931348623159e+308_f64` does not fit into the type `f64` and will be converted to `std::f64::INFINITY`
36+
= note: the literal `1.7976931348623159e+308_f64` does not fit into the type `f64` and will be converted to `f64::INFINITY`
3737

3838
error: literal out of range for `f64`
3939
--> $DIR/lint-type-overflow2.rs:12:14
4040
|
4141
LL | let x = 1.7976931348623159e+308_f64;
4242
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4343
|
44-
= note: the literal `1.7976931348623159e+308_f64` does not fit into the type `f64` and will be converted to `std::f64::INFINITY`
44+
= note: the literal `1.7976931348623159e+308_f64` does not fit into the type `f64` and will be converted to `f64::INFINITY`
4545

4646
error: aborting due to 5 previous errors
4747

0 commit comments

Comments
 (0)