#[non_exhaustive]pub enum CodeGenWarning {
Show 19 variants
#[non_exhaustive] ZeroizeRuleMatchedNothing {
rule: String,
},
#[non_exhaustive] ViewJsonRuleMatchedNothing {
rule: String,
},
#[non_exhaustive] ViewJsonRulesRequireJsonAndViews,
#[non_exhaustive] IdiomaticAliasesSuppressed {
enum_name: String,
conflicts: Vec<AliasConflict>,
invalid: Vec<String>,
},
#[non_exhaustive] OwnedViewAccessorSuppressed {
wrapper_name: String,
field_name: String,
},
#[non_exhaustive] LazyViewsRequireViews,
#[non_exhaustive] DenyUnknownJsonFieldsRequiresJson,
#[non_exhaustive] JsonPolicyTypesRequireJson,
#[non_exhaustive] IdiomaticFieldNamesAdjusted {
message_name: String,
assignments: Vec<(String, String)>,
},
#[non_exhaustive] KeywordEscapedNamesAdjusted {
message_name: String,
assignments: Vec<(String, String)>,
},
#[non_exhaustive] ExcludedPackageFieldRef {
file_name: String,
message_name: String,
field_name: String,
ref_package: String,
type_fqn: String,
},
#[non_exhaustive] ExcludePackageMatchedNothing {
package: String,
},
#[non_exhaustive] FeatureOverrideMatchedNothing {
rule: String,
feature: &'static str,
value: &'static str,
},
#[non_exhaustive] PreserveUnknownFieldsRuleMatchedNothing {
rule: String,
},
#[non_exhaustive] DenyUnknownJsonFieldsRuleMatchedNothing {
rule: String,
},
#[non_exhaustive] SkipDebugRuleMatchedNothing {
rule: String,
},
#[non_exhaustive] FieldTypeRuleMatchedNothing {
rule: String,
option: &'static str,
matches_ungenerated: bool,
},
#[non_exhaustive] CodecStrategyRuleMatchedNothing {
rule: String,
},
#[non_exhaustive] TableCodecFallbackSummary {
fallbacks: usize,
selected: usize,
reasons: Vec<TableCodecFallbackReason>,
},
}Expand description
A non-fatal diagnostic produced during code generation.
Returned by generate_with_diagnostics. Render the human-readable form via
the Display impl (e.g. cargo:warning={warning}), or
match on the variant for programmatic handling. The enum and its variants are
#[non_exhaustive] so new diagnostic kinds and fields can be added without a
breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]ZeroizeRuleMatchedNothing
An explicitly permitted selector was absent from this scoped request.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ViewJsonRuleMatchedNothing
An explicitly permitted view selector was absent from this scoped request.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ViewJsonRulesRequireJsonAndViews
View JSON restrictions cannot apply without both JSON and view generation.
#[non_exhaustive]IdiomaticAliasesSuppressed
Idiomatic CamelCase aliases were suppressed for an enum because two or
more proto values collide after conversion, or a value would convert to
an invalid identifier. The enum’s SHOUTY_SNAKE_CASE variants are
unaffected.
Fields
This variant is marked as non-exhaustive
conflicts: Vec<AliasConflict>Each collision, by target identifier. Empty if the only problem was invalid identifiers.
#[non_exhaustive]OwnedViewAccessorSuppressed
A field or oneof accessor on a generated FooOwnedView wrapper was
suppressed because the proto name collides with one of the wrapper’s
reserved method names (decode, view, bytes, …). The field stays
fully accessible through view() on the wrapper (or
OwnedView::reborrow).
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]LazyViewsRequireViews
lazy_views was requested with generate_views disabled; the lazy
family reuses the eager view-oneof enums and eager sub-view types, so
no lazy views were generated. Emitted once per generation run.
#[non_exhaustive]DenyUnknownJsonFieldsRequiresJson
deny_unknown_json_fields, or a
deny_unknown_json_fields_in
rule, was set with generate_json
disabled. There are no JSON deserializers to make strict, so the
setting changed nothing — forgetting generate_json is the likelier
mistake than a wrong path, and without this the option is silently
inert. Emitted once per generation run.
#[non_exhaustive]JsonPolicyTypesRequireJson
json_policy_types is non-empty but
JSON generation is off, so no field uses a policy.
#[non_exhaustive]IdiomaticFieldNamesAdjusted
idiomatic_field_names found two or more members of one message whose
snake_case conversions collide, and adjusted the affected Rust names
deterministically (_f<number> suffix for fields, verbatim fallback
for oneofs — see CodeGenConfig::idiomatic_field_names). Wire,
JSON, and text-format names are unaffected.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]KeywordEscapedNamesAdjusted
A member’s keyword-escaped Rust name is also the name of another member, and the keyword member was renamed.
A field or oneof whose Rust name is self, super, crate or Self
(after any idiomatic_field_names conversion) is generated as self_.
Next to a member named self_, it is generated as self__, with more
underscores while that name is taken too. Wire, JSON and text-format
names are unaffected. Two oneofs named self and self_ fail with
CodeGenError::OneofEnumNameConflict instead.
A field is identified by its name and number, and a oneof by its
name, across the messages of every generated file. A message that
declares the same member gets the same Rust name and this warning,
even when it has no self_ member of its own.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ExcludedPackageFieldRef
A field in a kept file references a type from a package that is neither
being generated nor covered by an extern_path
mapping. The generated code will emit a dangling type path that fails to
compile in the consumer’s build with no indication of where the
configuration gap is.
Fix by either:
- Including the referenced package in the generation request (drop the
exclude_packageplugin directive or the.exclude_package(…)call, or add the missing.protofiles to the generate set), or - Adding an
extern_pathmapping for the package pointing to the crate that provides its generated types.
Detection is type-granular: a kept file that generates some types from a package while another file in the same package is excluded will still produce a warning for references to the excluded file’s types.
One warning is emitted per unique (file_name, type_fqn) pair; other
fields in the same file referencing the same type are not reported
separately.
Fields
This variant is marked as non-exhaustive
message_name: StringThe message that contains the referencing field, in dotted form
(e.g. "MyMessage" or "Outer.Inner"). Empty when the reference
is a file-level extension rather than a message field.
type_fqn: StringThe fully-qualified type name in the descriptor (leading-dot form,
matching the key format of CodeGenConfig::extern_paths),
e.g. ".buf.validate.FieldConstraints".
#[non_exhaustive]ExcludePackageMatchedNothing
An exclude_packages entry matched
no proto package in the descriptor set. Usually a typo in the package
name or a stale entry left after a proto reorganization — the entry is
accepted but changes nothing.
Check the spelling against the package declarations in your .proto
files. The match is exact or prefix-on-component-boundary, so
"buf.validate" covers buf.validate and buf.validate.priv but not
buf.validatex.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]FeatureOverrideMatchedNothing
A feature_overrides rule matched
nothing the override targets in the compiled descriptor set, so it
changed nothing. Usually a typo, a missing nested-message segment, or
a stale path after a proto rename — the affected paths silently keep
their default semantics.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]PreserveUnknownFieldsRuleMatchedNothing
A preserve_unknown_fields_in
rule matched no message being generated, so it changed nothing. Usually
a typo, a field path instead of a message path, or a rule for a package
mapped through extern_path — the affected messages silently keep the
global preserve_unknown_fields
setting, which for a re-enable rule means losing round-trip fidelity.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]DenyUnknownJsonFieldsRuleMatchedNothing
A deny_unknown_json_fields_in
rule matched no message being generated, so it changed nothing. Usually
a typo, a field path instead of a message path, or a rule for a package
mapped through extern_path — the affected messages silently keep the
global deny_unknown_json_fields
setting, which for an enabling rule means unknown JSON keys stay silently
ignored.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]SkipDebugRuleMatchedNothing
A skip_debug rule matched no generated
message and named no generated enum, so it changed nothing. Usually a
typo, a field or oneof path instead of a type path (a oneof is covered
by its message’s rule), or a rule for a package mapped through
extern_path. Every generated Debug impl is still emitted, so a
hand-written impl for the intended type fails to compile as a
conflicting implementation.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]FieldTypeRuleMatchedNothing
A bytes_fields,
string_fields,
map_fields or
repeated_fields rule matched no
field of a message generated by this call, so it changed nothing.
Usually a typo, a path without its leading dot or its package, a
prost-style suffix path such as "items", or a path into a map-entry
message (a rule reaches a map through the map field’s own path). A
package rule over messages that have no fields also warns.
The check compares paths only: a rule whose path is a field of another
type (a string_fields rule on an int32 field) is also inert and
does not warn. It runs once per generate call, so a config shared by
several calls warns in each call whose files lack the field.
Fields
This variant is marked as non-exhaustive
rule: StringThe rule’s path as it is in the CodeGenConfig list
(buffa-build has normalized it).
option: &'static strThe CodeGenConfig list that contains the rule: "bytes_fields",
"string_fields", "map_fields" or "repeated_fields".
#[non_exhaustive]CodecStrategyRuleMatchedNothing
A codec_strategy_in rule matched no
message being generated, so it changed nothing. Usually a typo, a field
path instead of a message path, or a rule for a package mapped through
extern_path.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]TableCodecFallbackSummary
Some messages selected for CodecStrategy::Table, by the global
codec_strategy or by a
codec_strategy_in rule, cannot use
the table and are generated CodecStrategy::Unrolled. One warning
covers the whole run.
Fields
This variant is marked as non-exhaustive
reasons: Vec<TableCodecFallbackReason>Why they fell back, most common reason first.