Skip to content

Commit a3e2ac0

Browse files
committed
---
yaml --- r: 222011 b: refs/heads/tmp c: 8ebf952 h: refs/heads/master i: 222009: 707e266 222007: 09361b3 v: v3
1 parent 7138ca4 commit a3e2ac0

File tree

18 files changed

+143
-1176
lines changed

18 files changed

+143
-1176
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: 2b45108ecb944d63daba0f1b5529ac4c8afdc295
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 04badd6a973d2499731b49365a121dbc4c9c468e
28+
refs/heads/tmp: 8ebf95257bfc9093cb25dba209ded303ec167e5f
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: e58601ab085591c71a27ae82137fc313222c2270
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/doc/rust.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,6 @@ a > code {
221221
color: #428BCA;
222222
}
223223

224-
.section-header > a > code {
225-
color: #8D1A38;
226-
}
227-
228224
/* Code highlighting */
229225
pre.rust .kw { color: #8959A8; }
230226
pre.rust .kw-2, pre.rust .prelude-ty { color: #4271AE; }

branches/tmp/src/doc/trpl/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* [Iterators](iterators.md)
1717
* [Concurrency](concurrency.md)
1818
* [Error Handling](error-handling.md)
19-
* [Choosing your Guarantees](choosing-your-guarantees.md)
2019
* [FFI](ffi.md)
2120
* [Borrow and AsRef](borrow-and-asref.md)
2221
* [Release Channels](release-channels.md)

branches/tmp/src/doc/trpl/choosing-your-guarantees.md

Lines changed: 0 additions & 356 deletions
This file was deleted.

branches/tmp/src/libcore/char.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,10 @@ pub fn from_u32(i: u32) -> Option<char> {
8484
if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
8585
None
8686
} else {
87-
Some(unsafe { from_u32_unchecked(i) })
87+
Some(unsafe { transmute(i) })
8888
}
8989
}
9090

91-
/// Converts a `u32` to an `char`, not checking whether it is a valid unicode
92-
/// codepoint.
93-
#[inline]
94-
#[unstable(feature = "char_from_unchecked", reason = "recently added API")]
95-
pub unsafe fn from_u32_unchecked(i: u32) -> char {
96-
transmute(i)
97-
}
98-
9991
/// Converts a number to the character representing it.
10092
///
10193
/// # Return value
@@ -123,11 +115,12 @@ pub fn from_digit(num: u32, radix: u32) -> Option<char> {
123115
panic!("from_digit: radix is too high (maximum 36)");
124116
}
125117
if num < radix {
126-
let num = num as u8;
127-
if num < 10 {
128-
Some((b'0' + num) as char)
129-
} else {
130-
Some((b'a' + num - 10) as char)
118+
unsafe {
119+
if num < 10 {
120+
Some(transmute('0' as u32 + num))
121+
} else {
122+
Some(transmute('a' as u32 + num - 10))
123+
}
131124
}
132125
} else {
133126
None
@@ -325,13 +318,16 @@ impl Iterator for EscapeUnicode {
325318
Some('{')
326319
}
327320
EscapeUnicodeState::Value(offset) => {
328-
let c = from_digit(((self.c as u32) >> (offset * 4)) & 0xf, 16).unwrap();
321+
let v = match ((self.c as i32) >> (offset * 4)) & 0xf {
322+
i @ 0 ... 9 => '0' as i32 + i,
323+
i => 'a' as i32 + (i - 10)
324+
};
329325
if offset == 0 {
330326
self.state = EscapeUnicodeState::RightBrace;
331327
} else {
332328
self.state = EscapeUnicodeState::Value(offset - 1);
333329
}
334-
Some(c)
330+
Some(unsafe { transmute(v) })
335331
}
336332
EscapeUnicodeState::RightBrace => {
337333
self.state = EscapeUnicodeState::Done;

0 commit comments

Comments
 (0)