Struct arithmetic_typing::error::Errors
source · pub struct Errors<Prim: PrimitiveType> { /* private fields */ }
Expand description
List of Error
s.
§Examples
let buggy_code = Annotated::<F32Grammar>::parse_statements(r#"
numbers: ['T; _] = (1, 2, 3);
numbers.filter(|x| x, 1)
"#)?;
let mut env: TypeEnvironment = Prelude::iter().collect();
let errors: Errors<_> = env.process_statements(&buggy_code).unwrap_err();
assert_eq!(errors.len(), 3);
let messages: HashSet<_> = errors.iter().map(ToString::to_string).collect();
assert!(messages
.iter()
.any(|msg| msg.contains("Type param `T` is not scoped by function definition")));
assert!(messages
.contains("3:20: Type `Num` is not assignable to type `Bool`"));
assert!(messages
.contains("3:5: Function expects 2 args, but is called with 3 args"));
Implementations§
source§impl<Prim: PrimitiveType> Errors<Prim>
impl<Prim: PrimitiveType> Errors<Prim>
sourcepub fn iter(&self) -> impl Iterator<Item = &Error<Prim>> + '_
pub fn iter(&self) -> impl Iterator<Item = &Error<Prim>> + '_
Iterates over errors contained in this list.
sourcepub fn first_failing_statement(&self) -> usize
pub fn first_failing_statement(&self) -> usize
Returns the index of the first failing statement within a Block
that has errored.
If the error is in the return value, this index will be equal to the number of statements
in the block.
Trait Implementations§
source§impl<Prim: PrimitiveType> Display for Errors<Prim>
impl<Prim: PrimitiveType> Display for Errors<Prim>
source§impl<Prim: PrimitiveType> Error for Errors<Prim>
impl<Prim: PrimitiveType> Error for Errors<Prim>
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl<Prim: PrimitiveType> IntoIterator for Errors<Prim>
impl<Prim: PrimitiveType> IntoIterator for Errors<Prim>
Auto Trait Implementations§
impl<Prim> Freeze for Errors<Prim>
impl<Prim> !RefUnwindSafe for Errors<Prim>
impl<Prim> Send for Errors<Prim>
impl<Prim> Sync for Errors<Prim>
impl<Prim> Unpin for Errors<Prim>where
Prim: Unpin,
impl<Prim> !UnwindSafe for Errors<Prim>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)