Skip to main content

UfcsVerdict

Enum UfcsVerdict 

Source
pub enum UfcsVerdict {
    FieldCall {
        receiver: Ty,
        field: String,
        field_ty: Ty,
        arity_mismatch: Option<UfcsArityMismatch>,
        arg_mismatches: Vec<UfcsArgMismatch>,
    },
    FreeFnAutoRef {
        receiver: Ty,
        name: String,
        target: DefinitionId,
        arg_mismatches: Vec<UfcsArgMismatch>,
    },
    FreeFnDesugar {
        receiver: Ty,
        name: String,
        target: DefinitionId,
        arg_mismatches: Vec<UfcsArgMismatch>,
    },
    PreludeDesugar {
        receiver: Ty,
        name: String,
        arg_mismatches: Vec<UfcsArgMismatch>,
    },
}
Expand description

What one recv.name(args) call site resolved to (D2’s “node → resolved target”). Consumed by LIR lowering — which of the two code shapes to emit — and by IDE hover/go-to-def, which needs the real target rather than the receiver the ResolutionMap records for the callee path.

Variants§

§

FieldCall

Field access won (step 2): the receiver’s type declares a function-typed field with the called name, so the call is a call through that field’s value.

Fields

§receiver: Ty

The receiver’s inferred type.

§field: String

The field name — the call’s final pre-( path segment.

§field_ty: Ty

The field’s declared type. Always a Ty::Fn — a non-callable match is E140, never a verdict.

§arity_mismatch: Option<UfcsArityMismatch>

Issue #1918: this verdict’s own arity fact. Unlike Self::FreeFnDesugar/Self::FreeFnAutoRef, a field call has no receiver-prepending desugar — npc.on_greet(3) lowers straight to lir::ExprKind::CallValue { callee, args } calling the field’s own fn(...) value with the written arguments only (brink_ir::lir::lower::expr::lower_ufcs_call’s FieldCall arm), so a mismatch here is a plain expected/got pair, not a per-argument UfcsArgMismatch. Computed unconditionally alongside this verdict, like every other verdict’s own arg-check fields; reported only by strict mode ([check_strict], E063) — this verdict is structurally strict::check_value_calls’s T1c “call through a function value” domain, just reached via field access, and this reuses that check’s own ValueCallKind::ArityMismatch wording verbatim. Gradual mode relies on the runtime FunctionValueArity fault Opcode::CallValue already raises for every call through a function value — the same bytecode shape this verdict lowers to, so arity is enforced there regardless of static policy.

§arg_mismatches: Vec<UfcsArgMismatch>

Issue #1918: this verdict’s own per-argument type mismatches — the FieldCall sibling of Self::FreeFnDesugar’s own arg_mismatches. Differs from that sibling’s index convention: a field call passes no receiver argument, so index here is 0-based over the written arguments only — matching strict::check_value_calls’s own ValueCallKind::ArgMismatch convention, not UfcsArgMismatch::index’s “receiver counts as 0” default (see that field’s own doc for the exception this carves out). Reported only by strict mode (E063), same gate as arity_mismatch above.

§

FreeFnAutoRef

D5 auto-ref (issue #1462): a free function won (step 3) and its first parameter is declared ref, so the call desugars to name(ref recv, args) — the receiver spelled as an explicit T1e ref-argument/projection, so the callee’s writes land in the receiver’s own cell instead of in a copy.

Only ever recorded for a receiver that can actually be written through ([UfcsVisitor::auto_ref_fault]); anything else is E143.

Fields

§receiver: Ty

The receiver’s inferred type.

§name: String

The free function’s name, as written.

§target: DefinitionId

The definition the desugared call targets.

§arg_mismatches: Vec<UfcsArgMismatch>

Issue #1881: statically-checkable argument-type mismatches between the desugared call name(recv, args) and target’s already-known declared param types, computed unconditionally alongside this verdict — see UfcsArgMismatch’s own doc. Reported only by strict mode ([check_strict], E063).

§

FreeFnDesugar

A free function won (step 3): the call desugars to name(recv, args), by value.

Fields

§receiver: Ty

The receiver’s inferred type.

§name: String

The free function’s name, as written.

§target: DefinitionId

The definition the desugared call targets.

§arg_mismatches: Vec<UfcsArgMismatch>

Issue #1881: identical posture to Self::FreeFnAutoRef’s own arg_mismatches field — the by-value desugar shape.

§

PreludeDesugar

A T1b/NS stdlib prelude name won (step 3, D4’s “file use + prelude” candidate set): the call desugars to name(recv, args) exactly like Self::FreeFnDesugar, but the target is a VM-native intrinsic (resolve::is_t1b_stdlib_name/resolve::is_builtin_function), not an index symbol — there is no DefinitionId to record. xs.len(), inventory.push(sword), a.sort_by(c) all land here.

Fields

§receiver: Ty

The receiver’s inferred type.

§name: String

The prelude function’s name, as written.

§arg_mismatches: Vec<UfcsArgMismatch>

Issue #1919: statically-checkable argument-domain mismatches between the desugared call name(recv, args) and the verb’s own container-projected domain (the receiver’s element/key/ value type — a prelude verb has no DefinitionId and so no declared param list to compare against), computed unconditionally alongside this verdict — see [UfcsVisitor::check_ufcs_prelude_arg_types]’s own doc. Reported only by strict mode ([check_strict], E063), the same code Self::FreeFnDesugar’s own arg_mismatches uses.

Trait Implementations§

Source§

impl Clone for UfcsVerdict

Source§

fn clone(&self) -> UfcsVerdict

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 UfcsVerdict

Source§

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

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

impl Eq for UfcsVerdict

Source§

impl PartialEq for UfcsVerdict

Source§

fn eq(&self, other: &UfcsVerdict) -> 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 UfcsVerdict

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more