about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-04-11 21:42:32 +0000
committerbors <bors@rust-lang.org>2018-04-11 21:42:32 +0000
commite28ef22ae5ef22a48e8582210bb8be9aba116b81 (patch)
tree889e41667449d0a802493b0fd5ded94e9b0b2b9c /src/liballoc
parentad610bed83f43158892222a71336bdcaa167909a (diff)
parent9f6e5ae0246333115c53d059a17f5da92988f3bf (diff)
downloadrust-e28ef22ae5ef22a48e8582210bb8be9aba116b81.tar.gz
rust-e28ef22ae5ef22a48e8582210bb8be9aba116b81.zip
Auto merge of #49875 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

Successful merges:

 - #49525 (Use sort_by_cached_key where appropriate)
 - #49575 (Stabilize `Option::filter`.)
 - #49614 (in which the non-shorthand patterns lint keeps its own counsel in macros)
 - #49665 (Small nits to make couple of tests pass on mips targets.)
 - #49781 (add regression test for #16223 (NLL): use of collaterally moved value)
 - #49795 (Properly look for uninhabitedness of variants in niche-filling check)
 - #49809 (Stop emitting color codes on TERM=dumb)
 - #49856 (Do not uppercase-lint #[no_mangle] statics)
 - #49863 (fixed typo)
 - #49857 (Fix "fp" target feature for AArch64)
 - #49849 (Add --enable-debug flag to musl CI build script)
 - #49734 (proc_macro: Generalize `FromIterator` impl)
 - #49730 (Fix ICE with impl Trait)
 - #48270 (Replace `structurally_resolved_type` in casts check.)

Failed merges:
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/slice.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs
index 68f2313843c..56c53fca62c 100644
--- a/src/liballoc/slice.rs
+++ b/src/liballoc/slice.rs
@@ -1400,6 +1400,7 @@ impl<T> [T] {
         let sz_usize = mem::size_of::<(K, usize)>();
 
         let len = self.len();
+        if len < 2 { return }
         if sz_u8  < sz_u16   && len <= ( u8::MAX as usize) { return sort_by_key!( u8, self, f) }
         if sz_u16 < sz_u32   && len <= (u16::MAX as usize) { return sort_by_key!(u16, self, f) }
         if sz_u32 < sz_usize && len <= (u32::MAX as usize) { return sort_by_key!(u32, self, f) }