Skip to content

rustdoc: hide constness of fns in stable docs #31098

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

Closed
durka opened this issue Jan 21, 2016 · 7 comments
Closed

rustdoc: hide constness of fns in stable docs #31098

durka opened this issue Jan 21, 2016 · 7 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@durka
Copy link
Contributor

durka commented Jan 21, 2016

Rustdoc shows const fns as const, but you can't call them in a const context because they're still unstable. If you aren't in a const context, it doesn't matter whether the fn is const or not. So it's confusing and maybe it shouldn't be shown at all until the feature is stable.

cc @jethrogb

@jethrogb
Copy link
Contributor

Compare 1.5.0 docs

fn new(v: bool) -> AtomicBool

and stable docs

const fn new(v: bool) -> AtomicBool

This documentation change suggests that this a stable change. Yet const fn is still unstable. The stable docs should hide the const qualifier on const fns.

@tomjakubowski
Copy link
Contributor

This should a pretty straightforward change for someone looking to get into rustdoc development.

@huonw huonw added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 22, 2016
@durka durka changed the title rustdoc: don't dangle the const fn carrot rustdoc: hide constness of fns in stable docs Jan 22, 2016
@durka
Copy link
Contributor Author

durka commented Jan 22, 2016

@tomjakubowski is it? does rustdoc know whether it's documenting stable/beta vs nightly?

@tomjakubowski
Copy link
Contributor

@tomjakubowski is it? does rustdoc know whether it's documenting stable/beta vs nightly?

If rustdoc is going to simply remove const from functions until the feature is stabilized, then it doesn't matter.

If not, there's a little more work but it's not too bad. I think simply checking option_env!("CFG_RELEASE_CHANNEL") or CFG_DISABLE_UNSTABLE_FEATURES would suffice; nightly rustdoc binaries would produce const in documentation and others would not.

@durka
Copy link
Contributor Author

durka commented Jan 23, 2016

I think it should make that distinction. If you are on nightly, you can turn on the feature and use the const fns in const contexts, so you want that information.

quodlibetor pushed a commit to quodlibetor/rust that referenced this issue Jan 31, 2016
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 2, 2016
… r=alexcrichton

Fixes rust-lang#31098

AFAICT this is the only place where rustdoc explicitly checks if we are on stable before emitting content, so I can't tell if this is the sane way to handle this, or if anything else should be done to make sure that nobody forgets to remove this check when `const` is stabilized.
@jethrogb
Copy link
Contributor

jethrogb commented Feb 3, 2016

I don't think this issue is fixed until the docs at /stable/ actually don't show the qualification.

@mitaa
Copy link
Contributor

mitaa commented Feb 15, 2016

I think this is still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

5 participants