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

Impl Debug for Chars #63000

Merged
merged 2 commits into from
Jul 30, 2019
Merged

Impl Debug for Chars #63000

merged 2 commits into from
Jul 30, 2019

Conversation

max-sixty
Copy link
Contributor

Closes #62947, making Debug more consistent with the struct's output and purpose

Let me know any feedback!

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 26, 2019
@rust-highfive

This comment has been minimized.

@hellow554

This comment has been minimized.

@max-sixty
Copy link
Contributor Author

@hellow554 done

@ollie27
Copy link
Member

ollie27 commented Jul 26, 2019

How about using DebugList with f.debug_list().entries(self.clone()).finish()? For example it would output ['ศ', 'ไ', 'ท', 'ย', '中', '华', 'V', 'i', 'ệ', 't', ' ', 'N', 'a', 'm'] which would match other Debug impls.

@max-sixty
Copy link
Contributor Author

@ollie27 great, I didn't know about that. Changed

@alexcrichton
Copy link
Member

@bors: r+

Thanks @max-sixty!

@bors
Copy link
Contributor

bors commented Jul 29, 2019

📌 Commit b27f9af17a529c3487df0ae979c783bcd7d8aee3 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 29, 2019
src/liballoc/tests/str.rs Outdated Show resolved Hide resolved
src/libcore/str/mod.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Jul 29, 2019

⌛ Testing commit b27f9af17a529c3487df0ae979c783bcd7d8aee3 with merge d71338920d477e0f8ebdcebd6428dd0d26daed64...

@rust-highfive
Copy link
Collaborator

Your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-07-29T14:18:57.6623740Z ==============================================================================
2019-07-29T14:18:57.8581860Z Generating script.
2019-07-29T14:18:57.8632620Z ========================== Starting Command Output ===========================
2019-07-29T14:18:57.8688660Z [command]/bin/bash --noprofile --norc /Users/vsts/agent/2.154.3/work/_temp/884a37ae-fa12-45f4-acc8-eaf55bf1ec92.sh
2019-07-29T14:25:09.0448170Z error: RPC failed; curl 18 transfer closed with outstanding read data remaining
2019-07-29T14:25:09.0454620Z fatal: the remote end hung up unexpectedly
2019-07-29T14:25:09.0539710Z Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask failed!
2019-07-29T14:25:14.3017690Z   https://github.com/Homebrew/brew#donations
2019-07-29T14:25:42.1321900Z Updated 2 taps (caskroom/versions and homebrew/core).
2019-07-29T14:25:42.1322900Z ==> New Formulae
2019-07-29T14:25:42.1323450Z asyncplusplus
---
2019-07-29T14:25:42.1458600Z ==> Deleted Formulae
2019-07-29T14:25:42.1458750Z libggz
2019-07-29T14:25:42.1458830Z libguess
2019-07-29T14:25:42.1458990Z lysp
2019-07-29T14:25:42.1791490Z ##[error]Bash exited with code '1'.
2019-07-29T14:25:42.2065650Z ##[section]Starting: Upload CPU usage statistics
2019-07-29T14:25:42.2070580Z ==============================================================================
2019-07-29T14:25:42.2070700Z Task         : Bash
2019-07-29T14:25:42.2070770Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-07-29T14:25:42.3926220Z Script contents:
2019-07-29T14:25:42.3927070Z aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv
2019-07-29T14:25:42.3952080Z ========================== Starting Command Output ===========================
2019-07-29T14:25:42.3978740Z [command]/bin/bash --noprofile --norc /Users/vsts/agent/2.154.3/work/_temp/bc555231-107f-453b-8479-d3b06170a06a.sh
2019-07-29T14:25:42.4105520Z /Users/vsts/agent/2.154.3/work/_temp/bc555231-107f-453b-8479-d3b06170a06a.sh: line 1: aws: command not found
2019-07-29T14:25:42.4190270Z ##[error]Bash exited with code '127'.
2019-07-29T14:25:42.4274930Z ##[section]Starting: Checkout
2019-07-29T14:25:42.4278010Z ==============================================================================
2019-07-29T14:25:42.4278200Z Task         : Get sources
2019-07-29T14:25:42.4278380Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Jul 29, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 29, 2019
@alexcrichton
Copy link
Member

@bors: retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 29, 2019
@max-sixty
Copy link
Contributor Author

Thanks @lzutao, changed

@max-sixty
Copy link
Contributor Author

