rust-lang/rust-analyzer · critical
not implemented
Error message
not implemented
What it means
AbsPath::display() in the paths crate is a deliberate trap: it always panics with 'not implemented' and never returns. It exists only so that code accidentally calling the old Path::display()-style API fails loudly at runtime, pushing users toward the Display trait implementation instead. The function is also marked #[deprecated] to catch uses at compile time.
Source
Thrown at crates/paths/src/lib.rs:300
pub fn file_name(&self) -> Option<&str> {
self.0.file_name()
}
pub fn extension(&self) -> Option<&str> {
self.0.extension()
}
pub fn file_stem(&self) -> Option<&str> {
self.0.file_stem()
}
pub fn as_os_str(&self) -> &OsStr {
self.0.as_os_str()
}
pub fn as_str(&self) -> &str {
self.0.as_str()
}
#[deprecated(note = "use Display instead")]
pub fn display(&self) -> ! {
unimplemented!()
}
#[deprecated(note = "use std::fs::metadata().is_ok() instead")]
pub fn exists(&self) -> ! {
unimplemented!()
}
pub fn components(&self) -> Utf8Components<'_> {
self.0.components()
}
// endregion:delegate-methods
}
impl fmt::Display for AbsPath {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.0, f)
}
}
View on GitHub (pinned to e8f7e90aa3)
Solutions
- Replace .display() with the Display trait, e.g. format!("{}", path) or write!(out, "{}", path)
- Use path.as_str() when a &str is needed
- Fix the deprecation warning so the call is removed before shipping
Example fix
// before
println!("{}", abs_path.display());
// after
println!("{}", abs_path); // or abs_path.as_str() Defensive patterns
Strategy: try-catch
Try / catch
// This panics and cannot be caught; fix at the source. // Avoid: path.display() // Use instead: let s: &str = path.as_str(); let rendered: String = path.to_string(); // via Display
Prevention
- Deny deprecation warnings (#![deny(deprecated)]) so calls fail at compile time
- Use Display formatting (format!/println!) for AbsPath values
- Use as_str() when a &str is needed
- Never port std::path::Path method calls mechanically onto AbsPath
When it happens
Trigger: Calling abs_path.display() on an AbsPath/AbsPathBuf value in any code linked against this crate; compiling with the deprecation warning ignored (deny nothing) and running the code path that calls it.
Common situations: Migrating code from std::path::PathBuf to AbsPathBuf and mechanically keeping .display() calls; following older rust-analyzer example code that predates the Display-based API.
Related errors
- We explicitly do not provide canonicalization API, as that i
- bad kind {other}
- bad spacing {other}
- bad tag: {other}
- profiler already started
AI-assisted analysis of rust-lang/rust-analyzer@e8f7e90aa3 (2026-09-03).
Data as JSON: /api/errors/9f7012cab50d7601.
Report an issue: GitHub.