about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-09-16 23:17:39 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-10-02 08:57:48 -0700
commitdb76ac73309332927d04e4f8bf5d235dc6f32360 (patch)
tree5af4d5f7ad60c9c8926c16966f9e4b9ae4b0d3df /src/rustllvm/RustWrapper.cpp
parentd9d9ca1a025a944c552c027129cec984ffeeb41c (diff)
downloadrust-db76ac73309332927d04e4f8bf5d235dc6f32360.tar.gz
rust-db76ac73309332927d04e4f8bf5d235dc6f32360.zip
std: Add AsRef/AsMut impls to Box/Rc/Arc
These common traits were left off originally by accident from these smart
pointers, and a past attempt (#26008) to add them was later reverted (#26160)
due to unexpected breakge (#26096) occurring. The specific breakage in worry is
the meaning of this return value changed:

    let a: Box<Option<T>> = ...;
    a.as_ref()

Currently this returns `Option<&T>` but after this change it will return
`&Option<T>` because the `AsRef::as_ref` method shares the same name as
`Option::as_ref`. A [crater report][crater] of this change, however, has shown
that the fallout of this change is quite minimal. These trait implementations
are "the right impls to add" to these smart pointers and would enable various
generalizations such as those in #27197.

[crater]: https://gist.github.com/anonymous/0ba4c3512b07641c0f99

This commit is a breaking change for the above reasons mentioned, and the
mitigation strategies look like any of:

    Option::as_ref(&a)
    a.as_ref().as_ref()
    (*a).as_ref()
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions