{"push_id":1111989634,"size":2,"distinct_size":2,"ref":"refs/heads/rollup","head":"04a04cb4ee5798157fac3a6c7341f61bb9f132d0","before":"68b525837802d77fc3b13a11233b6969b3b3681e","commits":[{"sha":"04baf2593e782dafc979cfbfb6c9994e3a0d1e78","author":{"email":"49b5fe40b0485ced1178e0f8202557f5677f8204@hotmail.com","name":"Steven Burns"},"message":"Generic encoded enums no longer crash on reference/pointer types","distinct":true,"url":"https://api.github.com/repos/eddyb/rust/commits/04baf2593e782dafc979cfbfb6c9994e3a0d1e78"},{"sha":"04a04cb4ee5798157fac3a6c7341f61bb9f132d0","author":{"email":"7b617481dc67255f8ac089bf33cb7fadcdc5dda1@gmail.com","name":"Eduard-Mihai Burtescu"},"message":"Rollup merge of #33612 - royalstream:royalstream-enc-enum-ptr, r=michaelwoerister\n\ngdb Pretty Print: generic encoded was failing on reference/pointer types\n\nIf you debug this program using **gdb**\n```rust\nfn main() {\n    let x = 10;\n    let y = Some(&x);\n    // additional code\n}\n```\nAnd you try to print **y**'s value from the debugger, you get the following:\n```\n(gdb) print y\nPython Exception <class 'gdb.error'> Cannot convert value to int.:\n$1 = {RUST$ENCODED$ENUM$0$None = Some = {0x7fff5fbff97c}}\n```\nWhat happens is that inside **debugger_pretty_printers_common.py** the method `is_null_variant` doesn't have any special handling for pointer values so it ends up calling `.as_integer()` on `discriminant_val` (which holds a pointer) and fails.\n\nConsidering it needs to handle pointers and return _true_ when the pointer is _null_, I modified the `.as_integer()` method in **gdb_rust_pretty_printing.py** to take pointers into consideration.\n\nAfter this modification **gdb** prints **y** like this:\n```\n(gdb) print y\n$1 = Some = {0x7fff5fbff97c}\n```\nNow, it would be nice to print something useful (instead of a pointer address) but the pretty printer doesn't currently handle references/pointers so that's a completely different subject.","distinct":true,"url":"https://api.github.com/repos/eddyb/rust/commits/04a04cb4ee5798157fac3a6c7341f61bb9f132d0"}]}