Skip to content

Commit f8deed3

Browse files
ayazhafizcalebcartwright
authored andcommitted
Include const generic type bounds in their spans
Closes rust-lang#4310
1 parent 152ccb5 commit f8deed3

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Diff for: src/items.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2217,11 +2217,10 @@ fn rewrite_fn_base(
22172217

22182218
// Skip `pub(crate)`.
22192219
let lo_after_visibility = get_bytepos_after_visibility(&fn_sig.visibility, span);
2220-
// A conservative estimation, to goal is to be over all parens in generics
2220+
// A conservative estimation, the goal is to be over all parens in generics
22212221
let params_start = fn_sig
22222222
.generics
22232223
.params
2224-
.iter()
22252224
.last()
22262225
.map_or(lo_after_visibility, |param| param.span().hi());
22272226
let params_end = if fd.inputs.is_empty() {

Diff for: src/spanned.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ impl Spanned for ast::GenericParam {
132132
};
133133
let ty_hi = if let ast::GenericParamKind::Type {
134134
default: Some(ref ty),
135-
} = self.kind
135+
}
136+
| ast::GenericParamKind::Const { ref ty, .. } = self.kind
136137
{
137138
ty.span().hi()
138139
} else {

Diff for: tests/target/issue-4310.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(const_generics)]
2+
3+
fn foo<
4+
const N: [u8; {
5+
struct Inner<'a>(&'a ());
6+
3
7+
}],
8+
>() {
9+
}

0 commit comments

Comments
 (0)