I pushed a set of rebased commits.

(Do the dictums conflicts a) "don't change old commits: new commits for new changes" and b) "rebase, don't merge" ? Maybe I'm misunderstanding them)

@alexcrichton
Copy link
Member

@bors: r+

Nah this is fine, thanks!

@bors
Copy link
Contributor

bors commented Jul 29, 2019

📌 Commit 3325ff6 has been approved by alexcrichton

@max-sixty
Copy link
Contributor Author

Cheers @alexcrichton !

@Centril Centril added this to the 1.38 milestone Jul 29, 2019
@Centril Centril added relnotes Marks issues that should be documented in the release notes of the next release. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 29, 2019
Centril added a commit to Centril/rust that referenced this pull request Jul 29, 2019
…hton

Impl Debug for Chars

Closes rust-lang#62947, making `Debug` more consistent with the struct's output and purpose

Let me know any feedback!
Centril added a commit to Centril/rust that referenced this pull request Jul 29, 2019
…hton

Impl Debug for Chars

Closes rust-lang#62947, making `Debug` more consistent with the struct's output and purpose

Let me know any feedback!
Centril added a commit to Centril/rust that referenced this pull request Jul 30, 2019
…hton

Impl Debug for Chars

Closes rust-lang#62947, making `Debug` more consistent with the struct's output and purpose

Let me know any feedback!
Centril added a commit to Centril/rust that referenced this pull request Jul 30, 2019
…hton

Impl Debug for Chars

Closes rust-lang#62947, making `Debug` more consistent with the struct's output and purpose

Let me know any feedback!
bors added a commit that referenced this pull request Jul 30, 2019
Rollup of 12 pull requests

Successful merges:

 - #61965 (Remove mentions of removed `offset_to` method from `align_offset` docs)
 - #62928 (Syntax: Recover on `for ( $pat in $expr ) $block`)
 - #63000 (Impl Debug for Chars)
 - #63083 (Make generic parameters always use modern hygiene)
 - #63087 (Add very simple edition check to tidy.)
 - #63093 (Properly check the defining scope of existential types)
 - #63096 (Add tests for some `existential_type` ICEs)
 - #63099 (vxworks: Remove Linux-specific comments.)
 - #63106 (ci: Skip installing SWIG/xz on OSX )
 - #63108 (Add links to None in Option doc)
 - #63109 (std: Fix a failing `fs` test on Windows)
 - #63111 (Add syntactic and semantic tests for rest patterns, i.e. `..`)

Failed merges:

r? @ghost
@bors bors merged commit 3325ff6 into rust-lang:master Jul 30, 2019
@max-sixty max-sixty deleted the chars-display branch July 30, 2019 07:54
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Oct 2, 2019
Pkgsrc changes:
 * Adapt to the move of the implementation of random numbers.
 * Remove patch which is no longer relevant (Signals.inc)
 * Cross-build currently fails due to the still unresolved
   rust-lang/rust#62558, so bootstrap
   kits for 1.38.0 have to be built natively, and will follow shortly.
 * Bump bootstrap requirements to 1.37.0 except for armv7-unknown-netbsd-eabihf
   which I've neither managed to cross-build nor build natively.

Upstream changes:

Version 1.38.0 (2019-09-26)
==========================

Language
--------
- [The `#[global_allocator]` attribute can now be used in submodules.][62735]
- [The `#[deprecated]` attribute can now be used on macros.][62042]

Compiler
--------
- [Added pipelined compilation support to `rustc`.][62766] This will
  improve compilation times in some cases. For further information please refer
  to the [_"Evaluating pipelined rustc compilation"_][pipeline-internals]
  thread.
- [Added tier 3\* support for the `aarch64-uwp-windows-msvc`,
  `i686-uwp-windows-gnu`, `i686-uwp-windows-msvc`, `x86_64-uwp-windows-gnu`,
  and `x86_64-uwp-windows-msvc` targets.][60260]
- [Added tier 3 support for the `armv7-unknown-linux-gnueabi` and
  `armv7-unknown-linux-musleabi` targets.][63107]
- [Added tier 3 support for the `hexagon-unknown-linux-musl` target.][62814]
- [Added tier 3 support for the `riscv32i-unknown-none-elf` target.][62784]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.

