pub struct DirectCallArgMismatch {
pub range: TextRange,
pub callee: String,
pub index: usize,
pub expected: Ty,
pub found: Ty,
}Expand description
One statically-checkable argument-type mismatch recorded at any of
three producer sites whose callee resolves straight to a known def via
known_sigs — so its declared parameter types are already fully known
at the site — unlike the T1c call-through-a-value case
ValueCallFact exists for:
- a direct call (issue #1864) —
f(a, b)wherefnames a known knot/stitch/function directly; - a
#fn(target, args…)creation site (issue #2001) — not a call at all, but the by-ref binding site for a partial application;target’s remaining (unbound) params still go through the ordinary call-through-a-value check when the resultingTy::Fnvalue is later invoked, but the bound prefix checked here is only ever checkable at creation. - a divert with arguments (issue #2127) —
-> knot(a, b)— also not a call expression, but arefposition it binds is checked exactly like a direct call’srefargument (invariant, viaref_assignable). By-value positions at this site are not checked yet (#2127 scoped that out as its own design call, same posture #2001 took forinfer_fn_literal’s by-value params).
strict::check_direct_call_args’s rendered message reads “argument N
of call to name” for all three producers — accepted as-is for a #fn
literal and a divert target too (both still name the target function’s
own parameter being populated), rather than adding a site-discriminant
field to distinguish “creation of” / “divert to” from “call to”;
revisit if that reads as confusing in practice (#2001 review finding).
Fields§
§range: TextRangeThe diagnostic site’s source range: the callee Path’s own range
for a direct call (same convention as ValueCallFact::range), the
#fn literal’s target path range for a creation site, or the
divert’s own target path range (issue #2127).
callee: StringThe callee’s display name (h in h("hi"); dotted if the resolved
path had multiple segments, e.g. Knot.stitch).
index: usizeThe mismatched argument’s 0-based position.
expected: TyThe callee’s declared parameter type at index.
found: TyThe argument expression’s statically classified type.
Trait Implementations§
Source§impl Clone for DirectCallArgMismatch
impl Clone for DirectCallArgMismatch
Source§fn clone(&self) -> DirectCallArgMismatch
fn clone(&self) -> DirectCallArgMismatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DirectCallArgMismatch
impl Debug for DirectCallArgMismatch
impl Eq for DirectCallArgMismatch
Source§impl PartialEq for DirectCallArgMismatch
impl PartialEq for DirectCallArgMismatch
impl StructuralPartialEq for DirectCallArgMismatch
Auto Trait Implementations§
impl Freeze for DirectCallArgMismatch
impl RefUnwindSafe for DirectCallArgMismatch
impl Send for DirectCallArgMismatch
impl Sync for DirectCallArgMismatch
impl Unpin for DirectCallArgMismatch
impl UnsafeUnpin for DirectCallArgMismatch
impl UnwindSafe for DirectCallArgMismatch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.