Skip to main content

first_unbounded

Function first_unbounded 

Source
pub fn first_unbounded(fields: &'static [Field]) -> Option<UnboundedField>
Expand description

Find the first member that makes fields unbounded, if any.

Returns None exactly when size_bound reports bounded — the two walk the same schema by the same rules, so a type that has a bound has no offender to name and vice versa. That agreement is asserted by test, not assumed: two walks of one schema is the shape the sizes-header mirror defect keeps taking (issues 0088 -> 0268), so the second one exists only because it answers a question the first cannot (WHICH member) and must be checked against it.

The walk is visit_unbounded; this is its “stop at the first one” caller. Reach for visit_unbounded when the diagnostic should name every member a user has to fix, which is what codegen wants now that an unbounded type is a build error (phase-403 W0).

Not const: it recurses through &'static NestedType, and the array bookkeeping is not worth expressing in a const walk when every caller is a diagnostic path.