Libraries
---------
- [`ascii::EscapeDefault` now implements `Clone` and `Display`.][63421]
- [Derive macros for prelude traits (e.g. `Clone`, `Debug`, `Hash`) are now
  available at the same path as the trait.][63056] (e.g. The `Clone` derive
  macro is available at `std::clone::Clone`). This also makes all built-in
  macros available in `std`/`core` root. e.g. `std::include_bytes!`.
- [`str::Chars` now implements `Debug`.][63000]
- [`slice::{concat, connect, join}` now accepts `&[T]` in addition to
   `&T`.][62528]
- [`*const T` and `*mut T` now implement `marker::Unpin`.][62583]
- [`Arc<[T]>` and `Rc<[T]>` now implement `FromIterator<T>`.][61953]
- [Added euclidean remainder and division operations (`div_euclid`,
  `rem_euclid`) to all numeric primitives.][61884] Additionally `checked`,
  `overflowing`, and `wrapping` versions are available for all
  integer primitives.
- [`thread::AccessError` now implements `Clone`, `Copy`, `Eq`, `Error`, and
  `PartialEq`.][61491]
- [`iter::{StepBy, Peekable, Take}` now implement `DoubleEndedIterator`.][61457]

Stabilized APIs
---------------
- [`<*const T>::cast`]
- [`<*mut T>::cast`]
- [`Duration::as_secs_f32`]
- [`Duration::as_secs_f64`]
- [`Duration::div_duration_f32`]
- [`Duration::div_duration_f64`]
- [`Duration::div_f32`]
- [`Duration::div_f64`]
- [`Duration::from_secs_f32`]
- [`Duration::from_secs_f64`]
- [`Duration::mul_f32`]
- [`Duration::mul_f64`]
- [`any::type_name`]

Cargo
-----
- [Added pipelined compilation support to `cargo`.][cargo/7143]
- [You can now pass the `--features` option multiple times to enable
  multiple features.][cargo/7084]

Misc
----
- [`rustc` will now warn about some incorrect uses of
  `mem::{uninitialized, zeroed}` that are known to cause undefined
  behaviour.][63346]

Compatibility Notes
-------------------
- Unfortunately the [`x86_64-unknown-uefi` platform can not be built][62785]
  with rustc 1.39.0.
- The [`armv7-unknown-linux-gnueabihf` platform is also known to have
  issues][62896] for certain crates such as libc.

[60260]: rust-lang/rust#60260
[61457]: rust-lang/rust#61457
[61491]: rust-lang/rust#61491
[61884]: rust-lang/rust#61884
[61953]: rust-lang/rust#61953
[62042]: rust-lang/rust#62042
[62528]: rust-lang/rust#62528
[62583]: rust-lang/rust#62583
[62735]: rust-lang/rust#62735
[62766]: rust-lang/rust#62766
[62784]: rust-lang/rust#62784
[62785]: rust-lang/rust#62785
[62814]: rust-lang/rust#62814
[62896]: rust-lang/rust#62896
[63000]: rust-lang/rust#63000
[63056]: rust-lang/rust#63056
[63107]: rust-lang/rust#63107
[63346]: rust-lang/rust#63346
[63421]: rust-lang/rust#63421
[cargo/7084]: rust-lang/cargo#7084
[cargo/7143]: rust-lang/cargo#7143
[`<*const T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
[`<*mut T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f32
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f64
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f32
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f64
[`Duration::div_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f32
[`Duration::div_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f64
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f32
[`Duration::from_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f64
[`Duration::mul_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f32
[`Duration::mul_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f64
[`any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html
[forge-platform-support]: https://forge.rust-lang.org/platform-support.html
[pipeline-internals]: https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Oct 18, 2019
Pkgsrc changes:
 * Adapt to the move of the implementation of random numbers.
 * Remove patch which is no longer relevant (Signals.inc)
 * Cross-build currently fails due to the still unresolved
   rust-lang/rust#62558, so bootstrap
   kits for 1.38.0 have to be built natively, and will follow shortly.
 * Bump bootstrap requirements to 1.37.0 except for armv7-unknown-netbsd-eabihf
   which I've neither managed to cross-build nor build natively.

Upstream changes:

Version 1.38.0 (2019-09-26)
==========================

Language
--------
- [The `#[global_allocator]` attribute can now be used in submodules.][62735]
- [The `#[deprecated]` attribute can now be used on macros.][62042]

Compiler
--------
- [Added pipelined compilation support to `rustc`.][62766] This will
  improve compilation times in some cases. For further information please refer
  to the [_"Evaluating pipelined rustc compilation"_][pipeline-internals]
  thread.
- [Added tier 3\* support for the `aarch64-uwp-windows-msvc`,
  `i686-uwp-windows-gnu`, `i686-uwp-windows-msvc`, `x86_64-uwp-windows-gnu`,
  and `x86_64-uwp-windows-msvc` targets.][60260]
- [Added tier 3 support for the `armv7-unknown-linux-gnueabi` and
  `armv7-unknown-linux-musleabi` targets.][63107]
- [Added tier 3 support for the `hexagon-unknown-linux-musl` target.][62814]
- [Added tier 3 support for the `riscv32i-unknown-none-elf` target.][62784]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.

Libraries
---------
- [`ascii::EscapeDefault` now implements `Clone` and `Display`.][63421]
- [Derive macros for prelude traits (e.g. `Clone`, `Debug`, `Hash`) are now
  available at the same path as the trait.][63056] (e.g. The `Clone` derive
  macro is available at `std::clone::Clone`). This also makes all built-in
  macros available in `std`/`core` root. e.g. `std::include_bytes!`.
- [`str::Chars` now implements `Debug`.][63000]
- [`slice::{concat, connect, join}` now accepts `&[T]` in addition to
   `&T`.][62528]
- [`*const T` and `*mut T` now implement `marker::Unpin`.][62583]
- [`Arc<[T]>` and `Rc<[T]>` now implement `FromIterator<T>`.][61953]
- [Added euclidean remainder and division operations (`div_euclid`,
  `rem_euclid`) to all numeric primitives.][61884] Additionally `checked`,
  `overflowing`, and `wrapping` versions are available for all
  integer primitives.
- [`thread::AccessError` now implements `Clone`, `Copy`, `Eq`, `Error`, and
  `PartialEq`.][61491]
- [`iter::{StepBy, Peekable, Take}` now implement `DoubleEndedIterator`.][61457]

Stabilized APIs
---------------
- [`<*const T>::cast`]
- [`<*mut T>::cast`]
- [`Duration::as_secs_f32`]
- [`Duration::as_secs_f64`]
- [`Duration::div_duration_f32`]
- [`Duration::div_duration_f64`]
- [`Duration::div_f32`]
- [`Duration::div_f64`]
- [`Duration::from_secs_f32`]
- [`Duration::from_secs_f64`]
- [`Duration::mul_f32`]
- [`Duration::mul_f64`]
- [`any::type_name`]

Cargo
-----
- [Added pipelined compilation support to `cargo`.][cargo/7143]
- [You can now pass the `--features` option multiple times to enable
  multiple features.][cargo/7084]

Misc
----
- [`rustc` will now warn about some incorrect uses of
  `mem::{uninitialized, zeroed}` that are known to cause undefined
  behaviour.][63346]

Compatibility Notes
-------------------
- Unfortunately the [`x86_64-unknown-uefi` platform can not be built][62785]
  with rustc 1.39.0.
- The [`armv7-unknown-linux-gnueabihf` platform is also known to have
  issues][62896] for certain crates such as libc.

[60260]: rust-lang/rust#60260
[61457]: rust-lang/rust#61457
[61491]: rust-lang/rust#61491
[61884]: rust-lang/rust#61884
[61953]: rust-lang/rust#61953
[62042]: rust-lang/rust#62042
[62528]: rust-lang/rust#62528
[62583]: rust-lang/rust#62583
[62735]: rust-lang/rust#62735
[62766]: rust-lang/rust#62766
[62784]: rust-lang/rust#62784
[62785]: rust-lang/rust#62785
[62814]: rust-lang/rust#62814
[62896]: rust-lang/rust#62896
[63000]: rust-lang/rust#63000
[63056]: rust-lang/rust#63056
[63107]: rust-lang/rust#63107
[63346]: rust-lang/rust#63346
[63421]: rust-lang/rust#63421
[cargo/7084]: rust-lang/cargo#7084
[cargo/7143]: rust-lang/cargo#7143
[`<*const T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
[`<*mut T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f32
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f64
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f32
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f64
[`Duration::div_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f32
[`Duration::div_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f64
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f32
[`Duration::from_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f64
[`Duration::mul_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f32
[`Duration::mul_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f64
[`any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html
[forge-platform-support]: https://forge.rust-lang.org/platform-support.html
[pipeline-internals]: https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing Debug of chars
8 participants