-
Notifications
You must be signed in to change notification settings - Fork 195
Closed
Labels
Description
The constant folder implementation should take advantage of error nodes.
- return error expression the default value of the folded result is already an error expression
return nullptr; : ConstFoldBase (), folded (ctx->get_backend ()->error_expression ()) - update error handling code now that the result is at least error_mark_node this no longer needs a nullptr check
gccrs/gcc/rust/typecheck/rust-hir-type-check.cc
Lines 395 to 401 in 28f527c
auto capacity = ConstFold::ConstFoldExpr::fold (type.get_size_expr ()); if (capacity == nullptr) return; TyTy::BaseType *base = TypeCheckType::Resolve (type.get_element_type ()); translated = new TyTy::ArrayType (type.get_mappings ().get_hirid (), capacity, TyTy::TyVar (base->get_ref ()));