diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-01 10:51:30 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-07 08:16:14 -0700 |
| commit | f12b51705b064bbbeb86ad65663de476d07ad51f (patch) | |
| tree | 5d0e8ae3cc7bfa2be981a213ec4488defa8d65aa | |
| parent | e4271cae54c7f4a868c60a1822b91e702e511947 (diff) | |
| download | rust-f12b51705b064bbbeb86ad65663de476d07ad51f.tar.gz rust-f12b51705b064bbbeb86ad65663de476d07ad51f.zip | |
core: Remove generics from Option::expect
The prospects of a generic failure function such as this existing in libcore are bleak, due to monomorphization not working across the crate boundary, and allocation into a ~Any is not allowed in libcore. The argument to expect() is now &str instead of <M: Send + Any> [breaking-change]
| -rw-r--r-- | src/libcore/option.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 31a452553e5..84da65f90be 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -138,11 +138,9 @@ //! } //! ``` -use any::Any; use cmp::{Eq, TotalEq, TotalOrd}; use default::Default; use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize}; -use kinds::Send; use mem; use slice; @@ -238,7 +236,7 @@ impl<T> Option<T> { /// /// Fails if the value is a `None` with a custom failure message provided by `msg`. #[inline] - pub fn expect<M: Any + Send>(self, msg: M) -> T { + pub fn expect(self, msg: &str) -> T { match self { Some(val) => val, None => fail!(msg), |
