Skip to content

Rollup of 5 pull requests #27270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
36d8529
Improve E0001-E0003
Manishearth Jun 29, 2015
688a099
Move E0006 into E0005
Manishearth Jun 29, 2015
5d31dee
Add error explanation for E0017
Manishearth Jul 11, 2015
37a84bc
Add error explanation for E0022
Manishearth Jul 11, 2015
950c2d8
Add huge explanation for E0038 (object safety)
Manishearth Jul 11, 2015
29d7147
Review fixes
Manishearth Jul 11, 2015
e9c1530
Add long diagnostic for E0136
Manishearth Jul 18, 2015
3080df3
Add long diagnostic for E0138
Manishearth Jul 18, 2015
74768e9
Add long diagnostics for E0139 (type parameters in transmute)
Manishearth Jul 18, 2015
d6be183
Improve E0260
Manishearth Jul 19, 2015
4337e82
Add long diagnostic for E0269
Manishearth Jul 19, 2015
0eb552a
wtf8, char: Replace uses of `mem::transmute` with more specific funct…
tbu- Jul 23, 2015
c2fca7c
Add unstable attribute to `char::from_u32_unchecked`
tbu- Jul 23, 2015
4726bb4
Correct regression in type-inference caused by failing to reconfirm that
nikomatsakis Jul 24, 2015
8590501
Add E0270
Manishearth Jul 19, 2015
dc556be
Add long diagnostics for E0272-274 (on_unimplemented)
Manishearth Jul 22, 2015
b531776
Add long diagnostic explanation for E0275
Manishearth Jul 22, 2015
522a978
Add long diagnostic for E0276
Manishearth Jul 22, 2015
c588935
Address comments
Manishearth Jul 23, 2015
847fba0
Fix `improper_ctypes` fallout
tamird Jul 24, 2015
beca53a
Move wrapper types blog post into trpl
Manishearth Jul 11, 2015
074a296
Rollup merge of #26960 - Manishearth:wrapper-types, r=steveklabnik
Manishearth Jul 24, 2015
2b8ca1a
Rollup merge of #26963 - Manishearth:improve-diag, r=steveklabnik
Manishearth Jul 24, 2015
c0584a7
Rollup merge of #27233 - tbu-:pr_wtf8, r=alexcrichton
Manishearth Jul 24, 2015
5ee8778
Rollup merge of #27258 - nikomatsakis:issue-26952, r=eddyb
Manishearth Jul 24, 2015
352ff41
Rollup merge of #27267 - tamird:fix-ios-improper-ctypes, r=alexcrichton
Manishearth Jul 24, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/doc/rust.css
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ a > code {
color: #428BCA;
}

.section-header > a > code {
color: #8D1A38;
}

/* Code highlighting */
pre.rust .kw { color: #8959A8; }
pre.rust .kw-2, pre.rust .prelude-ty { color: #4271AE; }
Expand Down
1 change: 1 addition & 0 deletions src/doc/trpl/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [Iterators](iterators.md)
* [Concurrency](concurrency.md)
* [Error Handling](error-handling.md)
* [Choosing your Guarantees](choosing-your-guarantees.md)
* [FFI](ffi.md)
* [Borrow and AsRef](borrow-and-asref.md)
* [Release Channels](release-channels.md)
Expand Down
354 changes: 354 additions & 0 deletions src/doc/trpl/choosing-your-guarantees.md

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,18 @@ pub fn from_u32(i: u32) -> Option<char> {
if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
None
} else {
Some(unsafe { transmute(i) })
Some(unsafe { from_u32_unchecked(i) })
}
}

/// Converts a `u32` to an `char`, not checking whether it is a valid unicode
/// codepoint.
#[inline]
#[unstable(feature = "char_from_unchecked", reason = "recently added API")]
pub unsafe fn from_u32_unchecked(i: u32) -> char {
transmute(i)
}

/// Converts a number to the character representing it.
///
/// # Return value
Expand Down Expand Up @@ -115,12 +123,11 @@ pub fn from_digit(num: u32, radix: u32) -> Option<char> {
panic!("from_digit: radix is too high (maximum 36)");
}
if num < radix {
unsafe {
if num < 10 {
Some(transmute('0' as u32 + num))
} else {
Some(transmute('a' as u32 + num - 10))
}
let num = num as u8;
if num < 10 {
Some((b'0' + num) as char)
} else {
Some((b'a' + num - 10) as char)
}
} else {
None
Expand Down Expand Up @@ -318,16 +325,13 @@ impl Iterator for EscapeUnicode {
Some('{')
}
EscapeUnicodeState::Value(offset) => {
let v = match ((self.c as i32) >> (offset * 4)) & 0xf {
i @ 0 ... 9 => '0' as i32 + i,
i => 'a' as i32 + (i - 10)
};
let c = from_digit(((self.c as u32) >> (offset * 4)) & 0xf, 16).unwrap();
if offset == 0 {
self.state = EscapeUnicodeState::RightBrace;
} else {
self.state = EscapeUnicodeState::Value(offset - 1);
}
Some(unsafe { transmute(v) })
Some(c)
}
EscapeUnicodeState::RightBrace => {
self.state = EscapeUnicodeState::Done;
Expand Down
Loading