diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-11-30 22:34:24 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-12-02 15:42:30 +0300 |
| commit | 2d4b633be36a59667f8648d987169f59f8314b1c (patch) | |
| tree | 3268a6bf510ec3ba5397a0102813cba3abd4bb54 /src/libsyntax_pos | |
| parent | c658d7340149274bb30a56fb3e7de799c266f4bc (diff) | |
| download | rust-2d4b633be36a59667f8648d987169f59f8314b1c.tar.gz rust-2d4b633be36a59667f8648d987169f59f8314b1c.zip | |
Delay gensym creation for "underscore items" until name resolution
Prohibit `static _` Fis unused import warnings for `use foo as _` Add more tests for `use foo as _`
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 741877bb4c8..2721ab70e22 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -80,6 +80,10 @@ impl Ident { Ident::new(self.name.gensymed(), self.span) } + pub fn gensym_if_underscore(self) -> Ident { + if self.name == keywords::Underscore.name() { self.gensym() } else { self } + } + pub fn as_str(self) -> LocalInternedString { self.name.as_str() } @@ -465,7 +469,7 @@ impl Ident { // We see this identifier in a normal identifier position, like variable name or a type. // How was it written originally? Did it use the raw form? Let's try to guess. pub fn is_raw_guess(self) -> bool { - self.name != keywords::Invalid.name() && + self.name != keywords::Invalid.name() && self.name != keywords::Underscore.name() && self.is_reserved() && !self.is_path_segment_keyword() } } |
