Skip to content

Commit 5841d2f

Browse files
Fix attribute order implementation
1 parent 27dbdb5 commit 5841d2f

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
@@ -161,9 +161,9 @@ impl<T: SingleAttributeParser<S>, S: Stage> AttributeParser<S> for Single<T, S>
161161
if let Some(pa) = T::convert(cx, args) {
162162
if let Some((_, used)) = group.1 {
163163
T::ON_DUPLICATE.exec::<T>(cx, used, cx.attr_span);
164+
} else {
165+
group.1 = Some((pa, cx.attr_span));
164166
}
165-
166-
group.1 = Some((pa, cx.attr_span));
167167
}
168168
},
169169
)];

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ LL | #![no_std(foo = "bar")]
131131
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
132132
|
133133
note: attribute also specified here
134-
--> $DIR/malformed-no-std.rs:5:1
134+
--> $DIR/malformed-no-std.rs:3:1
135135
|
136-
LL | #![no_std("bar")]
137-
| ^^^^^^^^^^^^^^^^^
136+
LL | #![no_std = "foo"]
137+
| ^^^^^^^^^^^^^^^^^^
138138

139139
warning: unused attribute
140140
--> $DIR/malformed-no-std.rs:13:1
@@ -155,10 +155,10 @@ LL | #![no_core(foo = "bar")]
155155
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
156156
|
157157
note: attribute also specified here
158-
--> $DIR/malformed-no-std.rs:13:1
158+
--> $DIR/malformed-no-std.rs:11:1
159159
|
160-
LL | #![no_core("bar")]
161-
| ^^^^^^^^^^^^^^^^^^
160+
LL | #![no_core = "foo"]
161+
| ^^^^^^^^^^^^^^^^^^^
162162

163163
error: aborting due to 8 previous errors; 4 warnings emitted
164164

0 commit comments

Comments
 (0)