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_errors/src | |
| 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_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index ffe4ecebb2e..e59a74e380a 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1558,7 +1558,7 @@ pub fn add_elided_lifetime_in_path_suggestion( insertion_span: Span, ) { diag.span_label(path_span, format!("expected lifetime parameter{}", pluralize!(n))); - if source_map.span_to_snippet(insertion_span).is_err() { + if !source_map.is_span_accessible(insertion_span) { // Do not try to suggest anything if generated by a proc-macro. return; } |
