Skip to content

Commit

Permalink
Merge #1016
Browse files Browse the repository at this point in the history
1016: Add missing HIR lowering for SliceTypes r=philberty a=philberty

Addresses #849


Co-authored-by: Philip Herron <philip.herron@embecosm.com>
  • Loading branch information
bors[bot] and philberty authored Mar 11, 2022
2 parents 6e64e66 + 47ae663 commit e076823
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gcc/rust/hir/rust-ast-lower-type.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,24 @@ class ASTLoweringType : public ASTLoweringBase
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 ();
Expand Down

0 comments on commit e076823

Please sign in to comment.