about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock1
-rw-r--r--compiler/rustc_passes/Cargo.toml1
-rw-r--r--compiler/rustc_passes/src/check_attr.rs11
3 files changed, 6 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 25039b5cbd9..ceb3bdc6b22 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4268,6 +4268,7 @@ name = "rustc_passes"
 version = "0.0.0"
 dependencies = [
  "rustc_ast",
+ "rustc_ast_pretty",
  "rustc_attr",
  "rustc_data_structures",
  "rustc_errors",
diff --git a/compiler/rustc_passes/Cargo.toml b/compiler/rustc_passes/Cargo.toml
index c87799f1c2a..4069fb2127e 100644
--- a/compiler/rustc_passes/Cargo.toml
+++ b/compiler/rustc_passes/Cargo.toml
@@ -19,3 +19,4 @@ rustc_serialize = { path = "../rustc_serialize" }
 rustc_span = { path = "../rustc_span" }
 rustc_trait_selection = { path = "../rustc_trait_selection" }
 rustc_lexer = { path = "../rustc_lexer" }
+rustc_ast_pretty = { path = "../rustc_ast_pretty" }
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();
                                 },
                             );