mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
Use correct span for match arms with the leading pipe and attributes (#3975)
This commit is contained in:
parent
c1e9b7b874
commit
a36e7c7981
@ -45,6 +45,7 @@ impl<'a> ArmWrapper<'a> {
|
|||||||
impl<'a> Spanned for ArmWrapper<'a> {
|
impl<'a> Spanned for ArmWrapper<'a> {
|
||||||
fn span(&self) -> Span {
|
fn span(&self) -> Span {
|
||||||
if let Some(lo) = self.beginning_vert {
|
if let Some(lo) = self.beginning_vert {
|
||||||
|
let lo = std::cmp::min(lo, self.arm.span().lo());
|
||||||
mk_sp(lo, self.arm.span().hi())
|
mk_sp(lo, self.arm.span().hi())
|
||||||
} else {
|
} else {
|
||||||
self.arm.span()
|
self.arm.span()
|
||||||
|
10
tests/target/issue-3974.rs
Normal file
10
tests/target/issue-3974.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fn emulate_foreign_item() {
|
||||||
|
match link_name {
|
||||||
|
// A comment here will duplicate the attribute
|
||||||
|
#[rustfmt::skip]
|
||||||
|
| "pthread_mutexattr_init"
|
||||||
|
| "pthread_mutexattr_settype"
|
||||||
|
| "pthread_mutex_init"
|
||||||
|
=> {}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user