about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAndrew Poelstra <apoelstra@wpsoftware.net>2014-08-20 13:06:34 -0700
committerAndrew Poelstra <apoelstra@wpsoftware.net>2014-08-31 13:33:55 -0500
commit00ff5aac4ef48615321610b73f30da825700fb78 (patch)
treecdb9b2e004f96c91cf6781845e7ca4bd175bcd5b /src/rustllvm/RustWrapper.cpp
parent27e8d5bca79c09258c757e9be6e13aaa24086d84 (diff)
downloadrust-00ff5aac4ef48615321610b73f30da825700fb78.tar.gz
rust-00ff5aac4ef48615321610b73f30da825700fb78.zip
Rename `RawPtr::to_option()` to `RawPtr::as_ref()`
As outlined in

  https://aturon.github.io/style/naming/conversions.html

`to_` functions names should only be used for expensive operations.
Thus `to_option` is better named `as_option`. Also, putting type
names into method names is considered bad style; what the user is
really trying to get is a reference. This `as_ref` is even better.

Also, we are missing a mutable version of this method. So add a
new trait `RawMutPtr` with a corresponding `as_mut` methode.

Finally, there is a bug in the signature of `to_option` which has
been around since lifetime elision: originally the returned reference
had 'static lifetime, but since the elision changes this become
the lifetime of the raw pointer (which does not make sense, since
the pointer lifetime and referent lifetime are unrelated). Fix
the bug to return a reference with a fresh lifetime (which will
be inferred from the calling context).

[breaking-change]
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions