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

Implement TryFrom<&str> for numerical types, bool and char #104283

Closed
wants to merge 2 commits into from

Conversation

grego
Copy link

@grego grego commented Nov 11, 2022

As TryFrom is a generic interface for fallible conversion, the standard library types should support it as well.

ACP: rust-lang/libs-team#132 [Accepted]

@rustbot
Copy link
Collaborator

rustbot commented Nov 11, 2022

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

Please see the contribution instructions for more information.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 11, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 11, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@grego
Copy link
Author

grego commented Nov 11, 2022

@rustbot label +T-libs-api -T-libs

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 11, 2022
@Noratrieb
Copy link
Member

Thank you for the implementation!
But since this a change to the public API, you need to create an API change proposal to move this forward.

@grego
Copy link
Author

grego commented Nov 11, 2022

Thank you, I created the proposal here.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Compiling unwind v0.0.0 (/checkout/library/unwind)
error[E0405]: cannot find trait `TryFrom` in this scope
   --> library/core/src/num/nonzero.rs:199:18
    |
197 | / macro_rules! try_from_str_radix_nzint_impl {
198 | |     ($($t:ty)*) => {$(
199 | |         impl<'a> TryFrom<&'a str> for $t {
200 | |             type Error = ParseIntError;
...   |
208 | |     )*}
209 | | }
209 | | }
    | |_- in this expansion of `try_from_str_radix_nzint_impl!`
210 |
211 | / try_from_str_radix_nzint_impl! { NonZeroU8 NonZeroU16 NonZeroU32 NonZeroU64 NonZeroU128 NonZeroUsize
212 | | NonZeroI8 NonZeroI16 NonZeroI32 NonZeroI64 NonZeroI128 NonZeroIsize }
    |
help: consider importing this trait
    |
3   | use crate::convert::TryFrom;

@thomcc thomcc added the S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. label Nov 12, 2022
@bors
Copy link
Contributor

bors commented Nov 19, 2022

☔ The latest upstream changes (presumably #104591) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC Dylan-DPC removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 27, 2023
@Dylan-DPC Dylan-DPC added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. labels Oct 8, 2023
@dtolnay dtolnay assigned dtolnay and unassigned thomcc Jan 26, 2024
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ACP was not accepted, so I'll go ahead and close this PR.

Thank you anyway for suggesting this API and entertaining our process!

@dtolnay dtolnay closed this Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

8 participants