# Function rustc_resolve::diagnostics::reduce_impl_span_to_impl_keyword

source ·

    fn reduce_impl_span_to_impl_keyword(sm: &SourceMap, impl_span: Span) -> Span

Expand description

Adjust the impl span so that just the `impl` keyword is taken by removing everything after `<` (`"impl<T> Iterator for A<T> {}" -> "impl"`) and everything after the first whitespace (`"impl Iterator for A" -> "impl"`).

Attention: the method used is very fragile since it essentially duplicates the work of the parser. If you need to use this function or something similar, please consider updating the `source_map` functions and this function to something more robust.