Skip to content
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

Rollup of 9 pull requests #63112

Closed
wants to merge 24 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fed12fa
Remove mentions of removed `offset_to` method
phil-opp Jun 19, 2019
c9c73f5
Refer to `add` method instead of `offset`
phil-opp Jul 17, 2019
d68f0f6
Remove derives `Encodable`/`Decodable` and unstabilize attribute `#[b…
petrochenkov Jul 27, 2019
dfad725
Recover 'for ( $pat in $expr ) $block'.
Centril Jul 24, 2019
1b11860
Use chaining for diagnosics in parser.
Centril Jul 24, 2019
56b39fb
Add 'span_to_snippet' shortcut.
Centril Jul 24, 2019
18bf9dd
Properly check the defining scope of existential types
Aaron1011 Jul 28, 2019
8811b9c
Fix formatting
Aaron1011 Jul 28, 2019
3e98c3a
Rename test and add comment
Aaron1011 Jul 28, 2019
0cdd693
vxworks: Remove Linux-specific comments.
josephlr Jul 29, 2019
c56d8a8
Add links to None in Option doc
tesuji Jul 29, 2019
624c5da
impl Debug for Chars
max-sixty Jul 26, 2019
3325ff6
comments from @lzutao
max-sixty Jul 29, 2019
8d7fb87
std: Fix a failing `fs` test on Windows
alexcrichton Jul 29, 2019
870efe3
Add very simple edition check to tidy; and add missing edition = 2018s.
crlf0710 Jul 28, 2019
b20abcf
Rollup merge of #61965 - phil-opp:patch-4, r=scottmcm
Centril Jul 29, 2019
600c8f6
Rollup merge of #62507 - petrochenkov:macunstab, r=alexcrichton
Centril Jul 29, 2019
04ec35b
Rollup merge of #62928 - Centril:recover-parens-around-for-head, r=es…
Centril Jul 29, 2019
2575e53
Rollup merge of #63000 - max-sixty:chars-display, r=alexcrichton
Centril Jul 29, 2019
2c0e220
Rollup merge of #63087 - crlf0710:tidy_2018, r=Mark-Simulacrum
Centril Jul 29, 2019
4551dc2
Rollup merge of #63093 - Aaron1011:fix/existential-closure, r=cramertj
Centril Jul 29, 2019
0a0cf6f
Rollup merge of #63099 - josephlr:vxworks, r=alexcrichton
Centril Jul 29, 2019
9845163
Rollup merge of #63108 - lzutao:option-xor-typo, r=jonas-schievink
Centril Jul 29, 2019
2c54921
Rollup merge of #63109 - alexcrichton:disable-windows-fs-test, r=sfac…
Centril Jul 29, 2019
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
Prev Previous commit
Next Next commit
impl Debug for Chars
  • Loading branch information
max-sixty committed Jul 29, 2019

Verified

This commit was signed with the committer’s verified signature. The key has expired.
max-sixty Maximilian Roos
commit 624c5da1aacf44354dead47dce5033f1806e9228
10 changes: 10 additions & 0 deletions src/liballoc/tests/str.rs
Original file line number Diff line number Diff line change
@@ -1108,6 +1108,16 @@ fn test_iterator_last() {
assert_eq!(it.last(), Some('m'));
}

#[test]
fn test_chars_display() {
let s = "ศไทย中华Việt Nam";
let c = s.chars();
assert_eq!(
format!("{:?}", c),
r#"Chars(['ศ', 'ไ', 'ท', 'ย', '中', '华', 'V', 'i', 'ệ', 't', ' ', 'N', 'a', 'm'])"#
);
}

#[test]
fn test_bytesator() {
let s = "ศไทย中华Việt Nam";
12 changes: 11 additions & 1 deletion src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
@@ -464,7 +464,7 @@ Section: Iterators
///
/// [`chars`]: ../../std/primitive.str.html#method.chars
/// [`str`]: ../../std/primitive.str.html
#[derive(Clone, Debug)]
#[derive(Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Chars<'a> {
iter: slice::Iter<'a, u8>
@@ -600,6 +600,16 @@ impl<'a> Iterator for Chars<'a> {
}
}

#[stable(feature = "chars_debug_impl", since = "1.38.0")]
impl<'a> fmt::Debug for Chars<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Chars(")?;
f.debug_list().entries(self.clone()).finish()?;
write!(f, ")")?;
Ok(())
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> DoubleEndedIterator for Chars<'a> {
#[inline]