-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
std: Add a backtrace
module
#64154
std: Add a backtrace
module
#64154
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
r? @sfackler |
Logistically I want #64152 to land before this, and then I want to leverage that to ensure that the standard library only has one piece of code for printing backtraces instead of both here and for panics. (in case anyone's wondering why it's duplicated here) |
Thanks for doing this @alexcrichton! |
This is nice functionality, but because it is added directly to Can we consider doing this differently so that these PR's are still compatible? It would really help rust portability if I think one good way might be to make a There are a few other ways I thought about, you probably can think of more than I can. |
Adding an associated type to a trait is not backwards compatible.
|
@cbeck88 There are solutions to someday making the Error trait available to no_std applications. Two possible solutions to the problem of backtraces, which don't require changing this API at all, are discussed toward the end of the closed PR. |
2290c8f
to
abe20c5
Compare
I've updated with the various comments here. @cbeck88 I don't have anything to add over what @withoutboats already mentioned. |
@bors r+ |
📌 Commit abe20c5a2fc489c1f2b5d41dbe43421c87e3078e has been approved by |
@withoutboats @alexcrichton thanks, makes sense |
☔ The latest upstream changes (presumably #64281) made this pull request unmergeable. Please resolve the merge conflicts. |
This commit adds a `backtrace` module to the standard library, as designed in [RFC 2504]. The `Backtrace` type is intentionally very conservative, effectively only allowing capturing it and printing it. Additionally this commit also adds a `backtrace` method to the `Error` trait which defaults to returning `None`, as specified in [RFC 2504]. More information about the design here can be found in [RFC 2504] and in the [tracking issue]. Implementation-wise this is all based on the `backtrace` crate and very closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise it's pretty standard in how it handles everything internally. [RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md [tracking issue]: rust-lang#53487 cc rust-lang#53487
@bors: r=sfackler |
abe20c5
to
34662c6
Compare
📌 Commit abe20c5a2fc489c1f2b5d41dbe43421c87e3078e has been approved by |
@bors: r=sfackler |
📌 Commit 34662c6 has been approved by |
⌛ Testing commit 34662c6 with merge bba531caa5a6e8291c3f37dd3c44700f436e6cd5... |
💥 Test timed out |
@bors: retry Looks like a normal timeout, but let's see if it's affected by this.. |
std: Add a `backtrace` module This commit adds a `backtrace` module to the standard library, as designed in [RFC 2504]. The `Backtrace` type is intentionally very conservative, effectively only allowing capturing it and printing it. Additionally this commit also adds a `backtrace` method to the `Error` trait which defaults to returning `None`, as specified in [RFC 2504]. More information about the design here can be found in [RFC 2504] and in the [tracking issue]. Implementation-wise this is all based on the `backtrace` crate and very closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise it's pretty standard in how it handles everything internally. [RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md [tracking issue]: #53487 cc #53487
☀️ Test successful - checks-azure |
Tested on commit rust-lang/rust@fe6d05a. Direct link to PR: <rust-lang/rust#64154> 💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
This PR broke xargo, or at least the Xargo configuration used by Miri:
@alexcrichton is it possible that libstd no longer compiles with the default features? EDIT: Ah, this was already reported at #64410. |
This commit adds a
backtrace
module to the standard library, asdesigned in RFC 2504. The
Backtrace
type is intentionally veryconservative, effectively only allowing capturing it and printing it.
Additionally this commit also adds a
backtrace
method to theError
trait which defaults to returning
None
, as specified in RFC 2504.More information about the design here can be found in RFC 2504 and in
the tracking issue.
Implementation-wise this is all based on the
backtrace
crate and veryclosely mirrors the
backtrace::Backtrace
type on crates.io. Otherwiseit's pretty standard in how it handles everything internally.
cc #53487