Skip to content

Commit

Permalink
gccrs: minor changes (typo and minor refactor)
Browse files Browse the repository at this point in the history
Fix a typo and merge 2 if clauses using the same condition.

gcc/rust/ChangeLog:

	* backend/rust-compile-expr.cc (CompileExpr::visit): Merge 2 if clauses.
	* backend/rust-compile-extern.h: Fix typo in comment.

Signed-off-by: Marc Poulhiès <[email protected]>
  • Loading branch information
dkm committed Oct 16, 2023
1 parent 007166c commit 7292e71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 2 additions & 6 deletions gcc/rust/backend/rust-compile-expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1635,17 +1635,13 @@ CompileExpr::visit (HIR::CallExpr &expr)
return;

bool is_variadic = false;
if (tyty->get_kind () == TyTy::TypeKind::FNDEF)
{
const TyTy::FnType *fn = static_cast<const TyTy::FnType *> (tyty);
is_variadic = fn->is_variadic ();
}

size_t required_num_args = expr.get_arguments ().size ();

if (tyty->get_kind () == TyTy::TypeKind::FNDEF)
{
const TyTy::FnType *fn = static_cast<const TyTy::FnType *> (tyty);
required_num_args = fn->num_params ();
is_variadic = fn->is_variadic ();
}
else if (tyty->get_kind () == TyTy::TypeKind::FNPTR)
{
Expand Down
6 changes: 2 additions & 4 deletions gcc/rust/backend/rust-compile-extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ class CompileExternItem : public HIRCompileBase,
}

if (fntype->has_substitutions_defined ())
{
// override the Hir Lookups for the substituions in this context
fntype->override_context ();
}
// override the HIR lookups for the substitutions in this context
fntype->override_context ();

if (fntype->get_abi () == ABI::INTRINSIC)
{
Expand Down

0 comments on commit 7292e71

Please sign in to comment.