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 From<&[T; N]> for Option<&[T]> #125605

Closed

Conversation

minghuaw
Copy link

This PR addresses issue #125600 by implementing From<&[T; N]> for Option<&[T]>. This would enable the following use case

fn foo<'a>(arg: impl Into<Option<&'a [i32]>>) { }

fn main() {
    foo(&[1,2,3]);
}

which currently only supports using &[1,2,3][..] as the argument.

@rustbot
Copy link
Collaborator

rustbot commented May 27, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cuviper (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@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. has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 27, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 27, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

@minghuaw minghuaw force-pushed the feat/optional_slice_from_fixed_slice branch from 3966f86 to b76dda0 Compare May 27, 2024 09:22
@rust-log-analyzer

This comment has been minimized.

@cuviper
Copy link
Member

cuviper commented May 27, 2024

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

@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 May 27, 2024
@rustbot rustbot assigned BurntSushi and unassigned cuviper May 27, 2024
@jhpratt jhpratt added the needs-fcp This change is insta-stable, so needs a completed FCP to proceed. label May 28, 2024
@minghuaw
Copy link
Author

minghuaw commented Jun 4, 2024

Closing because adding a trait impl doesn't solve the root cause of the problem .

@minghuaw minghuaw closed this Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-merge-commits PR has merge commits, merge with caution. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

6 participants