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 upConsider producing more friendly output with runtime drop flag checking #35101
Comments
This comment has been minimized.
This comment has been minimized.
|
This is mostly solved by not having filling drop (cough… MIR… cough). In case anybody still wants to fix this issue, the relevant TRAP likely comes from code generated by rust/src/librustc_trans/glue.rs Line 314 in d1df3fe |
This comment has been minimized.
This comment has been minimized.
|
Printing a message, though, would essentially mean extra code in every single drop glue. I wonder if that’s really the tradeoff anybody would be interested in making. |
steveklabnik
added
the
A-diagnostics
label
Jul 28, 2016
This comment has been minimized.
This comment has been minimized.
|
@nagisa could this be debug-build-only? I would imagine having the function that emits the message just write a string to stderr before raising the signal itself. On the other hand the current implementation helps debugging because it traps into the debugger. |
This comment has been minimized.
This comment has been minimized.
|
This is not a purely zeroing drop issue: if you are using an enum instead of a struct, mangling the discriminant will cause an out-of-range switch and random UB (often a |
This comment has been minimized.
This comment has been minimized.
MagaTailor
commented
Jul 29, 2016
|
Indeed, I'm getting a |
This comment has been minimized.
This comment has been minimized.
|
Would Valgrind detect this? If not, I suspect that Rust needs ASan and UBSan support. |
This comment has been minimized.
This comment has been minimized.
|
filling drop is now a thing of the past. You can't corrupt drop flags without hardcore stack corruption now. |
eefriedman commentedJul 28, 2016
•
edited by eddyb
This produces absolutely zero output in the playground because it generates a SIGTRAP and kills the program. Of course, it's hard to do much at this point because the program is in an unknown, probably-corrupt state, but we could at least print a message to stderr noting what happened.
Originally reported at https://internals.rust-lang.org/t/im-moving-away-heres-my-two-cents/3767 .