@@ -24,15 +24,25 @@ use extra::serialize::{Encodable, Decodable, Encoder, Decoder};
24
24
// table) and a SyntaxContext to track renaming and
25
25
// macro expansion per Flatt et al., "Macros
26
26
// That Work Together"
27
- #[ deriving( Clone , IterBytes , ToStr ) ]
27
+ #[ deriving( Clone , Eq , IterBytes , ToStr ) ]
28
28
pub struct Ident { name : Name , ctxt : SyntaxContext }
29
29
30
30
impl Ident {
31
31
/// Construct an identifier with the given name and an empty context:
32
32
pub fn new ( name : Name ) -> Ident { Ident { name : name, ctxt : EMPTY_CTXT } }
33
33
}
34
34
35
- impl Eq for Ident {
35
+ // defining eq in this way is a way of guaranteeing that later stages of the
36
+ // compiler don't compare identifiers unhygienically. Unfortunately, some tests
37
+ // (specifically debuginfo in no-opt) want to do these comparisons, and that
38
+ // seems fine. If only I could find a nice way to statically ensure that
39
+ // the compiler "proper" never compares identifiers.... I'm leaving this
40
+ // code here (commented out) for potential use in debugging. Specifically, if
41
+ // there's a bug where "identifiers aren't matching", it may be because
42
+ // they should be compared using mtwt_resolve. In such a case, re-enabling this
43
+ // code (and disabling deriving(Eq) for Idents) could help to isolate the
44
+ // problem
45
+ /* impl Eq for Ident {
36
46
fn eq(&self, other: &Ident) -> bool {
37
47
if (self.ctxt == other.ctxt) {
38
48
self.name == other.name
@@ -44,6 +54,7 @@ impl Eq for Ident {
44
54
! self.eq(other)
45
55
}
46
56
}
57
+ */
47
58
48
59
/// A SyntaxContext represents a chain of macro-expandings
49
60
/// and renamings. Each macro expansion corresponds to
0 commit comments