diff --git a/console/src/main.rs b/console/src/main.rs index 862849e0..aaab7e11 100644 --- a/console/src/main.rs +++ b/console/src/main.rs @@ -47,9 +47,10 @@ async fn main() -> color_eyre::Result<()> { let mut tasks = State::default() // TODO(eliza): allow configuring the list of linters via the // CLI/possibly a config file? - .with_linters(vec![warnings::Linter::new( - warnings::SelfWakePercent::default(), - )]); + .with_linters(vec![ + warnings::Linter::new(warnings::SelfWakePercent::default()), + warnings::Linter::new(warnings::LostWaker), + ]); let mut input = input::EventStream::new(); let mut view = view::View::new(styles); diff --git a/console/src/warnings.rs b/console/src/warnings.rs index 5de86c66..9f5c014a 100644 --- a/console/src/warnings.rs +++ b/console/src/warnings.rs @@ -133,3 +133,20 @@ impl Warn for SelfWakePercent { ) } } + +#[derive(Clone, Debug, Default)] +pub(crate) struct LostWaker; + +impl Warn for LostWaker { + fn summary(&self) -> &str { + "tasks have lost their waker" + } + + fn check(&self, task: &Task) -> bool { + !task.is_completed() && task.waker_count() == 0 + } + + fn format(&self, _: &Task) -> String { + "This task has lost its waker, and will never be woken again.".into() + } +}