rust/tests/ui/consts/const-eval/const-eval-overflow-4b.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

47 lines
1.6 KiB
Text

error[E0308]: mismatched types
--> $DIR/const-eval-overflow-4b.rs:11:30
|
LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
| ^^^ expected `i8`, found `u8`
error[E0277]: cannot add `u8` to `i8`
--> $DIR/const-eval-overflow-4b.rs:11:28
|
LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
| ^ no implementation for `i8 + u8`
|
= help: the trait `Add<u8>` is not implemented for `i8`
help: the following other types implement trait `Add<Rhs>`
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
|
= note: `i8` 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: `&i8` implements `Add<i8>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `i8` implements `Add<&i8>`
::: $SRC_DIR/core/src/internal_macros.rs:LL:COL
|
= note: `&i8` implements `Add`
= note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0604]: only `u8` can be cast as `char`, not `i8`
--> $DIR/const-eval-overflow-4b.rs:24:13
|
LL | : [u32; 5i8 as char as usize]
| ^^^^^^^^^^^ invalid cast
|
help: consider casting from `u8` instead
--> $DIR/const-eval-overflow-4b.rs:24:13
|
LL | : [u32; 5i8 as char as usize]
| ^^^^^^^^^^^
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0277, E0308, E0604.
For more information about an error, try `rustc --explain E0277`.