]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #50406 - ExpHP:concat-nonzero-idents, r=dtolnay
authorkennytm <kennytm@gmail.com>
Thu, 3 May 2018 18:16:39 +0000 (02:16 +0800)
committerkennytm <kennytm@gmail.com>
Thu, 3 May 2018 18:16:39 +0000 (02:16 +0800)
Forbid constructing empty identifiers from concat_idents

The empty identifier is a [reserved identifier](https://github.com/rust-lang/rust/blob/8a37c75a3a661385cc607d934c70e86a9eaf5fd7/src/libsyntax_pos/symbol.rs#L300-L305) in rust, apparently used for black magicks like representing the crate root or somesuch... and therefore, being able to construct it is Ungood.  Presumably.

...even if the macro that lets you construct it is so useless that you can't actually do any damage with it. (and believe me, I tried)

Fixes #50403.

**Note:** I noticed that when you try to do something similar with `proc_macro::Term`, the compiler actually catches it and flags the identifier as reserved.  Perhaps a better solution would be to somehow have that same check applied here.


Trivial merge