rename a method

This commit is contained in:
Takayuki Maeda 2022-07-11 16:51:19 +09:00
parent 12d11e9a35
commit 018155c3a2
9 changed files with 10 additions and 10 deletions

View file

@ -309,7 +309,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
)); ));
// Check first whether the source is accessible (issue #87060) // Check first whether the source is accessible (issue #87060)
if self.infcx.tcx.sess.source_map().is_accessible_span(deref_target) { if self.infcx.tcx.sess.source_map().is_span_accessible(deref_target) {
err.span_note(deref_target, "deref defined here"); err.span_note(deref_target, "deref defined here");
} }
} }

View file

@ -975,7 +975,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
if self.fn_self_span_reported.insert(fn_span) { if self.fn_self_span_reported.insert(fn_span) {
err.span_note( err.span_note(
// Check whether the source is accessible // Check whether the source is accessible
if self.infcx.tcx.sess.source_map().is_accessible_span(self_arg.span) { if self.infcx.tcx.sess.source_map().is_span_accessible(self_arg.span) {
self_arg.span self_arg.span
} else { } else {
fn_call_span fn_call_span

View file

@ -299,7 +299,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
err.note(&format!("attempting to deref into `{}`", deref_target_ty)); err.note(&format!("attempting to deref into `{}`", deref_target_ty));
// Check first whether the source is accessible (issue #87060) // Check first whether the source is accessible (issue #87060)
if tcx.sess.source_map().is_accessible_span(deref_target) { if tcx.sess.source_map().is_span_accessible(deref_target) {
err.span_note(deref_target, "deref defined here"); err.span_note(deref_target, "deref defined here");
} }

View file

@ -1558,7 +1558,7 @@ pub fn add_elided_lifetime_in_path_suggestion(
insertion_span: Span, insertion_span: Span,
) { ) {
diag.span_label(path_span, format!("expected lifetime parameter{}", pluralize!(n))); diag.span_label(path_span, format!("expected lifetime parameter{}", pluralize!(n)));
if !source_map.is_accessible_span(insertion_span) { if !source_map.is_span_accessible(insertion_span) {
// Do not try to suggest anything if generated by a proc-macro. // Do not try to suggest anything if generated by a proc-macro.
return; return;
} }

View file

@ -432,7 +432,7 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
"`let` bindings require an \"irrefutable pattern\", like a `struct` or \ "`let` bindings require an \"irrefutable pattern\", like a `struct` or \
an `enum` with only one variant", an `enum` with only one variant",
); );
if self.tcx.sess.source_map().is_accessible_span(span) { if self.tcx.sess.source_map().is_span_accessible(span) {
let semi_span = span.shrink_to_hi().with_lo(span.hi() - BytePos(1)); let semi_span = span.shrink_to_hi().with_lo(span.hi() - BytePos(1));
let start_span = span.shrink_to_lo(); let start_span = span.shrink_to_lo();
let end_span = semi_span.shrink_to_lo(); let end_span = semi_span.shrink_to_lo();

View file

@ -1650,7 +1650,7 @@ impl<'a> Resolver<'a> {
fn binding_description(&self, b: &NameBinding<'_>, ident: Ident, from_prelude: bool) -> String { fn binding_description(&self, b: &NameBinding<'_>, ident: Ident, from_prelude: bool) -> String {
let res = b.res(); let res = b.res();
if b.span.is_dummy() || !self.session.source_map().is_accessible_span(b.span) { 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. // These already contain the "built-in" prefix or look bad with it.
let add_built_in = let add_built_in =
!matches!(b.res(), Res::NonMacroAttr(..) | Res::PrimTy(..) | Res::ToolMod); !matches!(b.res(), Res::NonMacroAttr(..) | Res::PrimTy(..) | Res::ToolMod);

View file

@ -597,7 +597,7 @@ impl SourceMap {
local_begin.sf.src.is_some() && local_end.sf.src.is_some() local_begin.sf.src.is_some() && local_end.sf.src.is_some()
} }
pub fn is_accessible_span(&self, sp: Span) -> bool { pub fn is_span_accessible(&self, sp: Span) -> bool {
self.span_to_source(sp, |src, start_index, end_index| { self.span_to_source(sp, |src, start_index, end_index| {
Ok(src.get(start_index..end_index).is_some()) Ok(src.get(start_index..end_index).is_some())
}) })

View file

@ -760,7 +760,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Some(call_span) = if let Some(call_span) =
iter::successors(Some(expr.span), |s| s.parent_callsite()) iter::successors(Some(expr.span), |s| s.parent_callsite())
.find(|&s| sp.contains(s)) .find(|&s| sp.contains(s))
&& sm.is_accessible_span(call_span) && sm.is_span_accessible(call_span)
{ {
return Some(( return Some((
sp.with_hi(call_span.lo()), sp.with_hi(call_span.lo()),
@ -773,7 +773,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
return None; return None;
} }
if sp.contains(expr.span) if sp.contains(expr.span)
&& sm.is_accessible_span(expr.span) && sm.is_span_accessible(expr.span)
{ {
return Some(( return Some((
sp.with_hi(expr.span.lo()), sp.with_hi(expr.span.lo()),

View file

@ -812,7 +812,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
/// Builds the `type defined here` message. /// Builds the `type defined here` message.
fn show_definition(&self, err: &mut Diagnostic) { fn show_definition(&self, err: &mut Diagnostic) {
let mut spans: MultiSpan = if let Some(def_span) = self.tcx.def_ident_span(self.def_id) { let mut spans: MultiSpan = if let Some(def_span) = self.tcx.def_ident_span(self.def_id) {
if self.tcx.sess.source_map().is_accessible_span(def_span) { if self.tcx.sess.source_map().is_span_accessible(def_span) {
def_span.into() def_span.into()
} else { } else {
return; return;