@@ -70,22 +70,23 @@ pub fn validate_id(s: &str) -> anyhow::Result<()> {
7070/// Renders an [`anyhow::Error`] chain produced by this crate, substituting
7171/// snippet-bearing output for any [`ResolveError`] or [`ParseError`] layers.
7272///
73- /// For each layer in the chain, this calls [`ResolveError::highlight `] or
74- /// [`ParseError::highlight `] to format typed errors with file/line/column and
73+ /// For each layer in the chain, this calls [`ResolveError::render `] or
74+ /// [`ParseError::render `] to format typed errors with file/line/column and
7575/// a source snippet. Other layers are formatted via their [`fmt::Display`]
7676/// impl. Layers are joined with `": "`, matching `format!("{err:#}")`.
7777///
7878/// `source_map` must be the [`SourceMap`] in which every typed error's spans
7979/// are valid; combining typed errors from different source maps in one chain
80- /// is unsupported.
80+ /// is unsupported. For errors from [`Resolve`] methods, prefer
81+ /// [`Resolve::render_error`].
8182#[ cfg( feature = "std" ) ]
8283pub fn render_anyhow_error ( err : & anyhow:: Error , source_map : & SourceMap ) -> String {
8384 err. chain ( )
8485 . map ( |layer| {
8586 if let Some ( re) = layer. downcast_ref :: < ResolveError > ( ) {
86- re. highlight ( source_map)
87+ re. render ( source_map)
8788 } else if let Some ( pe) = layer. downcast_ref :: < ParseError > ( ) {
88- pe. highlight ( source_map)
89+ pe. render ( source_map)
8990 } else {
9091 layer. to_string ( )
9192 }
@@ -328,7 +329,7 @@ impl UnresolvedPackageGroup {
328329 ///
329330 /// On failure the constructed [`SourceMap`] is returned alongside the
330331 /// typed [`ParseError`] so the caller can render a snippet via
331- /// [`ParseError::highlight `] or merge the source map elsewhere.
332+ /// [`ParseError::render `] or merge the source map elsewhere.
332333 #[ cfg( feature = "std" ) ]
333334 pub fn parse (
334335 path : impl AsRef < Path > ,
@@ -350,7 +351,7 @@ impl UnresolvedPackageGroup {
350351 let mut map = SourceMap :: default ( ) ;
351352 map. push_dir ( path. as_ref ( ) ) ?;
352353 map. parse ( ) . map_err ( |( map, e) | {
353- let rendered = e. highlight ( & map) ;
354+ let rendered = e. render ( & map) ;
354355 anyhow:: Error :: from ( e) . context ( rendered)
355356 } )
356357 }
0 commit comments