]> git.lizzy.rs Git - rust.git/commit
Auto merge of #76411 - RalfJung:promote-in-const-fn, r=ecstatic-morse
authorbors <bors@rust-lang.org>
Sun, 20 Sep 2020 06:20:16 +0000 (06:20 +0000)
committerbors <bors@rust-lang.org>
Sun, 20 Sep 2020 06:20:16 +0000 (06:20 +0000)
commit10b3595ba6a4c658c9dea105488fc562c815e434
treea046e0f117492c34779ca4293f4c10d4fd66c9f0
parenta3bc0e752fad96f537b73f4e9bc805a73d404f7b
parent9216eb825839ecd17d67c2731537e5d6afffc54a
Auto merge of #76411 - RalfJung:promote-in-const-fn, r=ecstatic-morse

Some promotion cleanup

Based on top of both https://github.com/rust-lang/rust/pull/75502 and https://github.com/rust-lang/rust/pull/75585, this does some cleanup of the promotion code. The last 2 commits are new.

* Remove the remaining cases where `const fn` is treated different from `fn`. This means no longer promoting ptr-to-int casts, raw ptr operations, and union field accesses in `const fn` -- or anywhere, for that matter. These are all unstable in const-context so this should not break any stable code. Fixes https://github.com/rust-lang/rust/issues/75586.
* ~~Promote references to statics even outside statics (i.e., in functions) for consistency.~~
* Promote `&mut []` everywhere, not just in non-`const` functions, for consistency.
* Explain why we do not promote deref's of statics outside statics. ~~(This is the only remaining direct user of `const_kind`.)~~

This can only land once the other two PRs land; I am mostly putting this up already because I couldn't wait ;) and to get some feedback from `@rust-lang/wg-const-eval` .