Closed
Description
The compiler correctly errors about the ambiguous types, but also panics on this code:
use arrayvec::ArrayVec;
fn main() {
let mut buffer = ArrayVec::new();
let x = buffer.last().unwrap().0.clone();
buffer.reverse();
}
error[E0282]: type annotations needed
--> src/main.rs:5:13
|
5 | let x = buffer.last().unwrap().0.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `T`
|
= note: type must be known at this point
error[E0609]: no field `0` on type `&_`
--> src/main.rs:5:36
|
5 | let x = buffer.last().unwrap().0.clone();
| ^
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21