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

Tracking issue for RFC 2504, "Fix the Error trait" #53487

Open
5 of 9 tasks
Centril opened this issue Aug 19, 2018 · 128 comments
Open
5 of 9 tasks

Tracking issue for RFC 2504, "Fix the Error trait" #53487

Centril opened this issue Aug 19, 2018 · 128 comments
Assignees
Labels
A-error-handling Area: Error handling B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC Libs-Tracked Libs issues that are tracked on the team's project board. PG-error-handling Project group: Error handling (https://github.com/rust-lang/project-error-handling) T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Centril
Copy link
Contributor

Centril commented Aug 19, 2018

This is a tracking issue for the RFC "Fix the Error trait" (rust-lang/rfcs#2504).

Steps:

Unresolved questions:

  • The choice to implement nullability internal to backtrace may prove to be a mistake: during the period when backtrace APIs are only available on nightly, we will gain more experience and possible change backtrace's constructors to return an Option<Backtrace> instead.

Current status:

#53487 (comment)

@Centril Centril added B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC labels Aug 19, 2018
@L-as
Copy link

L-as commented Sep 26, 2018

What parts haven't been implemented?

@withoutboats
Copy link
Contributor

I've updated the tracking issue to reflect that, but right now the source method has been implemented, but the backtrace related APIs have not been implemented

@L-as
Copy link

L-as commented Sep 26, 2018

Perhaps I could try implementing this, is it OK to just use the backtrace crate?

@alexcrichton
Copy link
Member

Implementing backtraces in the standard library will probably not use the backtrace crate but rather the backtrace API that's already in the standard library for RUST_BACKTRACE. We can perhaps unify these implementations in the long run, but for now it's infeasible to do so.

The current platform-independent backtrace code lives here, mostly in the _print function. Implementing the API defined in the RFC will likely involve reusing these interfaces to define a struct which carries along the relevant information.

@laaas if you'd like to implement this please feel free! Also feel free to reach out with any questions.

@L-as
Copy link

L-as commented Oct 2, 2018

Thanks! Will definitely try implementing it.

@frewsxcv
Copy link
Member

Thanks! Will definitely try implementing it.

@laaas Did you make any progress? Need any help?

@L-as
Copy link

L-as commented Nov 22, 2018

@frewsxcv Actually not!

I haven't really looked at it much, so if you want to work on it, go ahead!

@aturon
Copy link
Member

aturon commented Feb 21, 2019

cc @rust-lang/libs @withoutboats @mitsuhiko would be really nice to make progress here

@mitsuhiko
Copy link
Contributor

I would move than love to spearhead this.

@aturon
Copy link
Member

aturon commented Feb 22, 2019

@mitsuhiko go go go! if you need any help around the backtrace stuff @alexcrichton can get you set up.

@mitsuhiko
Copy link
Contributor

Just an update from my side about why there is no progress: I tried a few things to expose a sensible backtrace object and with the current system that is in place it's all too likely that the outcome is just a bad workaround. I'm currently leaning towards waiting for the backtrace support in rust to be based on backtrace-rs.

@idubrov
Copy link

idubrov commented May 30, 2019

Is migration to backtrace-rs is something that is already happening? Any issue to track progress?

@sfackler
Copy link
Member

That landed ~4 days ago: #60852

@est31
Copy link
Member

est31 commented Jun 13, 2019

Does this RFC also include backtrace printing for ? in tests? Currently, when you switch to ? from unwrap, the backtraces are very poor. The only useful info those backtraces convey (amidst a mountain of spam) is the test that failed along with its line, nothing more.

@Nemo157
Copy link
Member

Nemo157 commented Sep 14, 2021

Has there been any discussion of supporting excluding the "runtime frames" similar to RUST_BACKTRACE=1 vs RUST_BACKTRACE=full (whether by APIs that allow distinguishing them manually, or by integrating it into the default Display format)?

fabianlindfors added a commit to fabianlindfors/reshape that referenced this issue Jan 3, 2022
Improved backtrace support for errors in Rust is currently in progress:
rust-lang/rust#53487. Adding the feature lets
anyhow add backtraces already which greatly improves readability of
errors in tests.
dtolnay added a commit to dtolnay/anyhow that referenced this issue Jul 24, 2022
Starting in the most recent release of miri, the build.rs probe fails to
build even on nightly toolchain with one of the following errors:

    error: miri can only run programs that have a main function

    error: the current sysroot was built without `-Zalways-encode-mir`,
    or libcore seems missing. Use `cargo miri setup` to prepare a
    sysroot that is suitable for Miri.

which causes anyhow::Error's backtrace() inherent method to not exist.

    error[E0658]: use of unstable library feature 'backtrace'
      --> tests/test_backtrace.rs:20:19
       |
    20 |     let _ = error.backtrace();
       |                   ^^^^^^^^^
       |
       = note: see issue 53487 <rust-lang/rust#53487> for more information
       = help: add `#![feature(backtrace)]` to the crate attributes to enable
@cole-miller
Copy link

The std::backtrace part of this RFC is stabilizing now: #99573

@Ragarnoy
Copy link

has this been given up on?

@bjorn3
Copy link
Member

bjorn3 commented Feb 26, 2023

Moving the Error trait to libcore has been done in #99917. It isn't stable in libcore though (#103765). std::backtrace stabilized in 1.65. Error::source stabilized in 1.30. As for std::backtrace::Backtrace's formatting representation differing from panics, see #71706. Anything else you are missing?

@remram44
Copy link
Contributor

It seems #77384 has been closed as "no longer necessary" but is still one of the tasks in the issue description above. There are other tasks such as "adjust documentation" which may be done already.

I think this issue needs an update, and maybe can be closed.

@bjorn3
Copy link
Member

bjorn3 commented Feb 26, 2023

#77384 has been subsumed by #99917.

I think this issue needs an update, and maybe can be closed.

I agree.

@orium
Copy link
Member

orium commented May 3, 2023

@yaahc I think this issue needs to be updated. Like the comments above say, this might be done.

@dralley
Copy link
Contributor

dralley commented May 13, 2023

An overall update from the Error Handling Working Group would be nice.

@nyabinary
Copy link

Yeah it would

@yaahc
Copy link
Member

yaahc commented Jul 25, 2023

Hey, I'll do my best to give an update. First, the error handling project group has been inactive for quite a while. I think @rust-lang/libs probably needs to re-evaluate how they track subteams/subgroups and that as part of that, the error handling project group should either be officially shut down or rebooted.

As for progress on the error trait, @waynr has started doing fantastic work finalizing the generic member access API. Reviewing the state of this tracking issue and #103765, I think this tracking issue may be superseded. There is the bit about formatting consistency that we may want to keep tracking in some issue and possibly some documentation related work but beyond that this issue seems essentially done.

The next steps as I understand it are to polish and stabilize the generic member access API and eventually error in core. Disclaimer though, I've not been active in this area for a while now so I may be missing important details, if you see anything that I missed please point it out.

@nyabinary
Copy link

How would we go around rebooting the error-handling project/group?

2opremio added a commit to 2opremio/soroban-cli that referenced this issue Aug 20, 2023
* panicking will show the line number where the problem happens whereas
  otherwise we will get an error with no context at all

* We anyhow capture the panics before returning to Go and thus, the
  process won't stop.

Further context on why it's OK to use unwrap in these cases
https://blog.burntsushi.net/unwrap/

Ideally we would have simply have a way to attach a
backtrace/line-number to these errors instead, but I don't think that
will be possible until rust-lang/rust#53487
is ready.
2opremio added a commit to 2opremio/soroban-cli that referenced this issue Aug 21, 2023
* panicking will show the line number where the problem happens whereas
  otherwise we will get an error with no context at all

* We anyhow capture the panics before returning to Go and thus, the
  process won't stop.

Further context on why it's OK to use unwrap in these cases
https://blog.burntsushi.net/unwrap/

Ideally we would have simply have a way to attach a
backtrace/line-number to these errors instead, but I don't think that
will be possible until rust-lang/rust#53487
is ready.
2opremio added a commit to 2opremio/soroban-cli that referenced this issue Aug 21, 2023
* panicking will show the line number where the problem happens whereas
  otherwise we will get an error with no context at all

* We anyhow capture the panics before returning to Go and thus, the
  process won't stop.

Further context on why it's OK to use unwrap in these cases
https://blog.burntsushi.net/unwrap/

Ideally we would have simply have a way to attach a
backtrace/line-number to these errors instead, but I don't think that
will be possible until rust-lang/rust#53487
is ready.
2opremio added a commit to stellar/stellar-cli that referenced this issue Aug 21, 2023
* panicking will show the line number where the problem happens whereas
  otherwise we will get an error with no context at all

* We anyhow capture the panics before returning to Go and thus, the
  process won't stop.

Further context on why it's OK to use unwrap in these cases
https://blog.burntsushi.net/unwrap/

Ideally we would have simply have a way to attach a
backtrace/line-number to these errors instead, but I don't think that
will be possible until rust-lang/rust#53487
is ready.
@dralley
Copy link
Contributor

dralley commented Aug 24, 2023

Thanks for the update @yaahc , much appreciated.

I think @rust-lang/libs probably needs to re-evaluate how they track subteams/subgroups and that as part of that, the error handling project group should either be officially shut down or rebooted.

Has this been formally brought up to the libs team? I think it would be interesting to have some public visibility (call for volunteers etc.) for efforts that are stalling out a bit (assuming lack of activity is the problem of course).

@ChrisDenton ChrisDenton added the I-libs-nominated Nominated for discussion during a libs team meeting. label Aug 24, 2023
@ChrisDenton
Copy link
Member

I've nominated this for discussion in a t-libs meeting for the reasons quoted above.

@waynr
Copy link
Contributor

waynr commented Aug 24, 2023

Ah shoot, I forgot to respond to this issue when @yaahc pinged me last month.

Yeah, I've been slowly making progress on the Error generic member access. One of my problems is that I am not very active in the Rust project to begin with and haven't been doing a very good job of attending to it consistently.

Has this been formally brought up to the libs team?

What does it mean to formally bring up stalled issues with the libs team? Ping in Zulip? Ping on tracking issues? Get a spot on their weekly meeting calendar?

I think it would be interesting to have some public visibility (call for volunteers etc.) for efforts that are stalling out a bit (assuming lack of activity is the problem of course).

While I have some consistency/time management problems and I am not exactly proficient with Rust at the level of others working on libs, I would like to get better in these areas and feel motivated to help out. So as far as volunteers go, I still want to do this! But eventually I won't have as much free time as I have had the past few months (currently unemployed, that could change as soon as the next few weeks)

To avoid that scenario, I would definitely appreciate advice anyone has about how to procede (I realize that even though I may have ample free time to get things done, other people have more and different competing priorities so i may end up waiting longer than i would like for PR review). For example:

If there are higher priority items (like stabilizing error_in_core) I'd be happy to take a look at those in addition to error_generic_member_access.

@ChrisDenton is the libs team meeting open for anyone to attend?

@ChrisDenton
Copy link
Member

Hm, you may want to create a new topic on zulip if you need some advice on how to move forward.

But yes, anyone can attend meetings. This is also organised on zulip.

@ChrisDenton ChrisDenton removed the I-libs-nominated Nominated for discussion during a libs team meeting. label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-error-handling Area: Error handling B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC Libs-Tracked Libs issues that are tracked on the team's project board. PG-error-handling Project group: Error handling (https://github.com/rust-lang/project-error-handling) T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests