summary refs log tree commit diff
path: root/src/libcoretest/ptr.rs
AgeCommit message (Collapse)AuthorLines
2014-08-31Rename `RawPtr::to_option()` to `RawPtr::as_ref()`Andrew Poelstra-5/+30
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]
2014-07-24Deprecated `str::raw::from_c_str`Adolfo OchagavĂ­a-9/+7
Use `string::raw::from_buf` instead [breaking-change]
2014-06-29Extract tests from libcore to a separate crateSteven Fackler-0/+255
Libcore's test infrastructure is complicated by the fact that many lang items are defined in the crate. The current approach (realcore/realstd imports) is hacky and hard to work with (tests inside of core::cmp haven't been run for months!). Moving tests to a separate crate does mean that they can only test the public API of libcore, but I don't feel that that is too much of an issue. The only tests that I had to get rid of were some checking the various numeric formatters, but those are also exercised through normal format! calls in other tests.