diff options
| author | Brian Anderson <banderson@mozilla.com> | 2015-03-13 15:28:35 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2015-03-23 14:40:26 -0700 |
| commit | e9019101a82dd7f61dcdcd52bcc0123d5ed25d22 (patch) | |
| tree | 6553b47da56745ce8cab9e17265bba143608aa97 /src/libunicode | |
| parent | df290f127e923e0aacfe8223dd77f0fa222f0bc8 (diff) | |
| download | rust-e9019101a82dd7f61dcdcd52bcc0123d5ed25d22.tar.gz rust-e9019101a82dd7f61dcdcd52bcc0123d5ed25d22.zip | |
Add #![feature] attributes to doctests
Diffstat (limited to 'src/libunicode')
| -rw-r--r-- | src/libunicode/char.rs | 4 | ||||
| -rw-r--r-- | src/libunicode/lib.rs | 1 | ||||
| -rw-r--r-- | src/libunicode/u_str.rs | 25 |
3 files changed, 20 insertions, 10 deletions
diff --git a/src/libunicode/char.rs b/src/libunicode/char.rs index e0f013cbc80..db5a25b9bed 100644 --- a/src/libunicode/char.rs +++ b/src/libunicode/char.rs @@ -209,6 +209,7 @@ pub trait CharExt { /// In both of these examples, 'ß' takes two bytes to encode. /// /// ``` + /// # #![feature(unicode)] /// let mut b = [0; 2]; /// /// let result = 'ß'.encode_utf8(&mut b); @@ -219,6 +220,7 @@ pub trait CharExt { /// A buffer that's too small: /// /// ``` + /// # #![feature(unicode)] /// let mut b = [0; 1]; /// /// let result = 'ß'.encode_utf8(&mut b); @@ -241,6 +243,7 @@ pub trait CharExt { /// In both of these examples, 'ß' takes one `u16` to encode. /// /// ``` + /// # #![feature(unicode)] /// let mut b = [0; 1]; /// /// let result = 'ß'.encode_utf16(&mut b); @@ -251,6 +254,7 @@ pub trait CharExt { /// A buffer that's too small: /// /// ``` + /// # #![feature(unicode)] /// let mut b = [0; 0]; /// /// let result = 'ß'.encode_utf8(&mut b); diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index a09c0cb3bd6..6879fa7b3ba 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -35,6 +35,7 @@ #![feature(no_std)] #![no_std] #![feature(core)] +#![doc(test(no_crate_inject))] extern crate core; diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 485065685f1..de3a593143e 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -481,19 +481,24 @@ impl<'a> Iterator for Utf16Items<'a> { /// # Examples /// /// ``` +/// # #![feature(unicode)] +/// extern crate unicode; +/// /// use unicode::str::Utf16Item::{ScalarValue, LoneSurrogate}; /// -/// // 𝄞mus<invalid>ic<invalid> -/// let v = [0xD834, 0xDD1E, 0x006d, 0x0075, -/// 0x0073, 0xDD1E, 0x0069, 0x0063, -/// 0xD834]; +/// fn main() { +/// // 𝄞mus<invalid>ic<invalid> +/// let v = [0xD834, 0xDD1E, 0x006d, 0x0075, +/// 0x0073, 0xDD1E, 0x0069, 0x0063, +/// 0xD834]; /// -/// assert_eq!(unicode::str::utf16_items(&v).collect::<Vec<_>>(), -/// vec![ScalarValue('𝄞'), -/// ScalarValue('m'), ScalarValue('u'), ScalarValue('s'), -/// LoneSurrogate(0xDD1E), -/// ScalarValue('i'), ScalarValue('c'), -/// LoneSurrogate(0xD834)]); +/// assert_eq!(unicode::str::utf16_items(&v).collect::<Vec<_>>(), +/// vec![ScalarValue('𝄞'), +/// ScalarValue('m'), ScalarValue('u'), ScalarValue('s'), +/// LoneSurrogate(0xDD1E), +/// ScalarValue('i'), ScalarValue('c'), +/// LoneSurrogate(0xD834)]); +/// } /// ``` pub fn utf16_items<'a>(v: &'a [u16]) -> Utf16Items<'a> { Utf16Items { iter : v.iter() } |
