diff options
| author | bors <bors@rust-lang.org> | 2015-09-26 14:48:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-09-26 14:48:56 +0000 |
| commit | 2e88c36ebcec101c7de6313c4d45ffe66123fd3a (patch) | |
| tree | 918c785754a57678d6c9c63e97171273fa2a56ae /src/libsyntax/feature_gate.rs | |
| parent | 9169e6c53c53999d0ca176067a36c57aef84757b (diff) | |
| parent | f284cbc7af06a941de0cdd06291dc78d37268b9f (diff) | |
| download | rust-2e88c36ebcec101c7de6313c4d45ffe66123fd3a.tar.gz rust-2e88c36ebcec101c7de6313c4d45ffe66123fd3a.zip | |
Auto merge of #28642 - petrochenkov:name3, r=nrc
This PR removes random remaining `Ident`s outside of libsyntax and performs general cleanup In particular, interfaces of `Name` and `Ident` are tidied up, `Name`s and `Ident`s being small `Copy` aggregates are always passed to functions by value, and `Ident`s are never used as keys in maps, because `Ident` comparisons are tricky. Although this PR closes https://github.com/rust-lang/rust/issues/6993 there's still work related to it: - `Name` can be made `NonZero` to compress numerous `Option<Name>`s and `Option<Ident>`s but it requires const unsafe functions. - Implementation of `PartialEq` on `Ident` should be eliminated and replaced with explicit hygienic, non-hygienic or member-wise comparisons. - Finally, large parts of AST can potentially be converted to `Name`s in the same way as HIR to clearly separate identifiers used in hygienic and non-hygienic contexts. r? @nrc
Diffstat (limited to 'src/libsyntax/feature_gate.rs')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 6643dad6a68..18c6d74d62e 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -35,7 +35,7 @@ use codemap::{CodeMap, Span}; use diagnostic::SpanHandler; use visit; use visit::{FnKind, Visitor}; -use parse::token::{self, InternedString}; +use parse::token::InternedString; use std::ascii::AsciiExt; use std::cmp; @@ -673,7 +673,7 @@ struct MacroVisitor<'a> { impl<'a, 'v> Visitor<'v> for MacroVisitor<'a> { fn visit_mac(&mut self, mac: &ast::Mac) { let path = &mac.node.path; - let id = path.segments.last().unwrap().identifier; + let name = path.segments.last().unwrap().identifier.name.as_str(); // Issue 22234: If you add a new case here, make sure to also // add code to catch the macro during or after expansion. @@ -683,19 +683,19 @@ impl<'a, 'v> Visitor<'v> for MacroVisitor<'a> { // catch uses of these macros within conditionally-compiled // code, e.g. `#[cfg]`-guarded functions. - if id == token::str_to_ident("asm") { + if name == "asm" { self.context.gate_feature("asm", path.span, EXPLAIN_ASM); } - else if id == token::str_to_ident("log_syntax") { + else if name == "log_syntax" { self.context.gate_feature("log_syntax", path.span, EXPLAIN_LOG_SYNTAX); } - else if id == token::str_to_ident("trace_macros") { + else if name == "trace_macros" { self.context.gate_feature("trace_macros", path.span, EXPLAIN_TRACE_MACROS); } - else if id == token::str_to_ident("concat_idents") { + else if name == "concat_idents" { self.context.gate_feature("concat_idents", path.span, EXPLAIN_CONCAT_IDENTS); } } |
