bazel packages: minor StructProvider clean-ups

- Remove concept of "error format strings" from Provider interface.
  Error messages are computed by a method. (Only the StarlarkInfo subclass
  now talks about format strings).
- Eliminate StructProvider.create(Map, Location) by inlining 4 calls.
- Improve wording of StarlarkProvider unknown field error message.
- Add TODO notes on the challenge of moving the unknown field error
  messages entirely into Providers.

This CL contains the uncomplicated parts a failed attempt to do those TODOs.

PiperOrigin-RevId: 341647758
diff --git a/src/main/java/com/google/devtools/build/lib/packages/StructProvider.java b/src/main/java/com/google/devtools/build/lib/packages/StructProvider.java
index dcdd3a5..be24edd 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/StructProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/StructProvider.java
@@ -20,37 +20,33 @@
 import net.starlark.java.eval.EvalException;
 import net.starlark.java.eval.Starlark;
 import net.starlark.java.eval.StarlarkThread;
-import net.starlark.java.syntax.Location;
 
 /**
  * The provider for the built-in type {@code struct}.
  *
  * <p>Its singleton instance is {@link StructProvider#STRUCT}.
  */
-public final class StructProvider extends BuiltinProvider<StructImpl>
+public final class StructProvider extends BuiltinProvider<StarlarkInfo>
     implements StructApi.StructProviderApi {
 
-  /** "struct" function. */
+  /** Provider of "struct" instances. */
   public static final StructProvider STRUCT = new StructProvider();
 
-  StructProvider() {
-    super("struct", StructImpl.class);
+  private StructProvider() {
+    super("struct", StarlarkInfo.class);
   }
 
+  /** Implementation of {@code struct(**kwargs)} function exposed to Starlark. */
   @Override
   public StructImpl createStruct(Dict<String, Object> kwargs, StarlarkThread thread)
       throws EvalException {
-    return create(kwargs, thread.getCallerLocation());
-  }
-
-  public StructImpl create(Map<String, Object> fields, Location location) throws EvalException {
-    if (fields.containsKey("to_json")) {
+    if (kwargs.containsKey("to_json")) {
       throw Starlark.errorf("cannot override built-in struct function 'to_json'");
     }
-    if (fields.containsKey("to_proto")) {
+    if (kwargs.containsKey("to_proto")) {
       throw Starlark.errorf("cannot override built-in struct function 'to_proto'");
     }
-    return StarlarkInfo.create(this, fields, location);
+    return StarlarkInfo.create(this, kwargs, thread.getCallerLocation());
   }
 
   /**