rust/library/core/src
bors 21867225a7 Auto merge of #74930 - ecstatic-morse:const-size-align-of-val, r=oli-obk
Make `mem::size_of_val` and `mem::align_of_val` unstably const

Implements #46571 but does not stabilize it. I wanted this while working on something today.

The only reason not to immediately stabilize are concerns around [custom DSTs](https://github.com/rust-lang/rust/issues/46571#issuecomment-387669352). That proposal has made zero progress in the last two years and const eval is rich enough to support pretty much any user-defined `len` function as long as nightly features are allowed (`raw_ptr_deref`).

Currently, this raises a `const_err` lint when passed an `extern type`.

r? @oli-obk

cc @rust-lang/wg-const-eval
2020-07-30 12:52:41 +00:00
..
alloc mv std libs to library/ 2020-07-27 19:51:13 -05:00
array mv std libs to library/ 2020-07-27 19:51:13 -05:00
char mv std libs to library/ 2020-07-27 19:51:13 -05:00
convert mv std libs to library/ 2020-07-27 19:51:13 -05:00
fmt mv std libs to library/ 2020-07-27 19:51:13 -05:00
future mv std libs to library/ 2020-07-27 19:51:13 -05:00
hash mv std libs to library/ 2020-07-27 19:51:13 -05:00
iter mv std libs to library/ 2020-07-27 19:51:13 -05:00
macros mv std libs to library/ 2020-07-27 19:51:13 -05:00
mem Make {align,size}_of_val const 2020-07-29 16:50:15 -07:00
num mv std libs to library/ 2020-07-27 19:51:13 -05:00
ops mv std libs to library/ 2020-07-27 19:51:13 -05:00
prelude mv std libs to library/ 2020-07-27 19:51:13 -05:00
ptr mv std libs to library/ 2020-07-27 19:51:13 -05:00
slice mv std libs to library/ 2020-07-27 19:51:13 -05:00
str Add str::[r]split_once 2020-07-28 09:58:20 +02:00
sync fence docs: fix example Mutex 2020-07-29 15:45:42 +02:00
task Add #[inline] to RawWaker::new 2020-07-28 06:14:52 +02:00
unicode mv std libs to library/ 2020-07-27 19:51:13 -05:00
any.rs bump const type id stabilization to 1.46.0 2020-07-28 13:30:29 +10:00
ascii.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
bool.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
borrow.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
cell.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
clone.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
cmp.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
default.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
ffi.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
hint.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
internal_macros.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
intrinsics.rs Make {align,size}_of_val const 2020-07-29 16:50:15 -07:00
lazy.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
lib.rs Make {align,size}_of_val const 2020-07-29 16:50:15 -07:00
marker.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
option.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
panic.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
panicking.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
pin.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
primitive.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
raw.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
result.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
time.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
tuple.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
unit.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00