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

Use min_specialization in libcore #73565

Merged
merged 1 commit into from
Aug 21, 2020
Merged

Conversation

matthewjasper
Copy link
Contributor

Getting TrustedRandomAccess to work is the main interesting thing here.

  • get_unchecked is now an unstable, hidden method on Iterator
  • The contract for TrustedRandomAccess is made clearer in documentation
  • Fixed a bug where Debug would create aliasing references when using the specialized zip impl
  • Added tests for the side effects of next_back and nth.

closes #68536

@rust-highfive
Copy link
Collaborator

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 20, 2020
Copy link
Member

@nagisa nagisa left a comment

Choose a reason for hiding this comment

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

Only made a very basic initial pass, got distracted before I could go through the whole PR.

src/libcore/str/mod.rs Outdated Show resolved Hide resolved
#[doc(hidden)]
#[unstable(feature = "trusted_random_access", issue = "none")]
#[rustc_specialization_trait]
pub unsafe trait TrustedRandomAccess: Sized {
Copy link
Member

Choose a reason for hiding this comment

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

Why does this need to become pub?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's now used in the interface of Iterator

///
/// `size` may not be overridden.
///
/// `<Self as Iterator>::get_unchecked` must be overridden. It must be safe to
Copy link
Member

Choose a reason for hiding this comment

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

Given that the default implementation simply panic!()s, this is not an unsafety invariant, is it?

@bors
Copy link
Contributor

bors commented Jun 23, 2020

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

@Muirrum
Copy link
Member

Muirrum commented Jul 9, 2020

@rustbot modify labels to: +S-waiting-on-author -S-waiting-on-review

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 9, 2020
@crlf0710 crlf0710 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 24, 2020
@matthewjasper matthewjasper added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 25, 2020
@JohnTitor
Copy link
Member

Let's r? @nagisa as they left some review comments.

@rust-highfive rust-highfive assigned nagisa and unassigned cramertj Aug 5, 2020
Copy link
Member

@nagisa nagisa left a comment

Choose a reason for hiding this comment

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

@bors r+

assert_eq!(iter.next_back(), Some((40, 5000)));
assert_eq!(iter.next_back(), Some((30, 4000)));
assert_eq!(a, vec![6, 5, 4, 3]);
assert_eq!(b, vec![800, 700, 600, 500, 400]);
Copy link
Member

Choose a reason for hiding this comment

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

Do we actually want to enforce that the 2nd iterator consumes 1 more value than from the first iterator? I think this could go either way, but I would at least leave a comment to that effect so that a change in this behaviour wouldn’t immediately appear invalid.

@nagisa
Copy link
Member

nagisa commented Aug 16, 2020

Oh well, this will need a rebase, but r=me once that's done.

Sorry for taking so long to get around to this.

@matthewjasper
Copy link
Contributor Author

@bors r=nagisa

@bors
Copy link
Contributor

bors commented Aug 19, 2020

📌 Commit dbad8c9 has been approved by nagisa

@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 Aug 19, 2020
@bors
Copy link
Contributor

bors commented Aug 19, 2020

⌛ Testing commit dbad8c9 with merge 1dc99bb058f144c8f4f64b005e546c10f301901b...

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check of your PR failed (pretty log, 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.
Build completed successfully in 0:02:10
+ /scripts/validate-toolstate.sh
Cloning into 'rust-toolstate'...
<Nothing changed>
Traceback (most recent call last):
  File "../../src/tools/publish_toolstate.py", line 283, in <module>
    validate_maintainers(repo, github_token)
  File "../../src/tools/publish_toolstate.py", line 84, in validate_maintainers
    'Accept': 'application/vnd.github.hellcat-preview+json',
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
  local time: Wed Aug 19 22:47:09 UTC 2020
  network time: Wed, 19 Aug 2020 22:47:09 GMT
== end clock drift check ==
== end clock drift check ==
##[error]Process completed with exit code 1.
Terminate orphan process: pid (6409) (node)
Terminate orphan process: pid (6433) (python)

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 @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Aug 19, 2020

💔 Test failed - checks-actions

@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 Aug 19, 2020
@matthewjasper
Copy link
Contributor Author

@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 Aug 20, 2020
@bors
Copy link
Contributor

bors commented Aug 20, 2020

⌛ Testing commit dbad8c9 with merge 2f15b6b842776d00d2eb9369deeb7dcd1b3a3baa...

@bors
Copy link
Contributor

bors commented Aug 20, 2020

💔 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 Aug 20, 2020
@matthewjasper
Copy link
Contributor Author

@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 Aug 20, 2020
@bors
Copy link
Contributor

bors commented Aug 20, 2020

⌛ Testing commit dbad8c9 with merge d9d4d39...

@bors
Copy link
Contributor

bors commented Aug 21, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: nagisa
Pushing d9d4d39 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 21, 2020
@bors bors merged commit d9d4d39 into rust-lang:master Aug 21, 2020
@matthewjasper matthewjasper deleted the core-min-spec branch August 21, 2020 07:06
cuviper added a commit to cuviper/rust that referenced this pull request Sep 5, 2020
@the8472
Copy link
Member

the8472 commented Jan 3, 2021

@matthewjasper I'm currently thinking how to extend TrustedRandomAccess to drop types, one piece I am currently not understanding is why __iterator_get_unchecked was moved from TrustedRandomAccess to Iterator but not its other methods.

@matthewjasper
Copy link
Contributor Author

__iterator_get_unchecked was moved because it sometimes needs the bounds on the Iterator impl. The other methods were not because I wanted to minimize what was added to Iterator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nth_back() for Zip returns wrong values