Skip to main content

ErrorList

Struct ErrorList 

Source
pub struct ErrorList { /* private fields */ }
Expand description

The error list: an ordered set of entries plus a cursor (index) into them. :cnext / ]q walk the index (wrapping vim-style); :cc N jumps to the Nth (1-based). Empty by default.

EP.1 (2026-08-10): entries are held as per-source slices, not one flat vec, and a producer’s write replaces only its own slice. The flat view every consumer reads (Self::entries) is the concatenation in ErrorSource::PRESENTATION_ORDER, each slice keeping its producer’s own ordering.

Two producers on one untagged list is a clobber: the language server republishes on every edit-debounce, so its feed would wipe a compile run’s entries while the user walked them. Sorting the merged list instead of concatenating was rejected — producer order is information (rustc emits the root cause before the cascade).

See docs/dev/architecture/error-list.md §3.1.

Implementations§

Source§

impl ErrorList

Source

pub fn new() -> Self

Source

pub fn set(&mut self, source: ErrorSource, entries: Vec<ErrorEntry>)

Replace source’s entries for a new run, leaving every other source’s alone.

This is the producer entry point (compilation / LSP call it via crate::editor::Editor::set_error_list). An empty entries clears just that source’s run — which is what a fresh compile with no errors means, and it must not disturb the language server’s diagnostics sitting alongside.

Resets the index to 0, which is what a new run means: the user asked for fresh results and expects to start at the top. For a refresh of an existing feed use Self::refresh — resetting there would throw a user walking entry 7 back to entry 1 every time they typed.

Source

pub fn refresh(&mut self, source: ErrorSource, entries: Vec<ErrorEntry>)

EP.2 (2026-08-10): replace source’s entries the way a live feed does — keeping the user where they were.

The distinction from Self::set is the producer’s to declare, never inferred from the data: a language server republishing after a keystroke is a refresh, a compile run is a new run, and the two are indistinguishable by looking at the entries. Without this, the default-on diagnostic feed would make :cnext unusable — which is precisely the experience someone would set lsp.diagnostics-to-error-list = false to escape.

Re-anchoring, in order: the same entry by (path, message) (tolerant of line drift, since typing above an error moves it); else the first entry of the same path at-or-after the old line; else index 0.

Source

pub fn entries_from(&self, source: ErrorSource) -> &[ErrorEntry]

The entries contributed by one source, or an empty slice when it has none.

Source

pub fn sources(&self) -> Vec<ErrorSource>

Which sources currently contribute entries, in presentation order.

Source

pub fn is_empty(&self) -> bool

Source

pub fn entries(&self) -> &[ErrorEntry]

CM.4 (2026-07-22): read-only slice of the entries. The :copen producer clones these to build the *problems* multibuffer view.

Source

pub fn len(&self) -> usize

Source

pub fn index(&self) -> usize

The 0-based index the list currently points at. Meaningless (returns 0) when the list is empty.

Source

pub fn current(&self) -> Option<&ErrorEntry>

The entry the index currently points at, or None when the list is empty.

Source

pub fn step(&mut self, delta: i64) -> Option<&ErrorEntry>

Move the index by delta, wrapping vim-style (:cnext past the last entry wraps to the first; :cprev past the first wraps to the last), and return the entry now under the index. None only when the list is empty.

Source

pub fn jump_to(&mut self, n: Option<usize>) -> Option<&ErrorEntry>

Jump to the nth entry (1-based, vim :cc N). n == None (bare :cc) keeps the current index and returns the current entry. An out-of-range n (0, or past the end) leaves the index unchanged and returns None.

Source

pub fn set_index_to_matching(&mut self, path: &Path, line: u32) -> bool

CM.3b: point the index at the first entry whose (path, line) matches, returning true when one was found (index moved) and false otherwise (index unchanged). Used by the <CR>-jump in *compilation* to sync the error cursor to the entry the user jumped to. Match is on path + 0-based line only — column is ignored so a jump to a line with several column- distinct diagnostics selects the first at that line.

Source

pub fn step_file(&mut self, delta: i64) -> Option<&ErrorEntry>

CM.7: move to the first entry of the next (delta > 0) or previous (delta < 0) file, wrapping vim-style, and return the entry now under the index. :cnextfile (delta = 1) / :cprevfile (delta = -1); a count moves that many files.

A “file” is a maximal run of consecutive entries sharing a path (compiler / tool output groups a file’s locations together; the parser preserves that order). Both directions land on the first entry of the target file — symmetric and intuitive (vim’s :cpfile technically lands on the last entry of the previous file; we deliberately land on the first so a following :cnext walks that file top-to-bottom). None only when the list is empty.

Source

pub fn first(&mut self) -> Option<&ErrorEntry>

Jump to the first entry (:cfirst). None when empty.

Source

pub fn last(&mut self) -> Option<&ErrorEntry>

Jump to the last entry (:clast). None when empty.

Trait Implementations§

Source§

impl Clone for ErrorList

Source§

fn clone(&self) -> ErrorList

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 ErrorList

Source§

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

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

impl Default for ErrorList

Source§

fn default() -> ErrorList

Returns the “default value” for a type. Read more
Source§

impl Eq for ErrorList

Source§

impl PartialEq for ErrorList

Source§

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

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoMaybeUndefined<T> for T

§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
§

impl<T> IntoOption<T> for T

§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Pointer = u32

§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more