]> git.lizzy.rs Git - rust.git/commitdiff
Ensure the symbols are pure strings
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Tue, 9 Apr 2019 07:18:49 +0000 (09:18 +0200)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Mon, 15 Apr 2019 05:23:02 +0000 (07:23 +0200)
src/libsyntax/ast.rs

index c015e9b06acdb81bc7ef41f1121197b2e7468bc3..0668730b3ef01a8f1c2906e3b147914b43c40873 100644 (file)
@@ -70,7 +70,13 @@ pub struct Path {
 
 impl PartialEq<Symbol> for Path {
     fn eq(&self, symbol: &Symbol) -> bool {
-        self.segments.len() == 1 && self.segments[0].ident.name.interned() == *symbol
+        self.segments.len() == 1 && {
+            let name = self.segments[0].ident.name;
+            // Make sure these symbols are pure strings
+            debug_assert!(!symbol.is_gensymed());
+            debug_assert!(!name.is_gensymed());
+            name == *symbol
+        }
     }
 }