Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]` #67887
Conversation
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Jan 5, 2020
|
Awaiting bors try build completion |
This comment has been minimized.
This comment has been minimized.
`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`
The annotated functions now produce panic messages pointing to the location where they were called, rather than `core`'s internals.
Co-Authored-By: lzutao <taolzu@gmail.com>
This comment has been minimized.
This comment has been minimized.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`
The annotated functions now produce panic messages pointing to the location where they were called, rather than `core`'s internals.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Jan 5, 2020
|
Queued cbd3d1c with parent 093241d, future comparison URL. |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Jan 5, 2020
|
Finished benchmarking try commit cbd3d1c, comparison URL. |
This comment has been minimized.
This comment has been minimized.
|
I don't see any meaningful changes in the benchmark results, am I missing anything? If not, that's very exciting and a little surprising! |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ yeah, the perf results appear to be within typical variance. Wouldn’t say the results are surprising at all, because we were already generating the location just a different one before the attribute. |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
There was concern on the initial RFC about the impact of not being able to unify multiple unwraps' panicking branches because their arguments would be obviously different. Doesn't seem to have shown up in the compiler at least! |
This comment has been minimized.
This comment has been minimized.
|
Oh right, that would definitely affect code size and locality slightly. |
This comment has been minimized.
This comment has been minimized.
|
Will this PR have effect on 1.42.0 stable? |
This comment has been minimized.
This comment has been minimized.
|
If it lands in time, which I think it will, we have 2-3 weeks before the next beta cut per https://forge.rust-lang.org/#current-release-versions. |
`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`
The annotated functions now produce panic messages pointing to the location where they were called, rather than `core`'s internals.
This comment has been minimized.
This comment has been minimized.
|
@anp: It looks like unwinding isn't supported on wasm32-unknown-unknown: rust/src/libpanic_unwind/dummy.rs Lines 1 to 3 in a916ac2 I suspect you'll just want to disable this test, like this one: |
This comment has been minimized.
This comment has been minimized.
|
Thanks! Pushed a commit ignoring this test on the wasm32 target. r+ ? |
This comment has been minimized.
This comment has been minimized.
|
@bors r=nagisa |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
I'd be interested in seeing what the impact of this is within the I don't think that this information should be a blocker to merging this (it's such a good QoL improvement!) but this does add to the "formatting/panicing is too expensive in embedded" list. EDIT: error messages now have unique strings, not non-unique |
`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`
The annotated functions now produce panic messages pointing to the location where they were called, rather than `core`'s internals.
Rollup of 10 pull requests Successful merges: - #67774 (Try statx for all linux-gnu target.) - #67781 (Move `is_min_const_fn` query to librustc_mir.) - #67798 (Remove wrong advice about spin locks from `spin_loop_hint` docs) - #67849 (Add a check for swapped words when we can't find an identifier) - #67875 (Distinguish between private items and hidden items in rustdoc) - #67887 (`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`) - #67955 (rustdoc: Remove more `#[doc(cfg(..))]` duplicates) - #67977 (Updates for VxWorks) - #67985 (Remove insignificant notes from CStr documentation) - #68003 (ci: fix wrong shared.sh import for publish_toolstate) Failed merges: - #67820 (Parse the syntax described in RFC 2632) - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup) r? @ghost
Rollup of 10 pull requests Successful merges: - #67774 (Try statx for all linux-gnu target.) - #67781 (Move `is_min_const_fn` query to librustc_mir.) - #67798 (Remove wrong advice about spin locks from `spin_loop_hint` docs) - #67849 (Add a check for swapped words when we can't find an identifier) - #67875 (Distinguish between private items and hidden items in rustdoc) - #67887 (`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`) - #67955 (rustdoc: Remove more `#[doc(cfg(..))]` duplicates) - #67977 (Updates for VxWorks) - #67985 (Remove insignificant notes from CStr documentation) - #68003 (ci: fix wrong shared.sh import for publish_toolstate) Failed merges: - #67820 (Parse the syntax described in RFC 2632) - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup) r? @ghost
This comment has been minimized.
This comment has been minimized.
|
@anp: Thanks for all of your work implementing this feature! |
This comment has been minimized.
This comment has been minimized.
|
And there was much rejoicing! @jamesmunns That's a reasonable point. I wonder if we could add an optimization option that people could enable in |
This comment has been minimized.
This comment has been minimized.
|
Something like this was included in the RFC: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md#location-detail-control. To be honest, I'm not sure how to implement it without having multiple flavors of |
This comment has been minimized.
This comment has been minimized.
|
(also may be good to continue this on the tracking issue) |
This comment has been minimized.
This comment has been minimized.
|
@joshtriplett I think for heavily resource constrained environments you really want a way to completely disable all panic formatting. Having more fine-grained control is nice-to-have, but doesn't seem particularly useful to me. |
This comment has been minimized.
This comment has been minimized.
|
Can we tag this to relnotes tag for it to be included in 1.42 CHANGELOG? |
This comment has been minimized.
This comment has been minimized.
|
Done. |
This comment has been minimized.
This comment has been minimized.
|
@RalfJung For future reference, please also always add a team and a milestone when adding relnotes. |
This comment has been minimized.
This comment has been minimized.
|
@Pauan Fair. |
1546: Update Rust nightly version r=ppannuto a=bradjc ### Pull Request Overview It has been about 3 months, so a good time to stay current. Also motivated by rust-lang/rust#67887 which should make debugging easier. Changes - New warning about `()` not needed. - Update to update script. ### Testing Strategy travis ### TODO or Help Wanted n/a ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make formatall`. Co-authored-by: Brad Campbell <bradjc5@gmail.com>
anp commentedJan 5, 2020
The annotated functions now produce panic messages pointing to the location where they were called, rather than
core's internals.