internal/impl: change unmarshal func return to unmarshalOptions

The fast-path unmarshal funcs return the number of bytes consumed.

Change these functions to return an unmarshalOutput struct instead, to
make it easier to add to the results. This is groundwork for allowing
the fast-path unmarshaler to indicate when the unmarshaled message is
known to be initialized.

Change-Id: Ia8c44731a88f5be969a55cd98ea26282f412c7ae
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/215720
Reviewed-by: Joe Tsai <joetsai@google.com>
diff --git a/internal/impl/codec_messageset.go b/internal/impl/codec_messageset.go
index e917c7c..16bc3dc 100644
--- a/internal/impl/codec_messageset.go
+++ b/internal/impl/codec_messageset.go
@@ -90,9 +90,9 @@
 	return b, nil
 }
 
-func unmarshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts unmarshalOptions) (int, error) {
+func unmarshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts unmarshalOptions) (out unmarshalOutput, err error) {
 	if !flags.ProtoLegacy {
-		return 0, errors.New("no support for message_set_wire_format")
+		return out, errors.New("no support for message_set_wire_format")
 	}
 
 	ep := p.Apply(mi.extensionOffset).Extensions()
@@ -101,7 +101,7 @@
 	}
 	ext := *ep
 	unknown := p.Apply(mi.unknownOffset).Bytes()
-	err := messageset.Unmarshal(b, true, func(num wire.Number, v []byte) error {
+	err = messageset.Unmarshal(b, true, func(num wire.Number, v []byte) error {
 		_, err := mi.unmarshalExtension(v, num, wire.BytesType, ext, opts)
 		if err == errUnknown {
 			*unknown = wire.AppendTag(*unknown, num, wire.BytesType)
@@ -110,5 +110,6 @@
 		}
 		return err
 	})
-	return len(b), err
+	out.n = len(b)
+	return out, err
 }