pub struct Origin {
pub reason: Reason,
pub span: NodeSpan,
/* private fields */
}Expand description
Where a constraint came from, and — once inference has moved types around — where each of its two types came from.
Fields§
§reason: ReasonWhy the two types were required to match.
span: NodeSpanThe source text this constraint is about. A failure here draws its caret at this span.
Implementations§
Source§impl Origin
impl Origin
Sourcepub fn explanation(&self) -> Option<Cause>
pub fn explanation(&self) -> Option<Cause>
Where the type this constraint clashed on came from, when the constraint is not itself where it came from.
This is what a diagnostic’s secondary label and its rule note are both read
off. The left side is preferred because that is the declared or expected side
by convention (see Constraint), so “expected because of …” reads about the
right one; the right side answers when only it was rewritten.
Trait Implementations§
impl StructuralPartialEq for Origin
Auto Trait Implementations§
impl Freeze for Origin
impl RefUnwindSafe for Origin
impl Send for Origin
impl Sync for Origin
impl Unpin for Origin
impl UnsafeUnpin for Origin
impl UnwindSafe for Origin
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
Mutably borrows from an owned value. Read more