diff options
| author | Lukas Kalbertodt <lukas.kalbertodt@gmail.com> | 2017-10-01 21:46:17 +0200 |
|---|---|---|
| committer | Lukas Kalbertodt <lukas.kalbertodt@gmail.com> | 2017-11-03 21:27:40 +0100 |
| commit | 1916e3c4aad7b0e0de1cfd190819609f55520996 (patch) | |
| tree | 38dbc0bdb12d7be38420776c4ed4a125f61698ef /src/libstd/ascii.rs | |
| parent | 5a1d11a733b856cfaedd82f1c1ff50b87541692d (diff) | |
| download | rust-1916e3c4aad7b0e0de1cfd190819609f55520996.tar.gz rust-1916e3c4aad7b0e0de1cfd190819609f55520996.zip | |
Copy `AsciiExt` methods to `str` directly
This is done in order to deprecate AsciiExt eventually. Note that this commit contains a bunch of `cfg(stage0)` statements. This is due to a new compiler feature this commit depends on: the `slice_u8` lang item. Once this lang item is available in the stage0 compiler, all those cfg flags (and more) can be removed.
Diffstat (limited to 'src/libstd/ascii.rs')
| -rw-r--r-- | src/libstd/ascii.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 7a474c1f254..200264a2583 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -298,6 +298,10 @@ pub trait AsciiExt { fn is_ascii_control(&self) -> bool { unimplemented!(); } } +// FIXME(LukasKalbertodt): this impl block can be removed in the future. This is +// possible once the stage0 compiler is new enough to contain the inherent +// ascii methods for `[str]`. See FIXME comment further down. +#[cfg(stage0)] #[stable(feature = "rust1", since = "1.0.0")] impl AsciiExt for str { type Owned = String; @@ -389,9 +393,9 @@ impl AsciiExt for str { } } -// TODO(LukasKalbertodt): this impl block can be removed in the future. This is +// FIXME(LukasKalbertodt): this impl block can be removed in the future. This is // possible once the stage0 compiler is new enough to contain the inherent -// ascii methods for `[u8]`. See TODO comment further down. +// ascii methods for `[u8]`. See FIXME comment further down. #[cfg(stage0)] #[stable(feature = "rust1", since = "1.0.0")] impl AsciiExt for [u8] { @@ -546,12 +550,18 @@ macro_rules! impl_by_delegating { impl_by_delegating!(u8, u8); impl_by_delegating!(char, char); -// TODO(LukasKalbertodt): the macro invocation should replace the impl block +// FIXME(LukasKalbertodt): the macro invocation should replace the impl block // for `[u8]` above. But this is not possible until the stage0 compiler is new // enough to contain the inherent ascii methods for `[u8]`. #[cfg(not(stage0))] impl_by_delegating!([u8], Vec<u8>); +// FIXME(LukasKalbertodt): the macro invocation should replace the impl block +// for `str` above. But this is not possible until the stage0 compiler is new +// enough to contain the inherent ascii methods for `str`. +#[cfg(not(stage0))] +impl_by_delegating!(str, String); + /// An iterator over the escaped version of a byte. /// /// This `struct` is created by the [`escape_default`] function. See its |
