implement generic_arg_infer
for array lengths
This commit is contained in:
parent
5aa0239b16
commit
e3f5cc6c38
19 changed files with 161 additions and 51 deletions
|
@ -310,9 +310,13 @@ impl<'hir> Sig for hir::Ty<'hir> {
|
|||
let nested = bounds_to_string(&bounds);
|
||||
Ok(text_sig(nested))
|
||||
}
|
||||
hir::TyKind::Array(ref ty, ref anon_const) => {
|
||||
hir::TyKind::Array(ref ty, ref length) => {
|
||||
let nested_ty = ty.make(offset + 1, id, scx)?;
|
||||
let expr = id_to_string(&scx.tcx.hir(), anon_const.body.hir_id).replace('\n', " ");
|
||||
let hir_id = match length {
|
||||
&hir::ArrayLen::Infer(hir_id, _) => hir_id,
|
||||
hir::ArrayLen::Body(anon_const) => anon_const.hir_id,
|
||||
};
|
||||
let expr = id_to_string(&scx.tcx.hir(), hir_id).replace('\n', " ");
|
||||
let text = format!("[{}; {}]", nested_ty.text, expr);
|
||||
Ok(replace_text(nested_ty, text))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue