Skip to content

Commit 2552c7f

Browse files
committed
---
yaml --- r: 231924 b: refs/heads/auto c: fbd91a7 h: refs/heads/master v: v3
1 parent b2b18b4 commit 2552c7f

File tree

8 files changed

+119
-416
lines changed

8 files changed

+119
-416
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 883b5cf9a92ba5a1fa76e40955c16ccc22d79c5d
11+
refs/heads/auto: fbd91a732b73dd73b4da8940bc32c4a7d5e6251b
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/configure

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -885,28 +885,6 @@ then
885885
CFG_DISABLE_JEMALLOC=1
886886
fi
887887

888-
# default gcc version under OpenBSD maybe too old, try using egcc, which is a
889-
# gcc version from ports
890-
if [ $CFG_OSTYPE = unknown-openbsd ]
891-
then
892-
if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
893-
step_msg "older GCC found, try with egcc instead"
894-
895-
# probe again but using egcc
896-
probe CFG_GCC egcc
897-
898-
# and use egcc/eg++ for CC/CXX too if it was found
899-
# (but user setting has priority)
900-
if [ -n "$CFG_GCC" ]; then
901-
CC="${CC:-egcc}"
902-
CXX="${CXX:-eg++}"
903-
fi
904-
fi
905-
906-
step_msg "on OpenBSD, disabling jemalloc"
907-
CFG_DISABLE_JEMALLOC=1
908-
fi
909-
910888
# OS X 10.9, gcc is actually clang. This can cause some confusion in the build
911889
# system, so if we find that gcc is clang, we should just use clang directly.
912890
if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ]

branches/auto/src/doc/reference.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,31 +2059,31 @@ arbitrarily complex configurations through nesting.
20592059

20602060
The following configurations must be defined by the implementation:
20612061

2062-
* `debug_assertions` - Enabled by default when compiling without optimizations.
2062+
* `debug_assertions`. Enabled by default when compiling without optimizations.
20632063
This can be used to enable extra debugging code in development but not in
20642064
production. For example, it controls the behavior of the standard library's
20652065
`debug_assert!` macro.
2066-
* `target_arch = "..."` - Target CPU architecture, such as `"x86"`, `"x86_64"`
2066+
* `target_arch = "..."`. Target CPU architecture, such as `"x86"`, `"x86_64"`
20672067
`"mips"`, `"powerpc"`, `"arm"`, or `"aarch64"`.
2068-
* `target_endian = "..."` - Endianness of the target CPU, either `"little"` or
2068+
* `target_endian = "..."`. Endianness of the target CPU, either `"little"` or
20692069
`"big"`.
2070-
* `target_env = ".."` - An option provided by the compiler by default
2070+
* `target_env = ".."` - an option provided by the compiler by default
20712071
describing the runtime environment of the target platform. Some examples of
20722072
this are `musl` for builds targeting the MUSL libc implementation, `msvc` for
20732073
Windows builds targeting MSVC, and `gnu` frequently the rest of the time. This
20742074
option may also be blank on some platforms.
2075-
* `target_family = "..."` - Operating system family of the target, e. g.
2075+
* `target_family = "..."`. Operating system family of the target, e. g.
20762076
`"unix"` or `"windows"`. The value of this configuration option is defined
20772077
as a configuration itself, like `unix` or `windows`.
2078-
* `target_os = "..."` - Operating system of the target, examples include
2078+
* `target_os = "..."`. Operating system of the target, examples include
20792079
`"windows"`, `"macos"`, `"ios"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"`,
20802080
`"bitrig"` , `"openbsd"` or `"netbsd"`.
2081-
* `target_pointer_width = "..."` - Target pointer width in bits. This is set
2081+
* `target_pointer_width = "..."`. Target pointer width in bits. This is set
20822082
to `"32"` for targets with 32-bit pointers, and likewise set to `"64"` for
20832083
64-bit pointers.
2084-
* `test` - Enabled when compiling the test harness (using the `--test` flag).
2085-
* `unix` - See `target_family`.
2086-
* `windows` - See `target_family`.
2084+
* `test`. Enabled when compiling the test harness (using the `--test` flag).
2085+
* `unix`. See `target_family`.
2086+
* `windows`. See `target_family`.
20872087

20882088
You can also set another attribute based on a `cfg` variable with `cfg_attr`:
20892089

branches/auto/src/libcore/str/mod.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -896,14 +896,18 @@ Section: Comparing strings
896896
#[lang = "str_eq"]
897897
#[inline]
898898
fn eq_slice(a: &str, b: &str) -> bool {
899+
a.len() == b.len() && unsafe { cmp_slice(a, b, a.len()) == 0 }
900+
}
901+
902+
/// Bytewise slice comparison.
903+
/// NOTE: This uses the system's memcmp, which is currently dramatically
904+
/// faster than comparing each byte in a loop.
905+
#[inline]
906+
unsafe fn cmp_slice(a: &str, b: &str, len: usize) -> i32 {
899907
// NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
900908
#[allow(improper_ctypes)]
901909
extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
902-
a.len() == b.len() && unsafe {
903-
memcmp(a.as_ptr() as *const i8,
904-
b.as_ptr() as *const i8,
905-
a.len()) == 0
906-
}
910+
memcmp(a.as_ptr() as *const i8, b.as_ptr() as *const i8, len)
907911
}
908912

909913
/*
@@ -1039,8 +1043,8 @@ Section: Trait implementations
10391043
*/
10401044

10411045
mod traits {
1042-
use cmp::{Ordering, Ord, PartialEq, PartialOrd, Eq};
1043-
use cmp::Ordering::{Less, Equal, Greater};
1046+
use cmp::{self, Ordering, Ord, PartialEq, PartialOrd, Eq};
1047+
use cmp::Ordering::{Less, Greater};
10441048
use iter::Iterator;
10451049
use option::Option;
10461050
use option::Option::Some;
@@ -1051,15 +1055,16 @@ mod traits {
10511055
impl Ord for str {
10521056
#[inline]
10531057
fn cmp(&self, other: &str) -> Ordering {
1054-
for (s_b, o_b) in self.bytes().zip(other.bytes()) {
1055-
match s_b.cmp(&o_b) {
1056-
Greater => return Greater,
1057-
Less => return Less,
1058-
Equal => ()
1059-
}
1058+
let cmp = unsafe {
1059+
super::cmp_slice(self, other, cmp::min(self.len(), other.len()))
1060+
};
1061+
if cmp == 0 {
1062+
self.len().cmp(&other.len())
1063+
} else if cmp < 0 {
1064+
Less
1065+
} else {
1066+
Greater
10601067
}
1061-
1062-
self.len().cmp(&other.len())
10631068
}
10641069
}
10651070

0 commit comments

Comments
 (0)