Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-dead
Implement `SourceMap::is_span_accessible` This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.
This commit is contained in:
commit
9fc297a2ae
9 changed files with 16 additions and 16 deletions
|
@ -1647,7 +1647,7 @@ impl<'a> Resolver<'a> {
|
|||
|
||||
fn binding_description(&self, b: &NameBinding<'_>, ident: Ident, from_prelude: bool) -> String {
|
||||
let res = b.res();
|
||||
if b.span.is_dummy() || self.session.source_map().span_to_snippet(b.span).is_err() {
|
||||
if b.span.is_dummy() || !self.session.source_map().is_span_accessible(b.span) {
|
||||
// These already contain the "built-in" prefix or look bad with it.
|
||||
let add_built_in =
|
||||
!matches!(b.res(), Res::NonMacroAttr(..) | Res::PrimTy(..) | Res::ToolMod);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue