]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #48934 - Phlosioneer:42453-debug-hygene, r=petrochenkov
authorkennytm <kennytm@gmail.com>
Mon, 12 Mar 2018 16:54:33 +0000 (00:54 +0800)
committerGitHub <noreply@github.com>
Mon, 12 Mar 2018 16:54:33 +0000 (00:54 +0800)
Fix hygene issue when deriving Debug

The code for several of the core traits doesn't use hygenic macros.
This isn't a problem, except for the Debug trait, which is the only
one that uses a variable, named "builder".

Variables can't share names with unit structs, so attempting to
[derive(Debug)] on any type while a unit struct with the name
"builder" was in scope would result in an error.

This commit just changes the name of the variable to
"__debug_trait_builder", because I couldn't figure out how to get a
list of all unit structs in-scope from within the derive expansion
function. If someone wants to have a unit struct with
the exact name "__debug_trait_builder", they'll just have to do it
without a [derive(Debug)].

I also checked the implementations of the other built-in derives to
ensure they didn't declare any variables.


Trivial merge