Skip to content

Commit 9228062

Browse files
committed
Auto merge of #154781 - JonathanBrouwer:fix-attr-order, r=<try>
Fix attribute order implementation
2 parents 2972b5e + d88d64b commit 9228062

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ impl<T: SingleAttributeParser<S>, S: Stage> AttributeParser<S> for Single<T, S>
159159
if let Some(pa) = T::convert(cx, args) {
160160
if let Some((_, used)) = group.1 {
161161
T::ON_DUPLICATE.exec::<T>(cx, used, cx.attr_span);
162+
} else {
163+
group.1 = Some((pa, cx.attr_span));
162164
}
163-
164-
group.1 = Some((pa, cx.attr_span));
165165
}
166166
},
167167
)];

tests/ui/attributes/malformed-no-std.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ LL | #![no_std(foo = "bar")]
101101
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
102102
|
103103
note: attribute also specified here
104-
--> $DIR/malformed-no-std.rs:5:1
104+
--> $DIR/malformed-no-std.rs:3:1
105105
|
106-
LL | #![no_std("bar")]
107-
| ^^^^^^^^^^^^^^^^^
106+
LL | #![no_std = "foo"]
107+
| ^^^^^^^^^^^^^^^^^^
108108

109109
warning: unused attribute
110110
--> $DIR/malformed-no-std.rs:13:1
@@ -125,10 +125,10 @@ LL | #![no_core(foo = "bar")]
125125
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
126126
|
127127
note: attribute also specified here
128-
--> $DIR/malformed-no-std.rs:13:1
128+
--> $DIR/malformed-no-std.rs:11:1
129129
|
130-
LL | #![no_core("bar")]
131-
| ^^^^^^^^^^^^^^^^^^
130+
LL | #![no_core = "foo"]
131+
| ^^^^^^^^^^^^^^^^^^^
132132

133133
error: aborting due to 8 previous errors; 4 warnings emitted
134134

0 commit comments

Comments
 (0)