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

Portability of documentation #8

Open
jethrogb opened this issue Mar 7, 2018 · 5 comments
Open

Portability of documentation #8

jethrogb opened this issue Mar 7, 2018 · 5 comments

Comments

@jethrogb
Copy link
Collaborator

jethrogb commented Mar 7, 2018

rustdoc currently generates documentation only for a single
target/configuration. When using conditional compilation, some functionality
can go missing or can appear depending on the options chosen. For example,
atomics of different sizes in core.

There is currently a rustdoc
kludge
to generate Windows and
Unix documentation for std at the same time. Can something like this be
extended to work for conditional compilation generally?

@Ericson2314
Copy link
Collaborator

Ericson2314 commented Mar 7, 2018

This would required teaching the compiler to do "all simultaneous" (i.e. combinations of cfg'd code) name resolution, and maybe type checking too. It's a big change, but I think it's a worthwhile one to do eventually. That change, once implemented, would also trivially allow us to extend the portability lint to cover all cases, as came up in the RFC thread and on the call.

It's a long way off, but once we reach that point I'd also like to use an epic (edit epoch) to make the portability lint a hard error and part of type checking.

@retep998
Copy link
Collaborator

retep998 commented Mar 8, 2018

I'd also like to use an epic

Since when does Rust have epics?

@jyn514
Copy link

jyn514 commented Oct 15, 2020

This is basically a duplicate of rust-lang/rust#1998.

@jyn514
Copy link

jyn514 commented Mar 2, 2021

This would required teaching the compiler to do "all simultaneous" (i.e. combinations of cfg'd code) name resolution, and maybe type checking too. It's a big change, but I think it's a worthwhile one to do eventually. That change, once implemented, would also trivially allow us to extend the portability lint to cover all cases, as came up in the RFC thread and on the call.

Note the way rustdoc does this is specifically by not doing name resolution or type checking (rust-lang/rust#73566, rust-lang/rust#75127). Having combinations of cfg'd code is incompatible with either of those two (rust-lang/rfcs#2963 (comment)), and I don't see how could work even in theory.

@jyn514
Copy link

jyn514 commented Mar 2, 2021

There is currently a rustdoc
kludge to generate Windows and
Unix documentation for std at the same time. Can something like this be
extended to work for conditional compilation generally?

Yes, nothing about the kludge is specific to cfg(windows) or cfg(unix), it will work for any combination of cfgs as long as it doesn't require type-checking function bodies (and I haven't found a case since rust-lang/rust#75127 that requires checking bodies).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants