From 82eacb6d5081d4df173eab0be7caf8513183a17a Mon Sep 17 00:00:00 2001 From: Peter Ammon Date: Sat, 3 May 2025 17:39:03 -0700 Subject: [PATCH] ast: Switch from type to kind in is_same_node --- src/ast.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index cfa9166fc..395661cfc 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -176,8 +176,8 @@ pub fn is_same_node(lhs: &dyn Node, rhs: &dyn Node) -> bool { // 2. If two nodes have the same base pointer and same vtable, they reference // the same object. // 3. If two nodes have the same base pointer but different vtables, they are the same iff - // their types are equal: a Node cannot have a Node of the same type at the same address - // (unless it's a ZST, which does not apply here). + // their kind discriminats are equal: a Node cannot have a Node of the same type at the + // same address (unless it's a ZST, which does not apply here). // // Note this is performance-sensitive. @@ -194,8 +194,8 @@ pub fn is_same_node(lhs: &dyn Node, rhs: &dyn Node) -> bool { } // Same base pointer, but different vtables. - // Compare the types. - lhs.typ() == rhs.typ() + // Compare the discriminants of their kinds. + std::mem::discriminant(&lhs.kind()) == std::mem::discriminant(&rhs.kind()) } /// NodeMut is a mutable node.