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

Get rid of the distinction between method and function in rustdoc JSON output #100259

Closed
jyn514 opened this issue Aug 8, 2022 · 2 comments · Fixed by #104499
Closed

Get rid of the distinction between method and function in rustdoc JSON output #100259

jyn514 opened this issue Aug 8, 2022 · 2 comments · Fixed by #104499
Labels
A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-json Area: Rustdoc JSON backend

Comments

@jyn514
Copy link
Member

jyn514 commented Aug 8, 2022

Rust has no concept of methods. Distinguishing between these makes no sense and is an artifact of how rustdoc represents these internally - consider for example the ambiguous case

pub struct Foo {}

impl Foo {
    pub fn bar() {}
}

We should remove this distinction before the format is stabilized.

cc @obi1kenobi @CraftSpider @camelid

@jyn514 jyn514 added A-rustdoc-json Area: Rustdoc JSON backend A-rustdoc-js Area: Rustdoc's JS front-end labels Aug 8, 2022
@obi1kenobi
Copy link
Member

The one thing I'd be careful about is consistency of terminology and intuition between the Rust book and rustdoc. The Rust book mentions methods as a kind of associated function, even though this is merely a human-made distinction and is not observed at layers below "human reading the code."

I'm completely in favor of not distinguishing between them in rustdoc and having the function kind cover both. I'd just suggest that we make sure the rustdoc JSON docs prominently state that in the JSON output, there's no difference between methods, non-method associated functions, and free functions.

@jyn514
Copy link
Member Author

jyn514 commented Aug 8, 2022

there's no difference between methods, non-method associated functions, and free functions.

I think we distinguish associated items by adding a parent field or something like that?

But yeah documenting that the kind is the same for all 3 seems fine.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 21, 2022
… r=GuillaumeGomez

rustdoc JSON: Use `Function` everywhere and remove `Method`

Closes rust-lang#100259
@bors bors closed this as completed in 4300b9e Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-json Area: Rustdoc JSON backend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants