Skip to content

Commit ada341d

Browse files
committed
---
yaml --- r: 224238 b: refs/heads/beta c: 8ebf952 h: refs/heads/master v: v3
1 parent 748d074 commit ada341d

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
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 04badd6a973d2499731b49365a121dbc4c9c468e
26+
refs/heads/beta: 8ebf95257bfc9093cb25dba209ded303ec167e5f
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 938f5d7af401e2d8238522fed4a612943b6e77fd
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/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/beta/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/beta/src/doc/trpl/choosing-your-guarantees.md

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

branches/beta/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)