fix: use correct spans for params with attrs

This commit is contained in:
Caleb Cartwright 2021-09-06 15:35:25 -05:00 committed by Caleb Cartwright
parent 59063e8b40
commit a59cac29f4
3 changed files with 23 additions and 1 deletions

View File

@ -104,7 +104,7 @@ fn span(&self) -> Span {
impl Spanned for ast::Param {
fn span(&self) -> Span {
if crate::items::is_named_param(self) {
mk_sp(self.pat.span.lo(), self.ty.span.hi())
mk_sp(crate::items::span_lo_for_param(self), self.ty.span.hi())
} else {
self.ty.span
}

View File

@ -0,0 +1,4 @@
fn a1(#[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] a: u8) {}
fn b1(#[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] bb: u8) {}
fn a2(#[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] a: u8) {}
fn b2(#[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] bb: u8) {}

View File

@ -0,0 +1,18 @@
fn a1(
#[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]
a: u8,
) {
}
fn b1(
#[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]
bb: u8,
) {
}
fn a2(
#[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] a: u8,
) {
}
fn b2(
#[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] bb: u8,
) {
}