aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-10-30 12:02:17 +0000
committerGitHub <noreply@github.com>2021-10-30 12:02:17 +0000
commita9daecd2a35f7caebb02feb4dbb2dc89f3165cdb (patch)
treee20c3965e480c2ce76ee5276a2b8a3b96fd3ba9a /gcc/rust/hir
parentcba61d8dcbe1ac0fb23a96b2974541b201292465 (diff)
parenta66dd96413432095ef13e6429f7acb3cb06f4f0f (diff)
downloadgcc-a9daecd2a35f7caebb02feb4dbb2dc89f3165cdb.zip
gcc-a9daecd2a35f7caebb02feb4dbb2dc89f3165cdb.tar.gz
gcc-a9daecd2a35f7caebb02feb4dbb2dc89f3165cdb.tar.bz2
Merge #778
778: Add location info in AST::TypeBoundWhereClauseItem and HIR::TypeBoundWhereClauseItem r=philberty a=npate012 Location info has been added to AST::TypeBoundWhereClauseItem and HIR::TypeBoundWhereClauseItem. parse_type_bound_where_clause_item () has been modified to fetch location info and store it in AST::TypeBoundWhereClauseItem. Fixes #766 Signed-off-by: Nirmal Patel <npate012@gmail.com> Co-authored-by: Nirmal Patel <npate012@gmail.com>
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.h3
-rw-r--r--gcc/rust/hir/tree/rust-hir-item.h6
2 files changed, 6 insertions, 3 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-type.h b/gcc/rust/hir/rust-ast-lower-type.h
index 8205d07..f44825c 100644
--- a/gcc/rust/hir/rust-ast-lower-type.h
+++ b/gcc/rust/hir/rust-ast-lower-type.h
@@ -479,7 +479,8 @@ public:
translated
= new HIR::TypeBoundWhereClauseItem (mapping, std::move (for_lifetimes),
std::move (bound_type),
- std::move (type_param_bounds));
+ std::move (type_param_bounds),
+ item.get_locus ());
}
private:
diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h
index 21f0781..9b8793f 100644
--- a/gcc/rust/hir/tree/rust-hir-item.h
+++ b/gcc/rust/hir/tree/rust-hir-item.h
@@ -218,6 +218,7 @@ class TypeBoundWhereClauseItem : public WhereClauseItem
std::unique_ptr<Type> bound_type;
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds;
Analysis::NodeMapping mappings;
+ Location locus;
public:
// Returns whether the item has ForLifetimes
@@ -229,11 +230,12 @@ public:
TypeBoundWhereClauseItem (
Analysis::NodeMapping mappings, std::vector<LifetimeParam> for_lifetimes,
std::unique_ptr<Type> bound_type,
- std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds)
+ std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
+ Location locus)
: for_lifetimes (std::move (for_lifetimes)),
bound_type (std::move (bound_type)),
type_param_bounds (std::move (type_param_bounds)),
- mappings (std::move (mappings))
+ mappings (std::move (mappings)), locus (locus)
{}
// Copy constructor requires clone