diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-07-11 15:19:32 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-11 15:19:32 +0530 |
| commit | 9fc297a2aefe141951994bec9ebd74733fed1623 (patch) | |
| tree | 54d1d5d1a9a557a838d25f18d1ad822c8a4b3985 /compiler/rustc_const_eval/src/transform | |
| parent | 93f71d4e012df4477a34e911f8734c545b6bca2f (diff) | |
| parent | 018155c3a218b819b70d1dc57b08fe3bc7b2ec3c (diff) | |
| download | rust-9fc297a2aefe141951994bec9ebd74733fed1623.tar.gz rust-9fc297a2aefe141951994bec9ebd74733fed1623.zip | |
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.
Diffstat (limited to 'compiler/rustc_const_eval/src/transform')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/ops.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs index 17376e59e09..1d083b0bf82 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -299,7 +299,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { err.note(&format!("attempting to deref into `{}`", deref_target_ty)); // Check first whether the source is accessible (issue #87060) - if tcx.sess.source_map().span_to_snippet(deref_target).is_ok() { + if tcx.sess.source_map().is_span_accessible(deref_target) { err.span_note(deref_target, "deref defined here"); } |
