Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uptransparent attribute #1744
Comments
nrc
added
the
T-lang
label
Sep 8, 2016
This comment has been minimized.
This comment has been minimized.
|
I'm curious what impact this would have on debugging. I can see how this would be useful, but I can also imagine wanting to know what the whole stack trace is. Is that what you mean by
|
This comment has been minimized.
This comment has been minimized.
|
To avoid confusion, I'd suggest that we shouldn't hide such functions by default; we should just de-emphasize them, and emphasize the top non-transparent item in the stack. Otherwise, when people learning Rust see a panic, the stack traces might have a lot less didactic value for them. |
This comment has been minimized.
This comment has been minimized.
|
@joshtriplett This is a good point... Another idea would be to de-emphasize code in external crates by default. This idea is orthogonal to the original proposal... |
Stebalien
referenced this issue
Feb 6, 2017
Closed
Isn't the backtrace part of the stack irrelevant to the printed backtrace? #39573
This comment has been minimized.
This comment has been minimized.
|
One of the tools I use at work displays Javascript call stacks with the "uninteresting parts" collapsed into lines like "10 frames omitted from [module name]". Is that the sort of thing you have in mind when you say "deemphasizing"? |
This comment has been minimized.
This comment has been minimized.
|
This is what I imagined... Take this stack trace:
We might want to "de-emphasize" the stack trace entries in
|
This comment has been minimized.
This comment has been minimized.
|
I've implemented something like this once for cleanup of exception stack traces (in a custom error reporting solution for PHP), and I've found that "transparent" is not quite what I wanted. The problem is that errors fall into two separate categories:
So in case (1) you want the function to be transparent (so the user sees place where they call it and args they pass in), but in (2) you specifically don't want it (as it'd hide the actual error and incorrectly blame the user). |
This comment has been minimized.
This comment has been minimized.
|
How would line numbers in the reported error message work? Right now, |
This comment has been minimized.
This comment has been minimized.
|
If the panic is in a library you didn't write, the line numbers will be
meaningless anyway. Instead, you would look at the error message and try to
find the offensive code in your own work, right ?
…On Jul 12, 2017 8:24 AM, "Jake Goulding" ***@***.***> wrote:
How would line numbers in the reported error message work? Right now,
panic! uses the line!() and file() macros to grab these. If the panic
message says one file (the real location) and the stack trace doesn't
include that, it would be very confusing.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1744 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIazwJRQEYCmhvI9PaotM7TK2EV-FFm4ks5sNLrfgaJpZM4J4V0x>
.
|
kennytm
referenced this issue
Aug 2, 2017
Merged
RFC: Implicit caller location (third try to the unwrap/expect line info problem) #2091
This comment has been minimized.
This comment has been minimized.
|
Closing in favor of rust-lang/rust#47809. |
nrc commentedSep 8, 2016
#[transparent]on functions and types, basically means never presented to the user (modulo a flag to turn this off). E.g., would be on theunwrapimplementation methods so that that a stack trace doesn't display the noise of the panic and unwrap implementation as the top of the stack trace.Use on types is to avoid telling the user about things like
UnsafeCellwhich are usually just noise in error messages for users, they should be transparent wrappers.Used by std libs in Swift.
cc @Gankro