about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-09-03 16:01:12 +0000
committerbors <bors@rust-lang.org>2014-09-03 16:01:12 +0000
commit6ac4a308101f561ec90f99c7eb405c01e2a30153 (patch)
treec91698169b6dc1150cabbd1f36f3cfac2b2dffb9 /src/rustllvm/RustWrapper.cpp
parent8a8986776d16c16ef4685aa38c3f6a2c0efa7884 (diff)
parent00ff5aac4ef48615321610b73f30da825700fb78 (diff)
downloadrust-6ac4a308101f561ec90f99c7eb405c01e2a30153.tar.gz
rust-6ac4a308101f561ec90f99c7eb405c01e2a30153.zip
auto merge of #16634 : apoelstra/rust/to-option-fix, r=aturon
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.

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). We 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