Skip to content

Commit acad9f3

Browse files
committed
commenting out special Eq implementation for now
See the comments for details on why I'm leaving this code in, though commented out.
1 parent 77c96d7 commit acad9f3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/libsyntax/ast.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,25 @@ use extra::serialize::{Encodable, Decodable, Encoder, Decoder};
2424
// table) and a SyntaxContext to track renaming and
2525
// macro expansion per Flatt et al., "Macros
2626
// That Work Together"
27-
#[deriving(Clone, IterBytes, ToStr)]
27+
#[deriving(Clone, Eq, IterBytes, ToStr)]
2828
pub struct Ident { name: Name, ctxt: SyntaxContext }
2929

3030
impl Ident {
3131
/// Construct an identifier with the given name and an empty context:
3232
pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}}
3333
}
3434

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 {
3646
fn eq(&self, other: &Ident) -> bool {
3747
if (self.ctxt == other.ctxt) {
3848
self.name == other.name
@@ -44,6 +54,7 @@ impl Eq for Ident {
4454
! self.eq(other)
4555
}
4656
}
57+
*/
4758

4859
/// A SyntaxContext represents a chain of macro-expandings
4960
/// and renamings. Each macro expansion corresponds to

0 commit comments

Comments
 (0)