Closed
Description
I'm using the conservative_impl_trait
feature to elide some otherwise gnarly return types in my program. It can compile fine, but then when I try to generate documentation, rustdoc errors saying it can't figure out the return type and type annotations are required.
Wouldn't cargo
and rustdoc
both use the same rustc
under the hood? I don't see why the compiler would be able to figure out the return type, but can't when we try to generate docs.
The code in question:
pub fn find_many<T>(
&self,
collection: &str,
filter: Option<Document>,
) -> Result<impl Iterator<Item = Result<T>>>
where
T: TryFrom<Document, Error = Error> + Debug,
{
...
}
For a bit of context on the return type, I'm actually fetching a cursor from my database (which may fail), then map
-ping through them trying to deserialize the results into some T
.
error[E0282]: type annotations needed
--> src/db.rs:78:17
|
78 | ) -> Result<impl Iterator<Item = Result<T>>>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `_`
error: Compilation failed, aborting rustdoc
This happens on the latest nightly.
$ rustc --version
rustc 1.22.0-nightly (c6884b12d 2017-09-30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels