Skip to content

Commit 69d6fdd

Browse files
committed
Allow substitutions to be handled on primitive types without causing unreachable
1 parent 0e7eef6 commit 69d6fdd

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

gcc/rust/typecheck/rust-substitution-mapper.h

+16-13
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,22 @@ class SubstMapperInternal : public TyTy::TyVisitor
232232
}
233233

234234
// nothing to do for these
235-
void visit (TyTy::InferType &) override { gcc_unreachable (); }
236-
void visit (TyTy::FnPtr &) override { gcc_unreachable (); }
237-
void visit (TyTy::BoolType &) override { gcc_unreachable (); }
238-
void visit (TyTy::IntType &) override { gcc_unreachable (); }
239-
void visit (TyTy::UintType &) override { gcc_unreachable (); }
240-
void visit (TyTy::FloatType &) override { gcc_unreachable (); }
241-
void visit (TyTy::USizeType &) override { gcc_unreachable (); }
242-
void visit (TyTy::ISizeType &) override { gcc_unreachable (); }
243-
void visit (TyTy::ErrorType &) override { gcc_unreachable (); }
244-
void visit (TyTy::CharType &) override { gcc_unreachable (); }
245-
void visit (TyTy::StrType &) override { gcc_unreachable (); }
246-
void visit (TyTy::NeverType &) override { gcc_unreachable (); }
247-
void visit (TyTy::DynamicObjectType &) override { gcc_unreachable (); }
235+
void visit (TyTy::InferType &type) override { resolved = type.clone (); }
236+
void visit (TyTy::FnPtr &type) override { resolved = type.clone (); }
237+
void visit (TyTy::BoolType &type) override { resolved = type.clone (); }
238+
void visit (TyTy::IntType &type) override { resolved = type.clone (); }
239+
void visit (TyTy::UintType &type) override { resolved = type.clone (); }
240+
void visit (TyTy::FloatType &type) override { resolved = type.clone (); }
241+
void visit (TyTy::USizeType &type) override { resolved = type.clone (); }
242+
void visit (TyTy::ISizeType &type) override { resolved = type.clone (); }
243+
void visit (TyTy::ErrorType &type) override { resolved = type.clone (); }
244+
void visit (TyTy::CharType &type) override { resolved = type.clone (); }
245+
void visit (TyTy::StrType &type) override { resolved = type.clone (); }
246+
void visit (TyTy::NeverType &type) override { resolved = type.clone (); }
247+
void visit (TyTy::DynamicObjectType &type) override
248+
{
249+
resolved = type.clone ();
250+
}
248251

249252
private:
250253
SubstMapperInternal (HirId ref, TyTy::SubstitutionArgumentMappings &mappings)

0 commit comments

Comments
 (0)