tint: Improve error message for module-scope function calls

The previous error message for calling a function at module scope
was misleading, stating "functions cannot be called at module-scope".
This is inaccurate as built-in constant functions are allowed.

This CL updates the error message to be more specific and helpful,
indicating that "Custom functions cannot be called at module scope.
Only built-in functions are allowed here."

Bug: tint:42250870
Change-Id: I31fcb15ac9a214f413a5edf75264aee04c9094b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/228754
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/lang/wgsl/resolver/function_validation_test.cc b/src/tint/lang/wgsl/resolver/function_validation_test.cc
index bb15f2b..3a0f7b8 100644
--- a/src/tint/lang/wgsl/resolver/function_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/function_validation_test.cc
@@ -452,7 +452,8 @@
     GlobalVar("x", Call(Source{{12, 34}}, "F"), core::AddressSpace::kPrivate);
 
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(), R"(12:34 error: functions cannot be called at module-scope)");
+    EXPECT_EQ(r()->error(),
+              R"(12:34 error: user-declared functions cannot be called at module-scope)");
 }
 
 TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) {
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc
index 7d9d9d7..1f3a1ac 100644
--- a/src/tint/lang/wgsl/resolver/validator.cc
+++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -2179,7 +2179,7 @@
     auto name = sym.Name();
 
     if (!current_statement) {  // Function call at module-scope.
-        AddError(decl->source) << "functions cannot be called at module-scope";
+        AddError(decl->source) << "user-declared functions cannot be called at module-scope";
         return false;
     }