Skip to main content

CodeGenWarning

Enum CodeGenWarning 

Source
#[non_exhaustive]
pub enum CodeGenWarning {
Show 21 variants
#[non_exhaustive]
ZeroizeRuleMatchedNothing { rule: String, },
#[non_exhaustive]
ViewJsonRuleMatchedNothing { rule: String, },
#[non_exhaustive]
BorrowedViewsRuleMatchedNothing { 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]
JsonPolicyReflectionBypass { policy_types: Vec<String>, },
#[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, names_extension: 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 enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

#[non_exhaustive]
ZeroizeRuleMatchedNothing

An explicitly permitted selector was absent from this scoped request.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String
§

#[non_exhaustive]
ViewJsonRuleMatchedNothing

An explicitly permitted view selector was absent from this scoped request.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String
§

#[non_exhaustive]
BorrowedViewsRuleMatchedNothing

An explicitly permitted borrowed-view selector is absent from this request.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String
§

#[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
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§enum_name: String

The Rust name of the affected enum.

§conflicts: Vec<AliasConflict>

Each collision, by target identifier. Empty if the only problem was invalid identifiers.

§invalid: Vec<String>

Proto values that would convert to an invalid Rust identifier.

§

#[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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§wrapper_name: String

The Rust name of the wrapper type (e.g. FooOwnedView).

§field_name: String

The proto field or oneof name whose accessor was suppressed.

§

#[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]
JsonPolicyReflectionBypass

A generated field selects a listed JSON policy type while JSON and generate_reflection are both on. JSON policies govern only the generated serde impls: descriptor-driven reflection (a generated message converted with to_dynamic or DynamicMessage::try_from_message, then serialized or deserialized through DynamicMessage’s own JSON) encodes fields of the listed types as standard base64 or plain strings and never calls the policy, so a policy that refuses export does not stop it and its import checks do not run. Generated reflection only makes that one call away: try_from_message works without it, and binary encoding and text format never call the policy either, so a policy is not a confidentiality boundary in any configuration. Emitted once per generation run for the types selected by its generated fields, not unused configuration rules.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§policy_types: Vec<String>

Canonical syntactic paths of policy types selected by generated fields, sorted and deduplicated for deterministic diagnostics.

§

#[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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message_name: String

Fully-qualified proto name of the affected message.

§assignments: Vec<(String, String)>

(proto_name, final_rust_name) for each adjusted member, sorted by proto name.

§

#[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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§message_name: String

Fully-qualified proto name of the affected message.

§assignments: Vec<(String, String)>

(proto_name, final_rust_name) for each adjusted member, sorted by proto name.

§

#[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_package plugin directive or the .exclude_package(…) call, or add the missing .proto files to the generate set), or
  • Adding an extern_path mapping 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
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§file_name: String

The proto file that contains the referencing field, e.g. "path/to/service.proto".

§message_name: String

The 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.

§field_name: String

The name of the field that holds the dangling reference.

§ref_package: String

The proto package that owns the referenced type, e.g. "buf.validate".

§type_fqn: String

The 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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§package: String

The normalized package entry that matched nothing (leading dot already stripped).

§

#[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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String

The rule’s path as configured (post-normalization).

§feature: &'static str

The overridden feature’s name (e.g. "enum_type").

§value: &'static str

The override value (e.g. "OPEN").

§

#[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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String

The rule’s path as configured.

§

#[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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String

The rule’s path as configured.

§

#[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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String

The rule’s path as configured.

§

#[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.

The Display text names the rule by its kind and the buffa-build methods (the bytes, string and repeated *_custom_in ones are also the protoc-gen-buffa option names), not by the CodeGenConfig list, and does not name a front end, so it reads the same from either.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String

The rule’s path as it is in the CodeGenConfig list (buffa-build or protoc-gen-buffa has normalized it).

§option: &'static str

The CodeGenConfig list that contains the rule: "bytes_fields", "string_fields", "map_fields" or "repeated_fields".

§matches_ungenerated: bool

Whether the rule matches a field of a message that this call does not generate: one in an imported file, or in a package under extern_path or exclude_packages. The Display text then says so, in place of the path hint.

§names_extension: bool

Whether the rule names an extension field (or a scope that holds only extension fields). Field-type rules never apply to extensions, which keep their default Rust type; the Display text then says so, in place of the path hint. When matches_ungenerated is also set, the text gives that reason instead.

§

#[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 enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§rule: String

The rule’s path as configured.

§

#[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
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§fallbacks: usize

The number of messages that fell back.

§selected: usize

The number of messages selected for the table.

§reasons: Vec<TableCodecFallbackReason>

Why they fell back, most common reason first.

Trait Implementations§

Source§

impl Clone for CodeGenWarning

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CodeGenWarning

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CodeGenWarning

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CodeGenWarning

Source§

impl PartialEq for CodeGenWarning

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CodeGenWarning

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.