We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 06a1df4 + 8f37537 commit 9bbdc40Copy full SHA for 9bbdc40
src/librustdoc/clean/mod.rs
@@ -2768,7 +2768,10 @@ impl Clean<Type> for hir::Ty {
2768
};
2769
let length = match cx.tcx.const_eval(param_env.and(cid)) {
2770
Ok(length) => print_const(cx, length),
2771
- Err(_) => "_".to_string(),
+ Err(_) => cx.sess()
2772
+ .source_map()
2773
+ .span_to_snippet(cx.tcx.def_span(def_id))
2774
+ .unwrap_or_else(|_| "_".to_string()),
2775
2776
Array(box ty.clean(cx), length)
2777
},
src/test/rustdoc/const-generics/const-generic-slice.rs
@@ -0,0 +1,12 @@
1
+#![crate_name = "foo"]
2
+#![feature(const_generics)]
3
+
4
+pub trait Array {
5
+ type Item;
6
+}
7
8
+// @has foo/trait.Array.html
9
+// @has - '//h3[@class="impl"]' 'impl<T, const N: usize> Array for [T; N]'
10
+impl <T, const N: usize> Array for [T; N] {
11
+ type Item = T;
12
0 commit comments