aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-ast.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-12-16 11:38:58 +0000
committerGitHub <noreply@github.com>2021-12-16 11:38:58 +0000
commit7615df781226137b9cd76b47df4aea6ad9f2140e (patch)
tree9612ddcdf4381a28762ad694b4e233e4c3dda4e3 /gcc/rust/ast/rust-ast.h
parent83a984b1a12694d8e06eb139089429b61e236fdd (diff)
parentc81eb149048938e2e795e015b69bf601a930f799 (diff)
downloadgcc-7615df781226137b9cd76b47df4aea6ad9f2140e.zip
gcc-7615df781226137b9cd76b47df4aea6ad9f2140e.tar.gz
gcc-7615df781226137b9cd76b47df4aea6ad9f2140e.tar.bz2
Merge #836
836: BugFix NodeId skew on AST::Patterns r=philberty a=philberty The AST constructors implicitly generate new NodeId's, their associated copy/move constructors ensure that they preserve the NodeId correctly. The AST::Pattern's here incorrectly had a constructor in the abstract base class which was generating the NodeId's but when this is used within AST::MatchArms the fields contain these patterns which can get copied/moved to cause new NodeId's to be generated which then throws off type checking as the NodeId changes during HIR lowering and thus each of the ID's are all off by one during type checking. Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/ast/rust-ast.h')
-rw-r--r--gcc/rust/ast/rust-ast.h8
1 files changed, 1 insertions, 7 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 05779e7..cfded356 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -1037,7 +1037,6 @@ public:
virtual ~Pattern () {}
virtual std::string as_string () const = 0;
-
virtual void accept_vis (ASTVisitor &vis) = 0;
// as only one kind of pattern can be stripped, have default of nothing
@@ -1045,16 +1044,11 @@ public:
virtual bool is_marked_for_strip () const { return false; }
virtual Location get_locus () const = 0;
-
- virtual NodeId get_node_id () const { return node_id; }
+ virtual NodeId get_pattern_node_id () const = 0;
protected:
// Clone pattern implementation as pure virtual method
virtual Pattern *clone_pattern_impl () const = 0;
-
- Pattern () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
-
- NodeId node_id;
};
// forward decl for Type