You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen: Compilation error with logical explanation.
Instead, this happened: Сompilation error with weird explanation.
error[E0308]: mismatched types
--> src/main.rs:10:20
|
10 | "h" => Box::new(|x| a.get_mut(x).unwrap() as &Box<dyn Debug>)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected reference `&Box<dyn Debug>`
found reference `&Box<dyn Debug>`
error[E0308]: mismatched types
--> src/main.rs:10:20
|
10 | "h" => Box::new(|x| a.get_mut(x).unwrap() as &Box<dyn Debug>)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected type `FnOnce<(&str,)>`
found type `FnOnce<(&str,)>`
error[E0308]: mismatched types
--> src/main.rs:9:9
|
9 | / (match &b[0..=0] {
10 | | "h" => Box::new(|x| a.get_mut(x).unwrap() as &Box<dyn Debug>)
11 | | as Box<dyn FnMut(&str) -> &Box<dyn Debug>>,
12 | | "H" => Box::new(|x| a.get(x).unwrap()),
13 | | _ => unreachable!(),
14 | | })("world")
| |__________^ one type is more general than the other
|
= note: expected type `FnOnce<(&str,)>`
found type `FnOnce<(&str,)>`
error: aborting due to 3 previous errors
Meta
The same error message on both stable (1.48.0), beta (1.49.0-beta.1) and nightly (2020-11-20)
The text was updated successfully, but these errors were encountered:
I tried this code:
I expected to see this happen: Compilation error with logical explanation.
Instead, this happened: Сompilation error with weird explanation.
Meta
The same error message on both stable (1.48.0), beta (1.49.0-beta.1) and nightly (2020-11-20)
The text was updated successfully, but these errors were encountered: