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

Stabilize backtrace #99573

Merged
merged 2 commits into from
Aug 10, 2022
Merged

Stabilize backtrace #99573

merged 2 commits into from
Aug 10, 2022

Conversation

tbodt
Copy link
Contributor

@tbodt tbodt commented Jul 21, 2022

This PR stabilizes the std::backtrace module. As of #99431, the std::Error::backtrace item has been removed, and so the rest of the backtrace feature is set to be stabilized.

Previous discussion can be found in #72981, #3156.

Stabilized API summary:

pub mod std {
    pub mod backtrace {
        pub struct Backtrace { }
        pub enum BacktraceStatus {
            Unsupported,
            Disabled,
            Captured,
        }
        impl fmt::Debug for Backtrace {}
        impl Backtrace {
            pub fn capture() -> Backtrace;
            pub fn force_capture() -> Backtrace;
            pub const fn disabled() -> Backtrace;
            pub fn status(&self) -> BacktraceStatus;
        }
        impl fmt::Display for Backtrace {}
    }
}

@yaahc

@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 @m-ou-se (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 21, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jul 21, 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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 21, 2022
@tbodt
Copy link
Contributor Author

tbodt commented Jul 21, 2022

r? @yaahc

@rust-highfive rust-highfive assigned yaahc and unassigned m-ou-se Jul 21, 2022
@tbodt
Copy link
Contributor Author

tbodt commented Jul 21, 2022

Stabilization report

Implementation history

API summary

Moved to PR description: #99573 (comment)

Experience report

Used in anyhow: https://github.com/dtolnay/anyhow/blob/ffb25df68acb80ddf195f5e3a91eeb0b66e2b014/src/error.rs#L828. If the backtrace feature isn't available, anyhow has an option to use an implementation of the exact same API on top of the backtrace crate: https://github.com/dtolnay/anyhow/blob/ffb25df68acb80ddf195f5e3a91eeb0b66e2b014/src/backtrace.rs#L63.

@yaahc yaahc added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 21, 2022
@yaahc
Copy link
Member

yaahc commented Jul 21, 2022

@rfcbot merge

@rfcbot
Copy link

rfcbot commented Jul 21, 2022

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.

@rfcbot rfcbot 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 21, 2022
@tbodt
Copy link
Contributor Author

tbodt commented Jul 21, 2022

The implementation is made much more difficult by #99212 not being available in the bootstrap compiler. If one simply does a partial stabilization, the result won't compile with the bootstrap compile. So I've had to make the entire stabilization conditional on cfg(not(bootstrap)). Is this reasonable? I think this means that after #99212 makes into bootstrap, there will be another cleanup step where we make it unconditionally stable, then wait for another bootstrap compiler update, then finally remove the cfg_attr(bootstrap, feature(backtrace)).

@tbodt
Copy link
Contributor Author

tbodt commented Jul 21, 2022

This is also blocked by anyhow's deny(warnings). Stabilizing a feature results in a warning in any crate that uses it, recommending that the #[feature()] be removed. But anyhow has #[deny(warnings)], and it apparently blocks CI.

Edit: that's a doctest, not anyhow 🤦

@yaahc
Copy link
Member

yaahc commented Jul 21, 2022

The implementation is made much more difficult by #99212 not being available in the bootstrap compiler. If one simply does a partial stabilization, the result won't compile with the bootstrap compile. So I've had to make the entire stabilization conditional on cfg(not(bootstrap)). Is this reasonable? I think this means that after #99212 makes into bootstrap, there will be another cleanup step where we make it unconditionally stable, then wait for another bootstrap compiler update, then finally remove the cfg_attr(bootstrap, feature(backtrace)).

Everything being under bootstrap cfgs seems reasonable to me. Additionally, I wouldn't stress over the ensuing bootstrap updates that would be required. The process1 for updating the bootstrap cfgs is a separate one that doesn't really depend on the features that temporarily required bootstrap cfgs, so that should be handled by whoever is responsible for the next bootstrap update without you having to be involved any further.

Footnotes

  1. https://forge.rust-lang.org/release/process.html?highlight=bootstrap#master-bootstrap-update-t-2-day-tuesday

@tbodt
Copy link
Contributor Author

tbodt commented Jul 21, 2022

It might not actually be necessary to put it all in bootstrap - I got CI to pass. But that's not the full bors CI...

@tbodt
Copy link
Contributor Author

tbodt commented Jul 21, 2022

@bors try

@bors
Copy link
Contributor

bors commented Jul 21, 2022

@tbodt: 🔑 Insufficient privileges: not in try users

@yaahc
Copy link
Member

yaahc commented Jul 21, 2022

@bors try

@bors
Copy link
Contributor

bors commented Jul 21, 2022

⌛ Trying commit d9f2031279f9d33c61a315343467f0d8ea04dab3 with merge caecccbf2290905c3eb158421367c8817ab08bed...

@bors
Copy link
Contributor

bors commented Jul 22, 2022

☀️ Try build successful - checks-actions
Build commit: caecccbf2290905c3eb158421367c8817ab08bed (caecccbf2290905c3eb158421367c8817ab08bed)

@yaahc
Copy link
Member

yaahc commented Aug 10, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Aug 10, 2022

📌 Commit 2139682 has been approved by yaahc

It is now in the queue for this repository.

@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 10, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 10, 2022
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#99573 (Stabilize backtrace)
 - rust-lang#100069 (Add error if link_ordinal used with unsupported link kind)
 - rust-lang#100086 (Add more `// unit-test`s to MIR opt tests)
 - rust-lang#100332 (Rename integer log* methods to ilog*)
 - rust-lang#100334 (Suggest a missing semicolon before an array)
 - rust-lang#100340 (Iterate generics_def_id_map in reverse order to fix P-critical issue)
 - rust-lang#100345 (docs: remove repetition in `is_numeric` function docs)
 - rust-lang#100352 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e10f924 into rust-lang:master Aug 10, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 10, 2022
@tbodt tbodt deleted the stabilize-backtrace branch August 10, 2022 14:08
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Sep 8, 2022
facebook-github-bot pushed a commit to facebook/SPARTA that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebook/starlark-rust that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebook/sapling that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebookincubator/below that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebookexperimental/rust-shed that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebook/redex that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebookexperimental/reverie that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebookincubator/gazebo_lint that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebook/buck2 that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
facebook-github-bot pushed a commit to facebook/redex that referenced this pull request Nov 10, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
vmagro pushed a commit to facebookincubator/antlir that referenced this pull request Nov 14, 2022
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Test Plan:
```
cd ~/fbcode
buckify_tp2
./common/rust/tools/scripts/check_all.sh fbcode -- --local-only
```

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. 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.

None yet