Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustdoc doesn't work with conservative_impl_trait while compiler does #44958

Closed
Michael-F-Bryan opened this issue Oct 1, 2017 · 2 comments
Closed

Comments

@Michael-F-Bryan
Copy link

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)
@hanna-kruppe
Copy link
Contributor

Looks like #44731

cc @kennytm

@kennytm
Copy link
Member

kennytm commented Oct 1, 2017

Yes duplicate of #44731.

Should be fixed in #44860.

@sfackler sfackler closed this as completed Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants