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

[tracking issue] const fn mem::forget #69616

Closed
3 tasks done
DutchGhost opened this issue Mar 1, 2020 · 2 comments · Fixed by #73887
Closed
3 tasks done

[tracking issue] const fn mem::forget #69616

DutchGhost opened this issue Mar 1, 2020 · 2 comments · Fixed by #73887
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@DutchGhost
Copy link
Contributor

DutchGhost commented Mar 1, 2020

mem::forget is just a thin wrapper around ManuallyDrop::new which is already a const fn. mem::forget can thus also be a const fn. The usage would be in const functions dealing with generics where you dont want the generics to get dropped.

@jonas-schievink jonas-schievink added A-const-fn C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Mar 1, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 2, 2020
@oli-obk oli-obk changed the title mem::forget can be a const fn [tracking issue] const fn mem::forget Mar 13, 2020
@bors bors closed this as completed in efda2b5 Jul 11, 2020
@ratijas
Copy link
Contributor

ratijas commented Sep 6, 2020

Just for the bookkeeping, with mem::forget stabilized by #73887, shouldn't the stabilization checkbox at the top become checked on?

@DutchGhost
Copy link
Contributor Author

Just for the bookkeeping, with mem::forget stabilized by #73887, shouldn't the stabilization checkbox at the top become checked on?

Good point, checked the box now!

@RalfJung RalfJung added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants