about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2024-06-05 01:14:29 -0700
committerGitHub <noreply@github.com>2024-06-05 01:14:29 -0700
commit4da86874d4f5f4b586cbfbacefd5739a50b9577e (patch)
treed26fc9e6a6e3fa9b8ae99adf312625618072c5a1 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent435f7068b0acd39dc48ef84793e658e8eb89e342 (diff)
parent3927f4adfa7df520703443e622a395622e68377b (diff)
downloadrust-4da86874d4f5f4b586cbfbacefd5739a50b9577e.tar.gz
rust-4da86874d4f5f4b586cbfbacefd5739a50b9577e.zip
Rollup merge of #123168 - joshtriplett:size-of-prelude, r=Amanieu
Add `size_of` and `size_of_val` and `align_of` and `align_of_val` to the prelude

(Note: need to update the PR to add `align_of` and `align_of_val`, and remove the second commit with the myriad changes to appease the lint.)

Many, many projects use `size_of` to get the size of a type. However,
it's also often equally easy to hardcode a size (e.g. `8` instead of
`size_of::<u64>()`). Minimizing friction in the use of `size_of` helps
ensure that people use it and make code more self-documenting.

The name `size_of` is unambiguous: the name alone, without any prefix or
path, is self-explanatory and unmistakeable for any other functionality.
Adding it to the prelude cannot produce any name conflicts, as any local
definition will silently shadow the one from the prelude. Thus, we don't
need to wait for a new edition prelude to add it.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions