Don't render const keyword on stable#55327
Conversation
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
aa87cea to
a680180
Compare
There was a problem hiding this comment.
Is there a way we could move this check earlier in the process and store the result in the Cache or something? That way we wouldn't have to keep poking the environment variables over and over.
The Context already has the codes field, which can be used as a stand-in for "can i do nightly things", but that won't help the other spot where you put this check, since it doesn't receive a &Context.
|
Uhm... const fns are stable on nightly already... at least some of them. This should be in the current beta, too. to figure out whether a const fn from the libstd is available on stable you can call |
|
Oh nice! That'll make things simpler! |
|
@oli-obk: So we might have a "little" problem with using |
|
not quite. This check will stay around for libstd for quite a while, because it's very hard to know which const fns are stable and which are not. How are you figuring out any details that are not in the syntax tree without a Side note: You can "cheat" depending on what you mean by "stage". This is the trick that ty::tls::with(|tcx| tcx.is_min_const_fn(def_id)) |
There was a problem hiding this comment.
could you strip the constness during the generation of clean::Function?
There was a problem hiding this comment.
I was thinking of tricking that way yes.
a680180 to
5343eb5
Compare
|
@oli-obk Updated. |
oli-obk
left a comment
There was a problem hiding this comment.
This will only work for methods, free const functions aren't touched at all by this PR
There was a problem hiding this comment.
No need for the is_const_fn call, just the is_min_const_fn suffices.
5343eb5 to
5238d04
Compare
|
Updated. |
|
What about
Also, is it possible to test this somehow? |
|
Yes but that also means that when it'll be stabilized, a rustdoc test will break. If that sounds fine to you then I'll add one. |
|
I think the important test is whether #![unstable(feature = "humans",
reason = "who ever let humans program computers,
we're apparently really bad at it",
issue = "0")]
#![feature(rustc_const_unstable, const_fn, foo, foo2)]
#![feature(min_const_unsafe_fn)]
#![feature(staged_api)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature="foo")]
const unsafe fn foo() -> u32 { 42 }
#[unstable(feature = "rust1", issue="0")]
const fn foo2() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
const fn bar2() -> u32 { 42 }
#[unstable(feature = "foo2", issue="0")]
const unsafe fn foo2_gated() -> u32 { 42 }
#[stable(feature = "rust1", since = "1.0.0")]
const unsafe fn bar2_gated() -> u32 { 42 } |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@GuillaumeGomez I think this'll need some updates as const fn has now stabilized; I've changed the status to waiting-on-author |
|
A check @oli-obk proposed and suggested to add isn't working as expected. I need to speak with him about it. |
|
Pinging from triage. @GuillaumeGomez any updates on this? |
|
I didn't speak with him yet. |
|
Ping from triage! This PR hasn't made progress in a while, so I'm closing it per our guidelines. Thanks for your contributions and please feel free to re-open in the future. |
Don't render const keyword on stable Fixes rust-lang#55246. Continuation of rust-lang#55327. r? @oli-obk
Fixes #55246.
r? @QuietMisdreavus