rust/tests/ui/numbers-arithmetic/suggest-float-literal.stderr
Esteban Küber 1bd7934d89 Point at span within local macros even when error happens in nested external macro
```
error[E0308]: mismatched types
  --> $DIR/macro-span-caller-replacement.rs:5:17
   |
LL |             s = format!("{arg}");
   |                 ^^^^^^^^^^^^^^^^ expected `&str`, found `String`
...
LL |     macro_with_format!();
   |     -------------------- in this macro invocation
   |
   = note: this error originates in the macro `format` which comes from the expansion of the macro `macro_with_format` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2025-12-10 19:27:40 +00:00

235 lines
7.8 KiB
Text

error[E0277]: cannot add `{integer}` to `f32`
--> $DIR/suggest-float-literal.rs:6:7
|
LL | x + 100
| ^ no implementation for `f32 + {integer}`
|
= help: the trait `Add<{integer}>` is not implemented for `f32`
help: the following other types implement trait `Add<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `f32` implements `Add`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f32` implements `Add<f32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `f32` implements `Add<&f32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f32` implements `Add`
= note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a floating-point literal by writing it with `.0`
|
LL | x + 100.0
| ++
error[E0277]: cannot add `{integer}` to `f64`
--> $DIR/suggest-float-literal.rs:10:7
|
LL | x + 100
| ^ no implementation for `f64 + {integer}`
|
= help: the trait `Add<{integer}>` is not implemented for `f64`
help: the following other types implement trait `Add<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `f64` implements `Add`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f64` implements `Add<f64>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `f64` implements `Add<&f64>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f64` implements `Add`
= note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a floating-point literal by writing it with `.0`
|
LL | x + 100.0
| ++
error[E0277]: cannot subtract `{integer}` from `f32`
--> $DIR/suggest-float-literal.rs:14:7
|
LL | x - 100
| ^ no implementation for `f32 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f32`
help: the following other types implement trait `Sub<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `f32` implements `Sub`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f32` implements `Sub<f32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `f32` implements `Sub<&f32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f32` implements `Sub`
= note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a floating-point literal by writing it with `.0`
|
LL | x - 100.0
| ++
error[E0277]: cannot subtract `{integer}` from `f64`
--> $DIR/suggest-float-literal.rs:18:7
|
LL | x - 100
| ^ no implementation for `f64 - {integer}`
|
= help: the trait `Sub<{integer}>` is not implemented for `f64`
help: the following other types implement trait `Sub<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `f64` implements `Sub`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f64` implements `Sub<f64>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `f64` implements `Sub<&f64>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f64` implements `Sub`
= note: this error originates in the macro `sub_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a floating-point literal by writing it with `.0`
|
LL | x - 100.0
| ++
error[E0277]: cannot multiply `f32` by `{integer}`
--> $DIR/suggest-float-literal.rs:22:7
|
LL | x * 100
| ^ no implementation for `f32 * {integer}`
|
= help: the trait `Mul<{integer}>` is not implemented for `f32`
help: the following other types implement trait `Mul<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `f32` implements `Mul`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f32` implements `Mul<f32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `f32` implements `Mul<&f32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f32` implements `Mul`
= note: this error originates in the macro `mul_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a floating-point literal by writing it with `.0`
|
LL | x * 100.0
| ++
error[E0277]: cannot multiply `f64` by `{integer}`
--> $DIR/suggest-float-literal.rs:26:7
|
LL | x * 100
| ^ no implementation for `f64 * {integer}`
|
= help: the trait `Mul<{integer}>` is not implemented for `f64`
help: the following other types implement trait `Mul<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `f64` implements `Mul`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f64` implements `Mul<f64>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `f64` implements `Mul<&f64>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f64` implements `Mul`
= note: this error originates in the macro `mul_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a floating-point literal by writing it with `.0`
|
LL | x * 100.0
| ++
error[E0277]: cannot divide `f32` by `{integer}`
--> $DIR/suggest-float-literal.rs:30:7
|
LL | x / 100
| ^ no implementation for `f32 / {integer}`
|
= help: the trait `Div<{integer}>` is not implemented for `f32`
help: the following other types implement trait `Div<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `f32` implements `Div`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f32` implements `Div<f32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `f32` implements `Div<&f32>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f32` implements `Div`
= note: this error originates in the macro `div_impl_float` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a floating-point literal by writing it with `.0`
|
LL | x / 100.0
| ++
error[E0277]: cannot divide `f64` by `{integer}`
--> $DIR/suggest-float-literal.rs:34:7
|
LL | x / 100
| ^ no implementation for `f64 / {integer}`
|
= help: the trait `Div<{integer}>` is not implemented for `f64`
help: the following other types implement trait `Div<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `f64` implements `Div`
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: in this macro invocation
--> $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f64` implements `Div<f64>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `f64` implements `Div<&f64>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&f64` implements `Div`
= note: this error originates in the macro `div_impl_float` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using a floating-point literal by writing it with `.0`
|
LL | x / 100.0
| ++
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0277`.