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
impl ErrorList
pub fn new() -> Self
Sourcepub fn set(&mut self, source: ErrorSource, entries: Vec<ErrorEntry>)
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.
Sourcepub fn refresh(&mut self, source: ErrorSource, entries: Vec<ErrorEntry>)
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.
Sourcepub fn entries_from(&self, source: ErrorSource) -> &[ErrorEntry]
pub fn entries_from(&self, source: ErrorSource) -> &[ErrorEntry]
The entries contributed by one source, or an empty slice when it has none.
Sourcepub fn sources(&self) -> Vec<ErrorSource>
pub fn sources(&self) -> Vec<ErrorSource>
Which sources currently contribute entries, in presentation order.
pub fn is_empty(&self) -> bool
Sourcepub fn entries(&self) -> &[ErrorEntry]
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.
pub fn len(&self) -> usize
Sourcepub fn index(&self) -> usize
pub fn index(&self) -> usize
The 0-based index the list currently points at. Meaningless (returns 0) when the list is empty.
Sourcepub fn current(&self) -> Option<&ErrorEntry>
pub fn current(&self) -> Option<&ErrorEntry>
The entry the index currently points at, or None when the
list is empty.
Sourcepub fn step(&mut self, delta: i64) -> Option<&ErrorEntry>
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.
Sourcepub fn jump_to(&mut self, n: Option<usize>) -> Option<&ErrorEntry>
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.
Sourcepub fn set_index_to_matching(&mut self, path: &Path, line: u32) -> bool
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.
Sourcepub fn step_file(&mut self, delta: i64) -> Option<&ErrorEntry>
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.
Sourcepub fn first(&mut self) -> Option<&ErrorEntry>
pub fn first(&mut self) -> Option<&ErrorEntry>
Jump to the first entry (:cfirst). None when empty.
Sourcepub fn last(&mut self) -> Option<&ErrorEntry>
pub fn last(&mut self) -> Option<&ErrorEntry>
Jump to the last entry (:clast). None when empty.
Trait Implementations§
impl Eq for ErrorList
impl StructuralPartialEq for ErrorList
Auto Trait Implementations§
impl Freeze for ErrorList
impl RefUnwindSafe for ErrorList
impl Send for ErrorList
impl Sync for ErrorList
impl Unpin for ErrorList
impl UnsafeUnpin for ErrorList
impl UnwindSafe for ErrorList
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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