aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-03-11 12:08:30 +0000
committerGitHub <noreply@github.com>2022-03-11 12:08:30 +0000
commite076823eda8f11425a705a191d686e9e48be2fc4 (patch)
tree9afc4ad2aca1e8530878dd3a8e8d331a833e169d
parent6e64e6636ef823ac97ad889b71bb792fbe510580 (diff)
parent47ae663a3efe884f90c13c063546655f92c11564 (diff)
downloadgcc-e076823eda8f11425a705a191d686e9e48be2fc4.zip
gcc-e076823eda8f11425a705a191d686e9e48be2fc4.tar.gz
gcc-e076823eda8f11425a705a191d686e9e48be2fc4.tar.bz2
Merge #1016
1016: Add missing HIR lowering for SliceTypes r=philberty a=philberty Addresses #849 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-type.h b/gcc/rust/hir/rust-ast-lower-type.h
index a9b4dd8..fd14abd 100644
--- a/gcc/rust/hir/rust-ast-lower-type.h
+++ b/gcc/rust/hir/rust-ast-lower-type.h
@@ -278,6 +278,24 @@ public:
translated);
}
+ void visit (AST::SliceType &type) override
+ {
+ HIR::Type *base_type
+ = ASTLoweringType::translate (type.get_elem_type ().get ());
+
+ auto crate_num = mappings->get_current_crate ();
+ Analysis::NodeMapping mapping (crate_num, type.get_node_id (),
+ mappings->get_next_hir_id (crate_num),
+ mappings->get_next_localdef_id (crate_num));
+
+ translated
+ = new HIR::SliceType (mapping, std::unique_ptr<HIR::Type> (base_type),
+ type.get_locus ());
+
+ mappings->insert_hir_type (mapping.get_crate_num (), mapping.get_hirid (),
+ translated);
+ }
+
void visit (AST::InferredType &type) override
{
auto crate_num = mappings->get_current_crate ();