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 failing to generate docs when returning impl Iterator #43888

Closed
SergioBenitez opened this issue Aug 15, 2017 · 5 comments
Closed

rustdoc failing to generate docs when returning impl Iterator #43888

SergioBenitez opened this issue Aug 15, 2017 · 5 comments
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@SergioBenitez
Copy link
Contributor

SergioBenitez commented Aug 15, 2017

When a function returns an impl Iterator:

pub fn iter<'s>(&'s self) -> impl Iterator<Item=&'s Cookie<'static>> { ... }

rustdoc fails to build the docs with the following errors emitted in the console:

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/cookies.rs:308:34
    |
308 |     pub fn iter<'s>(&'s self) -> impl Iterator<Item=&'s Cookie<'static>> {
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

Here's the full error log from building the docs for Rocket v0.3.2:

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/cookies.rs:308:34
    |
308 |     pub fn iter<'s>(&'s self) -> impl Iterator<Item=&'s Cookie<'static>> {
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/media_type.rs:384:36
    |
384 |     pub fn params<'a>(&'a self) -> impl Iterator<Item=(&'a str, &'a str)> + 'a {
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/header.rs:216:45
    |
216 |     pub fn get<'a>(&'a self, name: &str) -> impl Iterator<Item=&'a str> {
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/header.rs:541:34
    |
541 |     pub fn iter<'s>(&'s self) -> impl Iterator<Item=Header<'s>> {
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/header.rs:587:31
    |
587 |     pub fn into_iter(self) -> impl Iterator<Item=Header<'h>> {
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/header.rs:603:16
    |
603 |             -> impl Iterator<Item=(Uncased<'h>, Vec<Cow<'h, str>>)> {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/accept.rs:294:34
    |
294 |     pub fn iter<'a>(&'a self) -> impl Iterator<Item=&'a QMediaType> + 'a {
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/http/accept.rs:324:41
    |
324 |     pub fn media_types<'a>(&'a self) -> impl Iterator<Item=&'a MediaType> + 'a {
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/config/config.rs:585:36
    |
585 |     pub fn extras<'a>(&'a self) -> impl Iterator<Item=(&'a str, &'a Value)> {
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
  --> src/router/mod.rs:64:36
   |
64 |     pub fn routes<'a>(&'a self) -> impl Iterator<Item=&'a Route> + 'a {
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
   |
   = help: the trait `std::iter::Iterator` is not implemented for `!`
   = note: the return type of a function must have a statically known size

error[E0277]: the trait bound `!: std::iter::Iterator` is not satisfied
   --> src/rocket.rs:726:36
    |
726 |     pub fn routes<'a>(&'a self) -> impl Iterator<Item=&'a Route> + 'a {
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `!` is not an iterator; maybe try calling `.iter()` or a similar method
    |
    = help: the trait `std::iter::Iterator` is not implemented for `!`
    = note: the return type of a function must have a statically known size

error: Compilation failed, aborting rustdoc
@steveklabnik
Copy link
Member

is this a dup of #43869 ?

@SergioBenitez
Copy link
Contributor Author

@steveklabnik Looks really similar, but that one errors with () not implementing Iterator, while this one remarks about !. May be the same root cause though.

@Mark-Simulacrum Mark-Simulacrum added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels Aug 20, 2017
@lilith
Copy link

lilith commented Sep 1, 2017

rust doc is giving me E0282 on Result<Box<impl Trait>> with nightly-2017-08-30. It's a regression from 2017-07-31. Seems related?

@lilith
Copy link

lilith commented Sep 1, 2017

Is there any known workaround?

@SergioBenitez
Copy link
Contributor Author

This seems to have been fixed in a recent nightly. Closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants