Skip to content

Commit e670fb4

Browse files
committed
Apply explicit stabilities to unicode parts of CharExt.
1 parent 0302d37 commit e670fb4

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/libunicode/u_char.rs

+24-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use core::option::Option;
1919
use tables::{derived_property, property, general_category, conversions, charwidth};
2020

2121
/// Functionality for manipulating `char`.
22-
#[experimental = "pending prelude organization"]
22+
#[stable]
2323
pub trait CharExt {
2424
/// Checks if a `char` parses as a numeric digit in the given radix.
2525
///
@@ -103,6 +103,7 @@ pub trait CharExt {
103103

104104
/// Returns whether the specified character is considered a Unicode
105105
/// alphabetic code point.
106+
#[stable]
106107
fn is_alphabetic(self) -> bool;
107108

108109
/// Returns whether the specified character satisfies the 'XID_Start'
@@ -111,6 +112,7 @@ pub trait CharExt {
111112
/// 'XID_Start' is a Unicode Derived Property specified in
112113
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
113114
/// mostly similar to ID_Start but modified for closure under NFKx.
115+
#[experimental = "mainly needed for compiler internals"]
114116
fn is_xid_start(self) -> bool;
115117

116118
/// Returns whether the specified `char` satisfies the 'XID_Continue'
@@ -119,38 +121,45 @@ pub trait CharExt {
119121
/// 'XID_Continue' is a Unicode Derived Property specified in
120122
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
121123
/// mostly similar to 'ID_Continue' but modified for closure under NFKx.
124+
#[experimental = "mainly needed for compiler internals"]
122125
fn is_xid_continue(self) -> bool;
123126

124127
/// Indicates whether a character is in lowercase.
125128
///
126129
/// This is defined according to the terms of the Unicode Derived Core
127130
/// Property `Lowercase`.
131+
#[stable]
128132
fn is_lowercase(self) -> bool;
129133

130134
/// Indicates whether a character is in uppercase.
131135
///
132136
/// This is defined according to the terms of the Unicode Derived Core
133137
/// Property `Uppercase`.
138+
#[stable]
134139
fn is_uppercase(self) -> bool;
135140

136141
/// Indicates whether a character is whitespace.
137142
///
138143
/// Whitespace is defined in terms of the Unicode Property `White_Space`.
144+
#[stable]
139145
fn is_whitespace(self) -> bool;
140146

141147
/// Indicates whether a character is alphanumeric.
142148
///
143149
/// Alphanumericness is defined in terms of the Unicode General Categories
144150
/// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
151+
#[stable]
145152
fn is_alphanumeric(self) -> bool;
146153

147154
/// Indicates whether a character is a control code point.
148155
///
149156
/// Control code points are defined in terms of the Unicode General
150157
/// Category `Cc`.
158+
#[stable]
151159
fn is_control(self) -> bool;
152160

153161
/// Indicates whether the character is numeric (Nd, Nl, or No).
162+
#[stable]
154163
fn is_numeric(self) -> bool;
155164

156165
/// Converts a character to its lowercase equivalent.
@@ -162,6 +171,7 @@ pub trait CharExt {
162171
///
163172
/// Returns the lowercase equivalent of the character, or the character
164173
/// itself if no conversion is possible.
174+
#[experimental = "pending case transformation decisions"]
165175
fn to_lowercase(self) -> char;
166176

167177
/// Converts a character to its uppercase equivalent.
@@ -184,6 +194,7 @@ pub trait CharExt {
184194
/// [`SpecialCasing`.txt`]: ftp://ftp.unicode.org/Public/UNIDATA/SpecialCasing.txt
185195
///
186196
/// [2]: http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992
197+
#[experimental = "pending case transformation decisions"]
187198
fn to_uppercase(self) -> char;
188199

189200
/// Returns this character's displayed width in columns, or `None` if it is a
@@ -199,7 +210,7 @@ pub trait CharExt {
199210
fn width(self, is_cjk: bool) -> Option<uint>;
200211
}
201212

202-
#[experimental = "pending prelude organization"]
213+
#[stable]
203214
impl CharExt for char {
204215
#[unstable = "pending integer conventions"]
205216
fn is_digit(self, radix: uint) -> bool { C::is_digit(self, radix) }
@@ -218,6 +229,7 @@ impl CharExt for char {
218229
#[unstable = "pending decision about Iterator/Writer/Reader"]
219230
fn encode_utf16(self, dst: &mut [u16]) -> Option<uint> { C::encode_utf16(self, dst) }
220231

232+
#[stable]
221233
fn is_alphabetic(self) -> bool {
222234
match self {
223235
'a' ... 'z' | 'A' ... 'Z' => true,
@@ -226,10 +238,13 @@ impl CharExt for char {
226238
}
227239
}
228240

241+
#[experimental = "mainly needed for compiler internals"]
229242
fn is_xid_start(self) -> bool { derived_property::XID_Start(self) }
230243

244+
#[experimental = "mainly needed for compiler internals"]
231245
fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) }
232246

247+
#[stable]
233248
fn is_lowercase(self) -> bool {
234249
match self {
235250
'a' ... 'z' => true,
@@ -238,6 +253,7 @@ impl CharExt for char {
238253
}
239254
}
240255

256+
#[stable]
241257
fn is_uppercase(self) -> bool {
242258
match self {
243259
'A' ... 'Z' => true,
@@ -246,6 +262,7 @@ impl CharExt for char {
246262
}
247263
}
248264

265+
#[stable]
249266
fn is_whitespace(self) -> bool {
250267
match self {
251268
' ' | '\x09' ... '\x0d' => true,
@@ -254,12 +271,15 @@ impl CharExt for char {
254271
}
255272
}
256273

274+
#[stable]
257275
fn is_alphanumeric(self) -> bool {
258276
self.is_alphabetic() || self.is_numeric()
259277
}
260278

279+
#[stable]
261280
fn is_control(self) -> bool { general_category::Cc(self) }
262281

282+
#[stable]
263283
fn is_numeric(self) -> bool {
264284
match self {
265285
'0' ... '9' => true,
@@ -268,8 +288,10 @@ impl CharExt for char {
268288
}
269289
}
270290

291+
#[experimental = "pending case transformation decisions"]
271292
fn to_lowercase(self) -> char { conversions::to_lower(self) }
272293

294+
#[experimental = "pending case transformation decisions"]
273295
fn to_uppercase(self) -> char { conversions::to_upper(self) }
274296

275297
#[experimental = "needs expert opinion. is_cjk flag stands out as ugly"]

0 commit comments

Comments
 (0)