about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-07 16:48:09 +0200
committerGitHub <noreply@github.com>2019-06-07 16:48:09 +0200
commit9bbdc40334ab6503f57f24af50ba2ce96a783994 (patch)
treeee8a6d30c411f19b8688212ce1023a415f383768 /src/librustdoc
parent06a1df4954eca5053e64677da821bce3cc52b80f (diff)
parent8f3753703c9e4e587fcb9790a07aa18b310b8431 (diff)
downloadrust-9bbdc40334ab6503f57f24af50ba2ce96a783994.tar.gz
rust-9bbdc40334ab6503f57f24af50ba2ce96a783994.zip
Rollup merge of #61605 - GuillaumeGomez:const-generic-display, r=varkor
Fix slice const generic length display

Fixes #61487.

r? @varkor
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/clean/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 03d16feb483..a717ef20a84 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2768,7 +2768,10 @@ impl Clean<Type> for hir::Ty {
                 };
                 let length = match cx.tcx.const_eval(param_env.and(cid)) {
                     Ok(length) => print_const(cx, length),
-                    Err(_) => "_".to_string(),
+                    Err(_) => cx.sess()
+                                .source_map()
+                                .span_to_snippet(cx.tcx.def_span(def_id))
+                                .unwrap_or_else(|_| "_".to_string()),
                 };
                 Array(box ty.clean(cx), length)
             },