Skip to content

Commit e076823

Browse files
bors[bot]philberty
andauthored
Merge #1016
1016: Add missing HIR lowering for SliceTypes r=philberty a=philberty Addresses #849 Co-authored-by: Philip Herron <[email protected]>
2 parents 6e64e66 + 47ae663 commit e076823

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

gcc/rust/hir/rust-ast-lower-type.h

+18
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,24 @@ class ASTLoweringType : public ASTLoweringBase
278278
translated);
279279
}
280280

281+
void visit (AST::SliceType &type) override
282+
{
283+
HIR::Type *base_type
284+
= ASTLoweringType::translate (type.get_elem_type ().get ());
285+
286+
auto crate_num = mappings->get_current_crate ();
287+
Analysis::NodeMapping mapping (crate_num, type.get_node_id (),
288+
mappings->get_next_hir_id (crate_num),
289+
mappings->get_next_localdef_id (crate_num));
290+
291+
translated
292+
= new HIR::SliceType (mapping, std::unique_ptr<HIR::Type> (base_type),
293+
type.get_locus ());
294+
295+
mappings->insert_hir_type (mapping.get_crate_num (), mapping.get_hirid (),
296+
translated);
297+
}
298+
281299
void visit (AST::InferredType &type) override
282300
{
283301
auto crate_num = mappings->get_current_crate ();

0 commit comments

Comments
 (0)