error[E0308]: mismatched types
- |
- = note: expected type `()`
- found type `{integer}`
-
-error[E0308]: mismatched types
- --> $DIR/span-preservation.rs:12:20
+ --> $DIR/span-preservation.rs:11:20
|
LL | let x: usize = "hello";
- | ^^^^^^^ expected usize, found reference
- |
- = note: expected type `usize`
- found type `&'static str`
+ | ----- ^^^^^^^ expected `usize`, found `&str`
+ | |
+ | expected due to this
error[E0308]: mismatched types
- --> $DIR/span-preservation.rs:18:29
+ --> $DIR/span-preservation.rs:17:29
|
LL | fn b(x: Option<isize>) -> usize {
| ----- expected `usize` because of return type
LL | match x {
LL | Some(x) => { return x },
- | ^ expected usize, found isize
+ | ^ expected `usize`, found `isize`
+ |
+help: you can convert an `isize` to `usize` and panic if the converted value wouldn't fit
+ |
+LL | Some(x) => { return x.try_into().unwrap() },
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
- --> $DIR/span-preservation.rs:34:22
+ --> $DIR/span-preservation.rs:33:22
|
LL | let x = Foo { a: 10isize };
- | ^^^^^^^ expected usize, found isize
+ | ^^^^^^^ expected `usize`, found `isize`
error[E0560]: struct `c::Foo` has no field named `b`
- --> $DIR/span-preservation.rs:35:26
+ --> $DIR/span-preservation.rs:34:26
|
LL | let y = Foo { a: 10, b: 10isize };
| ^ `c::Foo` does not have this field
= note: available fields are: `a`
error[E0308]: mismatched types
- --> $DIR/span-preservation.rs:48:5
+ --> $DIR/span-preservation.rs:39:5
+ |
+LL | extern fn bar() {
+ | - possibly return type missing here?
+LL | 0
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/span-preservation.rs:44:5
|
LL | extern "C" fn baz() {
| - possibly return type missing here?
LL | 0
- | ^ expected (), found integer
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/span-preservation.rs:49:5
+ |
+LL | extern "Rust" fn rust_abi() {
+ | - possibly return type missing here?
+LL | 0
+ | ^ expected `()`, found integer
+
+error[E0308]: mismatched types
+ --> $DIR/span-preservation.rs:54:5
|
- = note: expected type `()`
- found type `{integer}`
+LL | extern "\x43" fn c_abi_escaped() {
+ | - possibly return type missing here?
+LL | 0
+ | ^ expected `()`, found integer
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors
Some errors have detailed explanations: E0308, E0560.
For more information about an error, try `rustc --explain E0308`.