Skip to content

Partially stabilize bound_as_ref by stabilizing Bound::as_ref - #99736

Merged
bors merged 1 commit into
rust-lang:masterfrom
lopopolo:lopopolo/gh-80996-partial-stabilization-bounds-as-ref
Sep 3, 2022
Merged

Partially stabilize bound_as_ref by stabilizing Bound::as_ref#99736
bors merged 1 commit into
rust-lang:masterfrom
lopopolo:lopopolo/gh-80996-partial-stabilization-bounds-as-ref

Conversation

@lopopolo

Copy link
Copy Markdown
Contributor

Stabilizing Bound::as_ref will simplify the implementation for RangeBounds<usize> for custom range types:

implRangeBounds<usize>forRegion{fnstart_bound(&self) -> Bound<&usize>{// TODO: Use `self.start.as_ref()` when upstream `std` stabilizes:// https://github.com/rust-lang/rust/issues/80996matchself.start{Bound::Included(ref bound) => Bound::Included(bound),Bound::Excluded(ref bound) => Bound::Excluded(bound),Bound::Unbounded => Bound::Unbounded,}}fnend_bound(&self) -> Bound<&usize>{// TODO: Use `self.end.as_ref()` when upstream `std` stabilizes:// https://github.com/rust-lang/rust/issues/80996matchself.end{Bound::Included(ref bound) => Bound::Included(bound),Bound::Excluded(ref bound) => Bound::Excluded(bound),Bound::Unbounded => Bound::Unbounded,}}}

See:

cc @yaahc who suggested partial stabilization.

@rustbotrustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jul 25, 2022
@rustbot

Copy link
Copy Markdown
Collaborator

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

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @thomcc

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 25, 2022
@lopopololopopolo mentioned this pull request Jul 25, 2022
3 tasks
@lopopololopopolo changed the title Partially stabilize bound_as_ref by stablizing Bound::as_refPartially stabilize bound_as_ref by stabilizing Bound::as_refJul 25, 2022
@thomcc

Copy link
Copy Markdown
Member

Impl looks fine but this needs libs-api FCP.

@thomccthomcc added T-libs-api [DEPRECATED; DO NOT USE] and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 25, 2022
@lopopolo

lopopolo commented Jul 25, 2022

Copy link
Copy Markdown
ContributorAuthor

Impl looks fine but this needs libs-api FCP.

oh whoops, it looks like I missed the magic comment rustbot asked me to make. Thanks @thomcc!

@yaahc

yaahc commented Jul 26, 2022

Copy link
Copy Markdown
Member

Looks good to me, @lopopolo could you also make a stabilization report1? Once we've got that I'll go ahead and kick off an FCP.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html#stabilization-report

@lopopolo

Copy link
Copy Markdown
ContributorAuthor

Stabilization Report

This stabilization report is for a partial stabilization of the bound_as_ref feature. Tracking issue: #80996.

Implementation History

API Summary

This stabilization report proposes the following API to be stabilized:

impl<T>Bound<T>{pubfnas_ref(&self) -> Bound<&T>;}

This new API has a motivating usecase to assist in the implementation of the RangeBounds<T> trait for custom range-like data types that store Bound internally.

Experience Report

Code such as this is ready to be converted to this API:

https://github.com/artichoke/artichoke/blob/0a19084bd1c7a8bd65e10e6b1ff99aedeec784ee/artichoke-backend/src/extn/core/matchdata/mod.rs#L54-L74

@dtolnay has remarked that Bound::as_ref is well-motivated given that RangeBounds<T> revolves around returning Bound<&T>: #80996 (comment).

@yaahc

Copy link
Copy Markdown
Member

thank you very much @lopopolo!

@rfcbot merge

@rfcbot

rfcbot commented Jul 26, 2022

Copy link
Copy Markdown

Team member @yaahc has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbotrfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jul 26, 2022
@lopopolo

lopopolo commented Aug 13, 2022

Copy link
Copy Markdown
ContributorAuthor

@yaahc did I do something wrong that has caused this proposed FCP to hang open? Do I need to update the since attribute since 1.63.0 has gone out?

@rfcbotrfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Aug 20, 2022
@rfcbot

Copy link
Copy Markdown

🔔 This is now entering its final comment period, as per the review above. 🔔

@thomccthomcc added S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 24, 2022
@est31

Copy link
Copy Markdown
Member

👋 Hello, I'm writing this comment in this stabilization PR to notify you, the authors of this PR, that #100591 has been merged, which implemented a change in how features are stabilized.

Your PR has been filed before the change, so will likely require modifications in order to comply with the new rules. I recommend you to:

  1. rebase the PR onto latest master, so that uses of the placeholder are possible.
  2. replace the version numbers in the PR with the placeholder CURRENT_RUSTC_VERSION. For language changes, this means the version numbers in accepted.rs (example: 4caedba). For library changes, this means the since fields (example e576a9b).

That's it! The CURRENT_RUSTC_VERSION placeholder will, as part of the release process, be replaced with the version number that the PR merged for. It can be used anywhere in rust-lang/rust, not just accepted.rs and the since fields.

If you have any questions, feel free to drop by the zulip stream, or ping me directly in this PR's thread. Thanks! 👋

@lopopolo

Copy link
Copy Markdown
ContributorAuthor

@est31 I think I got this sorted out. Thanks for making this change! It directly addresses my concern from #99736 (comment).

@rfcbotrfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Aug 30, 2022
@rfcbot

Copy link
Copy Markdown

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@rfcbotrfcbot added the to-announce Announce this issue on triage meeting label Aug 30, 2022
@lopopolo

Copy link
Copy Markdown
ContributorAuthor

@yaahc@joshtriplett can this be merged now that the FCP is concluded?

@dtolnay

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Sep 2, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 773df67 has been approved by dtolnay

It is now in the queue for this repository.

@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 2, 2022
@dtolnaydtolnay assigned dtolnay and unassigned thomccSep 2, 2022
@Dylan-DPCDylan-DPC mentioned this pull request Sep 3, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 3, 2022
Rollup of 7 pull requests
Successful merges:
- rust-lang#99736 (Partially stabilize `bound_as_ref` by stabilizing `Bound::as_ref`)
- rust-lang#100928 (Migrate rustc_metadata to SessionDiagnostics)
- rust-lang#101217 ([drop tracking] Use parent expression for scope, not parent node )
- rust-lang#101325 (Windows RNG: Use `BCRYPT_RNG_ALG_HANDLE` by default)
- rust-lang#101330 (Fix `std::collections::HashSet::drain` documentation)
- rust-lang#101338 (Fix unsupported syntax in .manifest file)
- rust-lang#101348 (Cleanup css theme)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 2ed716a into rust-lang:masterSep 3, 2022
@rustbotrustbot added this to the 1.65.0 milestone Sep 3, 2022
@apirainoapiraino removed the to-announce Announce this issue on triage meeting label Sep 8, 2022
@lopopolo
lopopolo deleted the lopopolo/gh-80996-partial-stabilization-bounds-as-ref branch September 25, 2022 17:38
lopopolo added a commit to artichoke/artichoke that referenced this pull request Dec 30, 2024
…chData`
I stabilized this API in Rust 1.65.0 in rust-lang/rust#99736 but
forgot to adopt it.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.S-waiting-on-fcpStatus: PR is in FCP and is awaiting for FCP to complete.T-libs-api[DEPRECATED; DO NOT USE]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@lopopolo@rustbot@rust-highfive@thomcc@yaahc@rfcbot@est31@dtolnay@bors@apiraino