diff options
| author | bors <bors@rust-lang.org> | 2018-06-23 20:10:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-06-23 20:10:35 +0000 |
| commit | 60efbdead6b65d7fd8ebfd564c86de4594ef0076 (patch) | |
| tree | b7b69402c0cfdba0db734f3c0059ec3fb1b05676 /src/libcore | |
| parent | 4fe88c05cd14fa182fd58cc68127f98aca77d1ff (diff) | |
| parent | 11341e2b069d70710cc0625c4bd3be6f851e04c7 (diff) | |
| download | rust-60efbdead6b65d7fd8ebfd564c86de4594ef0076.tar.gz rust-60efbdead6b65d7fd8ebfd564c86de4594ef0076.zip | |
Auto merge of #51653 - mglagla:option-unreachable, r=dtolnay
Option::get_or_insert(_with): Replace unreachable! with unreachable_unchecked Optimize codegen for both functions as the None branch is trivially not reachable.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/option.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 1e615042a6d..e633d80a63c 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -146,7 +146,7 @@ #![stable(feature = "rust1", since = "1.0.0")] use iter::{FromIterator, FusedIterator, TrustedLen}; -use {mem, ops}; +use {hint, mem, ops}; use mem::PinMut; // Note that this is not a lang item per se, but it has a hidden dependency on @@ -784,7 +784,7 @@ impl<T> Option<T> { match *self { Some(ref mut v) => v, - _ => unreachable!(), + None => unsafe { hint::unreachable_unchecked() }, } } @@ -817,7 +817,7 @@ impl<T> Option<T> { match *self { Some(ref mut v) => v, - _ => unreachable!(), + None => unsafe { hint::unreachable_unchecked() }, } } |
