diff options
| author | Lukas Kalbertodt <lukas.kalbertodt@gmail.com> | 2017-10-01 21:13:49 +0200 |
|---|---|---|
| committer | Lukas Kalbertodt <lukas.kalbertodt@gmail.com> | 2017-11-03 21:27:40 +0100 |
| commit | 5a1d11a733b856cfaedd82f1c1ff50b87541692d (patch) | |
| tree | 8ba0bb6bddc0191037ec77f1fcd07abd4e12a8b9 /src/libstd | |
| parent | 9e441c76f76521466f2f83c90d5f2811a1e9a714 (diff) | |
| download | rust-5a1d11a733b856cfaedd82f1c1ff50b87541692d.tar.gz rust-5a1d11a733b856cfaedd82f1c1ff50b87541692d.zip | |
Copy `AsciiExt` methods to `[u8]` 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 I am using: 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')
| -rw-r--r-- | src/libstd/ascii.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 6524838f8b0..7a474c1f254 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -389,6 +389,10 @@ impl AsciiExt for str { } } +// TODO(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. +#[cfg(stage0)] #[stable(feature = "rust1", since = "1.0.0")] impl AsciiExt for [u8] { type Owned = Vec<u8>; @@ -542,6 +546,12 @@ 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 +// 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>); + /// An iterator over the escaped version of a byte. /// /// This `struct` is created by the [`escape_default`] function. See its |
