Skip to main content

MethodCatalogError

Enum MethodCatalogError 

Source
pub enum MethodCatalogError {
    Duplicate {
        receiver: TypePattern,
        name: &'static str,
        arity: usize,
    },
    ConflictingBound {
        method: &'static str,
        var: &'static str,
        first: Bound,
        second: Bound,
    },
    AmbiguousWithIterable {
        receiver: TypePattern,
        name: &'static str,
        arity: usize,
    },
    AmbiguousIterablePair {
        name: &'static str,
        arity: usize,
    },
    IterableOutsideReceiver {
        method: &'static str,
        arity: usize,
    },
}
Expand description

Errors that can occur while building a MethodCatalog.

Variants§

§

Duplicate

Two entries share the same (receiver, name, arity) triple. Overloads are not permitted; this is a build-time catalog bug.

Fields

§receiver: TypePattern
§name: &'static str
§arity: usize
§

ConflictingBound

One entry declares two different bounds for the same type variable. A bound is a fact about the variable, so the row is asking for two incompatible things and whichever the checker happened to read first would win silently.

Fields

§method: &'static str
§var: &'static str
§first: Bound
§second: Bound
§

AmbiguousWithIterable

A concrete-receiver row shares a (name, arity) with a generic TypePattern::Iterable row, on a receiver the generic one accepts (ADR-127 decision 1).

Both spellings would match at the call site, and the catalog’s key is (receiver, name, arity) — so the two are not duplicates and nothing would refuse them; whichever came first in insertion order would win. That is a precedence rule, and a precedence rule is what makes “which does this call resolve to” a question at all (decision 6). The check scopes to PIPELINE_RECEIVERS deliberately: a Grid[T].map/1 beside Iterable.map/1 is allowed, because Grid is not one of the ten and §6.4 asks for that row by name.

Fields

§receiver: TypePattern
§name: &'static str
§arity: usize
§

AmbiguousIterablePair

Two generic TypePattern::Iterable rows share a (name, arity), differing only in what they bound their item to (ADR-144).

This is AmbiguousWithIterable’s blind spot — join for a sequence of Text beside join for a sequence of Char. The pair is not a Duplicate, because the receivers differ; it is not a shadowing, because neither row is the concrete one. But praxis_hir::catalog::lookup matches an Iterable receiver on shape, so both hit and inference takes the first — which is a precedence rule by insertion order, exactly what ADR-127 decision 6 refuses. A sequence of Char gets a differently-named row instead.

Fields

§name: &'static str
§arity: usize
§

IterableOutsideReceiver

A row writes TypePattern::Iterable somewhere other than its receiver (ADR-127 decision 1).

The receiver generalizes; two parameters must not. zip’s argument is a Vec[U] and flat_map’s closure answers one, and the fused loop indexes both with praxis_vec_len/praxis_vec_get directly — neither has an IterPlan in scope, because neither is the source. Generalizing either would put a SetPayload under praxis_vec_get, which is the exact wrong-type read IterPlan exists to prevent. The pipeline generalizes over what it walks, not over every sequence a row mentions.

The rule is also what makes the instantiation path total: an Iterable names ten types, so pattern_to_type has no answer for one, and the receiver is the one position that never asks it for an answer.

Fields

§method: &'static str
§arity: usize

Trait Implementations§

Source§

impl Clone for MethodCatalogError

Source§

fn clone(&self) -> MethodCatalogError

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 MethodCatalogError

Source§

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

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

impl Display for MethodCatalogError

Source§

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

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

impl Eq for MethodCatalogError

Source§

impl Error for MethodCatalogError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for MethodCatalogError

Source§

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

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.