diff options
| author | bors <bors@rust-lang.org> | 2015-05-04 07:24:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-05-04 07:24:24 +0000 |
| commit | 1ea9e8db6f9a2da62dcdc4ff7cdbcf7ded4e56b5 (patch) | |
| tree | 82b831dfeeb3cb37c13fdc6b4e99ba947ca3cc4d /src | |
| parent | 6517a0e90ef607227eec3e888707c36bf191fd09 (diff) | |
| parent | 91ea0c4f12574627dc9a17c7acce1c0258797a36 (diff) | |
| download | rust-1ea9e8db6f9a2da62dcdc4ff7cdbcf7ded4e56b5.tar.gz rust-1ea9e8db6f9a2da62dcdc4ff7cdbcf7ded4e56b5.zip | |
Auto merge of #25067 - koute:master, r=alexcrichton
Without the inline annotation this:
str::from_utf8_unchecked( slice::from_raw_parts( ptr, len ) )
doesn't get inlined which can be pretty brutal performance-wise
when used in an inner loop of a low level string manipulation method.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/str/mod.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 4d343ea0f1e..6b65d746256 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -136,6 +136,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> { /// Converts a slice of bytes to a string slice without checking /// that the string contains valid UTF-8. +#[inline(always)] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str { mem::transmute(v) |
