diff --git a/gcc/rust/checks/errors/rust-feature-gate.cc b/gcc/rust/checks/errors/rust-feature-gate.cc
index 3c943022f05..33bbfa1ec51 100644
--- a/gcc/rust/checks/errors/rust-feature-gate.cc
+++ b/gcc/rust/checks/errors/rust-feature-gate.cc
@@ -131,7 +131,8 @@ FeatureGate::visit (AST::MacroRulesDefinition &rules_def)
 void
 FeatureGate::visit (AST::Function &function)
 {
-  check_rustc_attri (function.get_outer_attrs ());
+  if (!function.is_external ())
+    check_rustc_attri (function.get_outer_attrs ());
 }
 
 void
diff --git a/gcc/rust/hir/rust-ast-lower-extern.h b/gcc/rust/hir/rust-ast-lower-extern.h
index f9e067c8e95..ad7d75422d6 100644
--- a/gcc/rust/hir/rust-ast-lower-extern.h
+++ b/gcc/rust/hir/rust-ast-lower-extern.h
@@ -65,7 +65,7 @@ public:
       item.get_outer_attrs (), item.get_locus ());
   }
 
-  void visit (AST::ExternalFunctionItem &function) override
+  void visit (AST::Function &function) override
   {
     std::vector<std::unique_ptr<HIR::WhereClauseItem> > where_clause_items;
     HIR::WhereClause where_clause (std::move (where_clause_items));
@@ -88,12 +88,25 @@ public:
     std::vector<HIR::NamedFunctionParam> function_params;
     for (auto it = begin; it != end; it++)
       {
+	auto param = static_cast<AST::FunctionParam *> (it->get ());
+
+	if (param->is_variadic () || param->is_self ())
+	  continue;
+	auto param_kind = param->get_pattern ()->get_pattern_kind ();
+
+	rust_assert (param_kind == AST::Pattern::Kind::Identifier
+		     || param_kind == AST::Pattern::Kind::Wildcard);
+	auto param_ident = static_cast<AST::IdentifierPattern *> (
+	  param->get_pattern ().get ());
+	Identifier param_name = param_kind == AST::Pattern::Kind::Identifier
+				  ? param_ident->get_ident ()
+				  : std::string ("_");
+
 	HIR::Type *param_type
-	  = ASTLoweringType::translate (it->get_type ().get ());
-	Identifier param_name = it->get_name ();
+	  = ASTLoweringType::translate (param->get_type ().get ());
 
 	auto crate_num = mappings->get_current_crate ();
-	Analysis::NodeMapping mapping (crate_num, it->get_node_id (),
+	Analysis::NodeMapping mapping (crate_num, param->get_node_id (),
 				       mappings->get_next_hir_id (crate_num),
 				       mappings->get_next_localdef_id (
 					 crate_num));
@@ -109,7 +122,7 @@ public:
 				   mappings->get_next_localdef_id (crate_num));
 
     translated = new HIR::ExternalFunctionItem (
-      mapping, function.get_identifier (), std::move (generic_params),
+      mapping, function.get_function_name (), std::move (generic_params),
       std::unique_ptr<HIR::Type> (return_type), std::move (where_clause),
       std::move (function_params), is_variadic, std::move (vis),
       function.get_outer_attrs (), function.get_locus ());
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index c8a87a11766..26b24150f7a 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -6165,8 +6165,7 @@ Parser<ManagedTokenSource>::parse_external_item ()
 				       std::move (outer_attrs), locus));
       }
     case FN_KW:
