-
Notifications
You must be signed in to change notification settings - Fork 13.4k
make RefCell unstably const #137843
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
base: master
Are you sure you want to change the base?
make RefCell unstably const #137843
Conversation
ef5a67e
to
ddc8777
Compare
@rustbot label -T-libs +T-libs-api |
RefCell
unstably const
RefCell
unstably const
Cc @rust-lang/wg-const-eval |
The main problem is dropping. Please make sure to also add a test actually using a |
@compiler-errors what is the state of |
Since we probably all want to hear the answer to that question... cc @rust-lang/lang |
No. Until we know what const traits syntax to implement, adding more const trait impls is not something we want. The libstd churn is not worth it |
Yes |
@Daniel-Aaron-Bloom okay so please remove the |
Should I also remove try to remove my added private function |
Oh that's what those functions are for? Sure, seems fine to me as long no incomplete nightly features have to be enabled for this. |
This comment has been minimized.
This comment has been minimized.
06262da
to
484a39a
Compare
☔ The latest upstream changes (presumably #140646) made this pull request unmergeable. Please resolve the merge conflicts. |
484a39a
to
7b9bde3
Compare
This comment has been minimized.
This comment has been minimized.
7b9bde3
to
e11911c
Compare
☔ The latest upstream changes (presumably #141842) made this pull request unmergeable. Please resolve the merge conflicts. |
With #119899 this is unblocked |
e11911c
to
bee3af2
Compare
bee3af2
to
22b634d
Compare
Some(BorrowRef { borrow }) | ||
} | ||
} | ||
|
||
/// FIXME(const-hack): `Clone` is not a `const_trait`, so work around that by making our own method |
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.
Let's do that in a separate PR first.
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.
Apologies, I don't quite understand. Are you saying to move this const
version of clone
into its own PR? It depends on a good number of other methods being const
, so I can do that but I'm not sure it's the cleanest approach.
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.
Or are you saying to add const_trait
to Clone
in a separate PR?
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.
yea, Let's make Clone
const before landing this PR, then this PR doesn't need a const hack
Now that we can do interior mutability in
const
, most of theRefCell
API can beconst fn
. The main exceptions are APIs which useFnOnce
(RefCell::replace_with
andRef[Mut]::[filter_]map[_split]
) andRefCell::take
which callsDefault::default
.Tracking issue: #137844