-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Fix rendering of const keyword for functions #44254
Conversation
So there's something weird i noticed when digging into this. I saw that you took out the import for It turns out, associated fns use a different check altogether:
However, this doesn't stop constness from showing up in the stable std docs. I'm starting to think the check here to make sure we don't print constness on stable builds is superfluous. We try to compile the crate anyway; if it builds, we're on a nightly build (or a bootstrap build), by definition. If we can't hide constness from the stable std docs, then we should just leave it in and treat it like the way we treat other unstable things in the stable docs: give people a chance to look into it and shape it. cc @rust-lang/docs Pulling in the rest of the team here; what do y'all think about this idea? |
Any news in here? |
👍 from me; we also had previously printed |
We talked about this on IRC, and are generally in favor of printing constness all the time. To this end, i'd like it if you took out the check for bare functions, right here so it doesn't even try to mask it (this is the check that doesn't work and always prints it). |
67e8c01
to
15d1d7b
Compare
travis failure:
|
15d1d7b
to
77b5a6a
Compare
What failure? :p |
/// foo | ||
pub const fn bar() -> usize { | ||
2 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding something to this test to make sure we're rendering "const" on associated functions too? Something like this is what i have in mind:
// @has foo/struct.Foo.html
// @has - '//*[@class="method"]' 'pub const fn new()'
pub struct Foo(usize);
impl Foo {
pub const fn new() -> Foo { Foo(0) }
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
77b5a6a
to
742ff5a
Compare
r=me pending travis |
@bors r+ rollup |
📌 Commit 742ff5a has been approved by |
…=QuietMisdreavus Fix rendering of const keyword for functions Fixes rust-lang#44187. r? @QuietMisdreavus
…=QuietMisdreavus Fix rendering of const keyword for functions Fixes rust-lang#44187. r? @QuietMisdreavus
…=QuietMisdreavus Fix rendering of const keyword for functions Fixes rust-lang#44187. r? @QuietMisdreavus
Fixes #44187.
r? @QuietMisdreavus