Skip to content
Permalink
Browse files

Fix slice const generic length display

  • Loading branch information...
GuillaumeGomez committed Jun 6, 2019
1 parent 8b36867 commit 8f3753703c9e4e587fcb9790a07aa18b310b8431
Showing with 16 additions and 1 deletion.
  1. +4 −1 src/librustdoc/clean/mod.rs
  2. +12 −0 src/test/rustdoc/const-generics/const-generic-slice.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)
},
@@ -0,0 +1,12 @@
#![crate_name = "foo"]
#![feature(const_generics)]

pub trait Array {
type Item;
}

// @has foo/trait.Array.html
// @has - '//h3[@class="impl"]' 'impl<T, const N: usize> Array for [T; N]'
impl <T, const N: usize> Array for [T; N] {
type Item = T;
}

0 comments on commit 8f37537

Please sign in to comment.
You can’t perform that action at this time.