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: Fn trait sugar output types are broken for inlined signatures #21801

Closed
tomjakubowski opened this Issue Jan 31, 2015 · 3 comments

Comments

Projects
None yet
6 participants
@tomjakubowski
Copy link
Contributor

tomjakubowski commented Jan 31, 2015

For example, see: http://doc.rust-lang.org/std/collections/struct.Bitv.html#method.from_fn

fn from_fn<F>(len: usize, f: F) -> Bitv 
where F: FnMut(usize), <F as FnMut(usize)>::Output == bool

Should look like:

fn from_fn<F>(len: usize, f: F) -> Bitv 
where F: FnMut(usize) -> bool

This is because of the change to use associated types for the output.

@tomjakubowski

This comment has been minimized.

Copy link
Contributor Author

tomjakubowski commented Jan 31, 2015

Specifically, this:

ac94ae5#diff-6ad072c1ebc79b7620832915f2323d55R550

Like all "resugaring" of projection predicates, rustdoc will need to merge the F: Fn(usize) and <F as FnMut(usize)>::Output == bool bounds into one, which will likely mean an extra step when cleaning ty::Generics, after cleaning the individual ty::Predicates in the predicates field.

@tomjakubowski

This comment has been minimized.

Copy link
Contributor Author

tomjakubowski commented Feb 1, 2015

I can't nominate issues but I think this is crucial for 1.0 because of the pervasive use of closures in the standard library. Rendering Fn trait bounds this way all over the standard library documentation is not going to do Rust any PR favors.

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Feb 5, 2015

1.0 polish

@pnkfelix pnkfelix added the P-medium label Feb 5, 2015

@pnkfelix pnkfelix added this to the 1.0 milestone Feb 5, 2015

@pnkfelix pnkfelix removed the I-nominated label Feb 5, 2015

@cmr cmr self-assigned this Mar 26, 2015

@alexcrichton alexcrichton assigned alexcrichton and unassigned cmr Apr 7, 2015

alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 8, 2015

rustdoc: Simplify predicates with paren notation
This change is aimed at improving cross-crate (inlined) notation of generic
closures. The change modifies `simplify::where_predicates` to handle
parenthesized notation as well as starting to handle supertrait bounds as well.
This was necessary because all output constraints of closures are bound to
`FnOnce` but most trait bounds are that of `FnMut`.

Close rust-lang#21801
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.