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

IntoIterator::IntoIter docs show incomplete trait bounds #85858

Closed
chris-morgan opened this issue May 31, 2021 · 3 comments
Closed

IntoIterator::IntoIter docs show incomplete trait bounds #85858

chris-morgan opened this issue May 31, 2021 · 3 comments
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@chris-morgan
Copy link
Member

Refer to the std::iter::IntoIterator docs (and the problem is also visible on nightly).

It shows in both the declaration code and under the “Associated Types” heading: (sans semicolon in the latter)

type IntoIter: Iterator;

This is lacking a crucial part of the bound, the Item associated type. The source shows this:

type IntoIter: Iterator<Item = Self::Item>;

I’m confused about what’s going on here because my attempts at duplicating it are unsuccessful on both stable and nightly: when I compile the docs for just this code:

pub trait IntoIterator {
    type Item;
    type IntoIter: Iterator<Item = Self::Item>;
    fn into_iter(self) -> Self::IntoIter;
}

I see Iterator<Item = Self::Item> as expected, not Iterator as in the std docs. Hence my titling this bug about IntoIterator::IntoIter, rather than about associated types or whatnot, because I can’t reproduce it elsewhere.

@chris-morgan chris-morgan added the C-bug Category: This is a bug. label May 31, 2021
@chris-morgan
Copy link
Member Author

I just checked on old docs. Until 1.48.0, it looks like rustdoc translated that associated type bound to where <Self::IntoIter as Iterator>::Item == Self::Item in the declaration (or similar; back in 1.0.0 it was where Self::IntoIter::Item == Self::Item), but in 1.49 even that vanished.

No idea why it would be translating that associated type bound, especially since non-std docs aren’t doing it.

Haaaaaang on, core isn’t exhibiting this wonkiness either, core::iter::IntoIterator is correct (and never exhibited the translation into a where clause).

So I guess it’s something peculiar to std.

@veber-alex
Copy link
Contributor

duplicate of #84579

@chris-morgan
Copy link
Member Author

Ah hah, good find; thanks.

@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 22, 2021
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-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