Include const generic type bounds in their spans

Closes #4310
This commit is contained in:
Ayaz Hafiz 2020-07-07 07:31:09 -07:00 committed by Caleb Cartwright
parent 152ccb5059
commit f8deed3a3a
3 changed files with 12 additions and 3 deletions

View File

@ -2217,11 +2217,10 @@ fn rewrite_fn_base(
// Skip `pub(crate)`.
let lo_after_visibility = get_bytepos_after_visibility(&fn_sig.visibility, span);
// A conservative estimation, to goal is to be over all parens in generics
// A conservative estimation, the goal is to be over all parens in generics
let params_start = fn_sig
.generics
.params
.iter()
.last()
.map_or(lo_after_visibility, |param| param.span().hi());
let params_end = if fd.inputs.is_empty() {

View File

@ -132,7 +132,8 @@ impl Spanned for ast::GenericParam {
};
let ty_hi = if let ast::GenericParamKind::Type {
default: Some(ref ty),
} = self.kind
}
| ast::GenericParamKind::Const { ref ty, .. } = self.kind
{
ty.span().hi()
} else {

View File

@ -0,0 +1,9 @@
#![feature(const_generics)]
fn foo<
const N: [u8; {
struct Inner<'a>(&'a ());
3
}],
>() {
}