about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorAndreas Molzer <andreas.molzer@gmx.de>2022-03-12 00:21:35 +0100
committerAndreas Molzer <andreas.molzer@gmx.de>2022-03-23 19:59:37 +0100
commitd489ea777d38c5d44a5394bcd4bdcc69eb3cda40 (patch)
tree985baf4f181fa45d9d28ed993aa2b5e04280a2cb /compiler/rustc_codegen_gcc
parentc9b45e601065c3fb71a4f67481e912391d075621 (diff)
downloadrust-d489ea777d38c5d44a5394bcd4bdcc69eb3cda40.tar.gz
rust-d489ea777d38c5d44a5394bcd4bdcc69eb3cda40.zip
Refactor set_ptr_value as with_metadata_of
By reversing the arguments we achieve several clarifications:

- The function closely resembles `cast` but with an argument to
  initialized the metadata. This is easier to teach and answers an long
  outstanding question that had restricted cast to `Sized` targets
  initially. See multiples reviews of
  <https://github.com/rust-lang/rust/pull/47631>
- The 'object identity', in the form or provenance, is now preserved
  from the call receiver to the result. This helps explain the method as
  a builder-style, instead of some kind of setter that would modify
  something in-place. Ensuring that the result has the identity of the
  `self` argument is also beneficial for an intuition of effects.
- An outstanding concern, 'Correct argument type', is avoided by not
  committing to any specific argument type. This is consistent with cast
  which does not require its receiver to be a raw address.
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions