]> git.lizzy.rs Git - rust.git/blob - tests/ui/mismatched_types/issue-26480.stderr
Rollup merge of #106889 - scottmcm:windows-mut, r=cuviper
[rust.git] / tests / ui / mismatched_types / issue-26480.stderr
1 error[E0308]: mismatched types
2   --> $DIR/issue-26480.rs:16:19
3    |
4 LL |             write(stdout, $arr.as_ptr() as *const i8,
5    |             ----- arguments to this function are incorrect
6 LL |                   $arr.len() * size_of($arr[0]));
7    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `usize`
8 ...
9 LL |     write!(hello);
10    |     ------------- in this macro invocation
11    |
12 note: function defined here
13   --> $DIR/issue-26480.rs:2:8
14    |
15 LL |     fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64;
16    |        ^^^^^
17    = note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
18 help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
19    |
20 LL |                   ($arr.len() * size_of($arr[0])).try_into().unwrap());
21    |                   +                             +++++++++++++++++++++
22
23 error[E0605]: non-primitive cast: `{integer}` as `()`
24   --> $DIR/issue-26480.rs:22:19
25    |
26 LL |     ($x:expr) => ($x as ())
27    |                   ^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
28 ...
29 LL |     cast!(2);
30    |     -------- in this macro invocation
31    |
32    = note: this error originates in the macro `cast` (in Nightly builds, run with -Z macro-backtrace for more info)
33
34 error: aborting due to 2 previous errors
35
36 Some errors have detailed explanations: E0308, E0605.
37 For more information about an error, try `rustc --explain E0308`.