// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-//
-// ignore-lexer-test FIXME #15679
//! String manipulation
//!
#[stable(feature = "rust1", since = "1.0.0")]
type Err;
- /// Parses a string `s` to return an optional value of this type. If the
- /// string is ill-formatted, the None is returned.
+ /// Parses a string `s` to return a value of this type.
+ ///
+ /// If parsing succeeds, return the value inside `Ok`, otherwise
+ /// when the string is ill-formatted return an error specific to the
+ /// inside `Err`. The error type is specific to implementation of the trait.
#[stable(feature = "rust1", since = "1.0.0")]
fn from_str(s: &str) -> Result<Self, Self::Err>;
}
/// 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)
/// wrapping an private internal one that makes use of the `Pattern` API.
///
/// For all patterns `P: Pattern<'a>` the following items will be
-/// generated (generics ommitted):
+/// generated (generics omitted):
///
/// struct $forward_iterator($internal_iterator);
/// struct $reverse_iterator($internal_iterator);
/// Bytewise slice equality
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
-#[lang="str_eq"]
+#[lang = "str_eq"]
#[inline]
fn eq_slice(a: &str, b: &str) -> bool {
eq_slice_(a, b)