I am implementing a mut_visitor over rustc_ast
, I got a compiler error with this code:
fn flat_map_item(&mut self, item: P<Item>) -> SmallVec<[P<Item>; 1]> {
let item = item.into_inner();
smallvec![P(item)]
}
I have imported smallvec, however, I don't understand how this error is reported:
error[E0053]: method `flat_map_item` has an incompatible type for trait
--> prusti-interface/src/specs/export_spec_checker.rs:18:51
|
18 | fn flat_map_item(&mut self, item: P<Item>) -> SmallVec<[P<Item>; 1]> {
| ^^^^^^^^^^^^^^^^^^^^^^
| |
| expected struct `smallvec::SmallVec`, found struct `SmallVec`
| help: change the output type to match the trait: `smallvec::SmallVec<[P<rustc_ast::Item>; 1]>`
|
= note: expected fn pointer `fn(&mut ExportSpecChecker, P<_>) -> smallvec::SmallVec<[P<rustc_ast::Item>; 1]>`
found fn pointer `fn(&mut ExportSpecChecker, P<_>) -> SmallVec<[P<rustc_ast::Item>; 1]>`
Can anyone point out what I have done wrong here?