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

Callback parameter names are missing from rustdoc #44570

Closed
dtolnay opened this issue Sep 14, 2017 · 3 comments
Closed

Callback parameter names are missing from rustdoc #44570

dtolnay opened this issue Sep 14, 2017 · 3 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

@dtolnay
Copy link
Member

dtolnay commented Sep 14, 2017

Reported in https://users.rust-lang.org/t/giving-names-to-callback-parameters/12877.

pub fn f(callback: fn(len: usize)) {}

Rustdoc shows this as:

pub fn f(callback: fn(_: usize))

This is with rustc 1.22.0-nightly (539f208 2017-09-13).

@mrcnski
Copy link
Contributor

mrcnski commented Sep 14, 2017

Having originally reported this, I'd really like to take a stab at the fix. I'll start investigating over the weekend.

Edit: as I haven't had the time to look at this, someone else can feel free to take over.

@frewsxcv frewsxcv added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Sep 14, 2017
@Mark-Simulacrum Mark-Simulacrum added 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 Sep 17, 2017
@eddyb
Copy link
Member

eddyb commented Sep 26, 2017

@rust-lang/compiler @petrochenkov Oh wow why do we even allow this syntax?!
But if we want this it should be done like extern {...} functions (with no bodies), which keep a Vec of names, distinct from argument patterns in functions with bodies.

@petrochenkov
Copy link
Contributor

@eddyb

Oh wow why do we even allow this syntax?!

To support self-documenting arguments in callback types, roughly the same reason why names are supported in foreign functions.
Any patterns except _ and IDENT are prohibited there by the same check that prohibits them in foreign functions, so the legal ones can be lowered into "Vec of names".

bors added a commit that referenced this issue Oct 7, 2017
Fnty args rustdoc

Fixes #44570.

cc @QuietMisdreavus
cc @rust-lang/dev-tools

Considering the impact on the `hir` libs, I'll put @eddyb as reviewer.

r? @eddyb
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

6 participants