Skip to content

Commit 1d19dd8

Browse files
committed
Fix nullptr when resolving the root of a path expression
When we resolve paths we don't have a _type_, in this senario there is a bug in our resolution of this generic function so this means the root_tyty is nullptr but the offset is non zero so we return nullptr. Addresses #1132
1 parent 2b1cb4b commit 1d19dd8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gcc/rust/typecheck/rust-hir-type-check-path.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ TypeCheckExpr::resolve_root_path (HIR::PathInExpression &expr, size_t *offset,
178178
HIR::PathExprSegment &seg = expr.get_segments ().at (i);
179179

180180
bool have_more_segments = (expr.get_num_segments () - 1 != i);
181-
bool is_root = *offset == 0;
181+
bool is_root = *offset == 0 || root_tyty == nullptr;
182182
NodeId ast_node_id = seg.get_mappings ().get_nodeid ();
183183

184184
// then lookup the reference_node_id

0 commit comments

Comments
 (0)