pub trait UnificationErrorExt<T>: Sized {
// Required methods
fn add_context(
self,
got: TypeVarID,
expected: TypeVarID,
) -> Result<T, UnificationError>;
fn into_diagnostic_impl<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
omit_expected_source: bool,
message: F,
type_state: &TypeState,
) -> Result<T, Diagnostic>
where F: Fn(Diagnostic, TypeMismatch) -> Diagnostic;
// Provided methods
fn into_default_diagnostic(
self,
unification_point: impl Into<FullSpan> + Clone,
type_state: &TypeState,
) -> Result<T, Diagnostic> { ... }
fn into_diagnostic_or_default<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
message: Option<F>,
type_state: &TypeState,
) -> Result<T, Diagnostic>
where F: Fn(Diagnostic, TypeMismatch) -> Diagnostic { ... }
fn into_diagnostic<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
message: F,
type_state: &TypeState,
) -> Result<T, Diagnostic>
where F: Fn(Diagnostic, TypeMismatch) -> Diagnostic { ... }
fn into_diagnostic_no_expected_source<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
message: F,
type_state: &TypeState,
) -> Result<T, Diagnostic>
where F: Fn(Diagnostic, TypeMismatch) -> Diagnostic { ... }
}
Required Methods§
fn add_context( self, got: TypeVarID, expected: TypeVarID, ) -> Result<T, UnificationError>
fn into_diagnostic_impl<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
omit_expected_source: bool,
message: F,
type_state: &TypeState,
) -> Result<T, Diagnostic>where
F: Fn(Diagnostic, TypeMismatch) -> Diagnostic,
Provided Methods§
Sourcefn into_default_diagnostic(
self,
unification_point: impl Into<FullSpan> + Clone,
type_state: &TypeState,
) -> Result<T, Diagnostic>
fn into_default_diagnostic( self, unification_point: impl Into<FullSpan> + Clone, type_state: &TypeState, ) -> Result<T, Diagnostic>
Creates a diagnostic with a generic type mismatch error
Sourcefn into_diagnostic_or_default<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
message: Option<F>,
type_state: &TypeState,
) -> Result<T, Diagnostic>where
F: Fn(Diagnostic, TypeMismatch) -> Diagnostic,
fn into_diagnostic_or_default<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
message: Option<F>,
type_state: &TypeState,
) -> Result<T, Diagnostic>where
F: Fn(Diagnostic, TypeMismatch) -> Diagnostic,
Creates a diagnostic with a generic type mismatch error
Sourcefn into_diagnostic<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
message: F,
type_state: &TypeState,
) -> Result<T, Diagnostic>where
F: Fn(Diagnostic, TypeMismatch) -> Diagnostic,
fn into_diagnostic<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
message: F,
type_state: &TypeState,
) -> Result<T, Diagnostic>where
F: Fn(Diagnostic, TypeMismatch) -> Diagnostic,
Creates a diagnostic from the unification error that will be emitted at the unification point, unless the unification error was caused by constraints, at which point the source of those constraints will be the location of the error. If trait constraints were not met, a default message will be provided at the unification point
fn into_diagnostic_no_expected_source<F>(
self,
unification_point: impl Into<FullSpan> + Clone,
message: F,
type_state: &TypeState,
) -> Result<T, Diagnostic>where
F: Fn(Diagnostic, TypeMismatch) -> Diagnostic,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.