-      return parse_external_function_item (std::move (vis),
-					   std::move (outer_attrs));
+      return parse_function (std::move (vis), std::move (outer_attrs), true);
 
     case TYPE:
       return parse_external_type_item (std::move (vis),
@@ -10476,7 +10475,9 @@ Parser<ManagedTokenSource>::parse_pattern ()
     {
       lexer.skip_token ();
       alts.push_back (parse_pattern_no_alt ());
-  } while (lexer.peek_token ()->get_id () == PIPE);
+    }
+
+  while (lexer.peek_token ()->get_id () == PIPE);
 
   /* alternates */
   return std::unique_ptr<AST::Pattern> (
diff --git a/gcc/rust/resolve/rust-ast-resolve-implitem.h b/gcc/rust/resolve/rust-ast-resolve-implitem.h
index 4f4d2893f83..fa344effe67 100644
--- a/gcc/rust/resolve/rust-ast-resolve-implitem.h
+++ b/gcc/rust/resolve/rust-ast-resolve-implitem.h
@@ -189,11 +189,11 @@ public:
     item->accept_vis (resolver);
   };
 
-  void visit (AST::ExternalFunctionItem &function) override
+  void visit (AST::Function &function) override
   {
     auto decl
       = CanonicalPath::new_seg (function.get_node_id (),
-				function.get_identifier ().as_string ());
+				function.get_function_name ().as_string ());
     auto path = prefix.append (decl);
 
     resolver->get_name_scope ().insert (
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.cc b/gcc/rust/resolve/rust-ast-resolve-item.cc
index 743657bc421..a3f27b3e4a0 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-item.cc
@@ -1009,11 +1009,12 @@ ResolveExternItem::go (AST::ExternalItem *item, const CanonicalPath &prefix,
 }
 
 void
-ResolveExternItem::visit (AST::ExternalFunctionItem &function)
+ResolveExternItem::visit (AST::Function &function)
 {
   NodeId scope_node_id = function.get_node_id ();
-  auto decl = CanonicalPath::new_seg (function.get_node_id (),
-				      function.get_identifier ().as_string ());
+  auto decl
+    = CanonicalPath::new_seg (function.get_node_id (),
+			      function.get_function_name ().as_string ());
   auto path = prefix.append (decl);
   auto cpath = canonical_prefix.append (decl);
 
@@ -1038,9 +1039,12 @@ ResolveExternItem::visit (AST::ExternalFunctionItem &function)
 
   // we make a new scope so the names of parameters are resolved and shadowed
   // correctly
-  for (auto &param : function.get_function_params ())
-    if (!param.is_variadic ())
-      ResolveType::go (param.get_type ().get ());
+  for (auto &it : function.get_function_params ())
+    if (!it->is_variadic ())
+      {
+	auto param = static_cast<AST::FunctionParam *> (it.get ());
+	ResolveType::go (param->get_type ().get ());
+      }
 
   // done
   resolver->get_name_scope ().pop ();
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.h b/gcc/rust/resolve/rust-ast-resolve-item.h
index e397ffdfe8b..0133d2ca27f 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.h
+++ b/gcc/rust/resolve/rust-ast-resolve-item.h
@@ -111,7 +111,7 @@ public:
   static void go (AST::ExternalItem *item, const CanonicalPath &prefix,
 		  const CanonicalPath &canonical_prefix);
 
-  void visit (AST::ExternalFunctionItem &function) override;
+  void visit (AST::Function &function) override;
   void visit (AST::ExternalStaticItem &item) override;
 
 private:
diff --git a/gcc/rust/resolve/rust-default-resolver.cc b/gcc/rust/resolve/rust-default-resolver.cc
index 28f04a10839..c99f2f64331 100644
--- a/gcc/rust/resolve/rust-default-resolver.cc
+++ b/gcc/rust/resolve/rust-default-resolver.cc
@@ -62,7 +62,8 @@ DefaultResolver::visit (AST::Function &function)
 	if (p->is_variadic ())
 	  {
 	    auto param = static_cast<AST::VariadicParam *> (p.get ());
-	    param->get_pattern ()->accept_vis (*this);
+	    if (param->has_pattern ())
+	      param->get_pattern ()->accept_vis (*this);
 	  }
 	else if (p->is_self ())
 	  {
