Skip to content

Commit 8067a8c

Browse files
committed
core: Add stability attributes to char::from_digit and from_u32
For now we are preferring free functions for primitive ctors, so they are marked 'unstable' pending final decision. The methods on `Char` are 'deprecated'.
1 parent 10695d2 commit 8067a8c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/libcore/char.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ pub const MAX: char = '\U0010ffff';
6868

6969
/// Converts from `u32` to a `char`
7070
#[inline]
71+
#[unstable = "pending decisions about costructors for primitives"]
7172
pub fn from_u32(i: u32) -> Option<char> {
7273
// catch out-of-bounds and surrogates
7374
if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
@@ -146,6 +147,7 @@ pub fn to_digit(c: char, radix: uint) -> Option<uint> {
146147
/// Fails if given an `radix` > 36.
147148
///
148149
#[inline]
150+
#[unstable = "pending decisions about costructors for primitives"]
149151
pub fn from_digit(num: uint, radix: uint) -> Option<char> {
150152
if radix > 36 {
151153
panic!("from_digit: radix is to high (maximum 36)");
@@ -286,9 +288,11 @@ pub trait Char {
286288
/// # Failure
287289
///
288290
/// Fails if given a radix > 36.
291+
#[deprecated = "use the char::from_digit free function"]
289292
fn from_digit(num: uint, radix: uint) -> Option<Self>;
290293

291294
/// Converts from `u32` to a `char`
295+
#[deprecated = "use the char::from_u32 free function"]
292296
fn from_u32(i: u32) -> Option<char>;
293297

294298
/// Returns the hexadecimal Unicode escape of a character.
@@ -351,9 +355,11 @@ impl Char for char {
351355

352356
fn to_digit(&self, radix: uint) -> Option<uint> { to_digit(*self, radix) }
353357

358+
#[deprecated = "use the char::from_digit free function"]
354359
fn from_digit(num: uint, radix: uint) -> Option<char> { from_digit(num, radix) }
355360

356361
#[inline]
362+
#[deprecated = "use the char::from_u32 free function"]
357363
fn from_u32(i: u32) -> Option<char> { from_u32(i) }
358364

359365
fn escape_unicode(&self, f: |char|) { escape_unicode(*self, f) }

0 commit comments

Comments
 (0)