about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2021-03-14 14:39:13 -0700
committerCamelid <camelidcamel@gmail.com>2021-03-14 14:39:25 -0700
commit8f40e1180f65bdf7e88baa4bcc03d24baded9fca (patch)
tree98f00762e59397a12178c8ecb16a4d449bd17d39 /compiler/rustc_passes/src
parent13076f90d2febedd44d395561b0ec844cac64f8b (diff)
downloadrust-8f40e1180f65bdf7e88baa4bcc03d24baded9fca.tar.gz
rust-8f40e1180f65bdf7e88baa4bcc03d24baded9fca.zip
Use pretty-printer instead of `span_to_snippet`
Diffstat (limited to 'compiler/rustc_passes/src')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 2edc2315f05..98771c91958 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -597,13 +597,10 @@ impl CheckAttrVisitor<'tcx> {
                                 hir_id,
                                 i_meta.span,
                                 |lint| {
-                                    let msg = if let Ok(snippet) =
-                                        self.tcx.sess.source_map().span_to_snippet(i_meta.path.span)
-                                    {
-                                        format!("unknown `doc` attribute `{}`", snippet,)
-                                    } else {
-                                        String::from("unknown `doc` attribute")
-                                    };
+                                    let msg = format!(
+                                        "unknown `doc` attribute `{}`",
+                                        rustc_ast_pretty::pprust::path_to_string(&i_meta.path),
+                                    );
                                     lint.build(&msg).emit();
                                 },
                             );