Skip to content

Commit 78a6e13

Browse files
committed
Auto merge of #143731 - matthiaskrgr:rollup-lm9q7vc, r=matthiaskrgr
Rollup of 12 pull requests Successful merges: - #136906 (Add checking for unnecessary delims in closure body) - #143652 (docs: document trait upcasting rules in `Unsize` trait) - #143657 (Resolver: refact macro map into external and local maps) - #143659 (Use "Innermost" & "Outermost" terminology for `AttributeOrder`) - #143663 (fix: correct typo in attr_parsing_previously_accepted message key) - #143666 (Re-expose nested bodies in rustc_borrowck::consumers) - #143668 (Fix VxWorks build errors) - #143670 (Add a new maintainer to the wasm32-wasip1 target) - #143675 (improve lint doc text) - #143683 (Assorted `run-make-support` maintenance) - #143695 (Auto-add `S-waiting-on-author` when the PR is/switches to draft state) - #143706 (triagebot.toml: ping lolbinarycat if tidy extra checks were modified) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 119574f + bd2a351 commit 78a6e13

File tree

80 files changed

+512
-415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+512
-415
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3214,7 +3214,7 @@ dependencies = [
32143214

32153215
[[package]]
32163216
name = "run_make_support"
3217-
version = "0.2.0"
3217+
version = "0.0.0"
32183218
dependencies = [
32193219
"bstr",
32203220
"build_helper",

compiler/rustc_attr_parsing/messages.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ attr_parsing_unused_duplicate =
146146
unused attribute
147147
.suggestion = remove this attribute
148148
.note = attribute also specified here
149-
.warn = {-passes_previously_accepted}
149+
.warn = {-attr_parsing_previously_accepted}
150150
151151
attr_parsing_unused_multiple =
152152
multiple `{$name}` attributes
153153
.suggestion = remove this attribute
154154
.note = attribute also specified here
155155
156-
-attr_parsing_perviously_accepted =
156+
-attr_parsing_previously_accepted =
157157
this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub(crate) struct OptimizeParser;
1515

1616
impl<S: Stage> SingleAttributeParser<S> for OptimizeParser {
1717
const PATH: &[Symbol] = &[sym::optimize];
18-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast;
18+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
1919
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
2020
const TEMPLATE: AttributeTemplate = template!(List: "size|speed|none");
2121

@@ -56,7 +56,7 @@ pub(crate) struct ExportNameParser;
5656

5757
impl<S: Stage> SingleAttributeParser<S> for ExportNameParser {
5858
const PATH: &[rustc_span::Symbol] = &[sym::export_name];
59-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
59+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
6060
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
6161
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
6262

compiler/rustc_attr_parsing/src/attributes/deprecation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn get<S: Stage>(
3636

3737
impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
3838
const PATH: &[Symbol] = &[sym::deprecated];
39-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
39+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
4040
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
4141
const TEMPLATE: AttributeTemplate = template!(
4242
Word,

compiler/rustc_attr_parsing/src/attributes/dummy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::parser::ArgParser;
99
pub(crate) struct DummyParser;
1010
impl<S: Stage> SingleAttributeParser<S> for DummyParser {
1111
const PATH: &[Symbol] = &[sym::rustc_dummy];
12-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
12+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
1313
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Ignore;
1414
const TEMPLATE: AttributeTemplate = template!(Word); // Anything, really
1515

compiler/rustc_attr_parsing/src/attributes/inline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) struct InlineParser;
1616

1717
impl<S: Stage> SingleAttributeParser<S> for InlineParser {
1818
const PATH: &'static [Symbol] = &[sym::inline];
19-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast;
19+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
2020
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
2121
const TEMPLATE: AttributeTemplate = template!(Word, List: "always|never");
2222

@@ -57,7 +57,7 @@ pub(crate) struct RustcForceInlineParser;
5757

5858
impl<S: Stage> SingleAttributeParser<S> for RustcForceInlineParser {
5959
const PATH: &'static [Symbol] = &[sym::rustc_force_inline];
60-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast;
60+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
6161
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
6262
const TEMPLATE: AttributeTemplate = template!(Word, List: "reason", NameValueStr: "reason");
6363

compiler/rustc_attr_parsing/src/attributes/link_attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub(crate) struct LinkNameParser;
1414

1515
impl<S: Stage> SingleAttributeParser<S> for LinkNameParser {
1616
const PATH: &[Symbol] = &[sym::link_name];
17-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
17+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
1818
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
1919
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
2020

@@ -36,7 +36,7 @@ pub(crate) struct LinkSectionParser;
3636

3737
impl<S: Stage> SingleAttributeParser<S> for LinkSectionParser {
3838
const PATH: &[Symbol] = &[sym::link_section];
39-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
39+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
4040
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
4141
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
4242

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ impl<T: SingleAttributeParser<S>, S: Stage> AttributeParser<S> for Single<T, S>
140140
if let Some(pa) = T::convert(cx, args) {
141141
match T::ATTRIBUTE_ORDER {
142142
// keep the first and report immediately. ignore this attribute
143-
AttributeOrder::KeepFirst => {
143+
AttributeOrder::KeepInnermost => {
144144
if let Some((_, unused)) = group.1 {
145145
T::ON_DUPLICATE.exec::<T>(cx, cx.attr_span, unused);
146146
return;
147147
}
148148
}
149149
// keep the new one and warn about the previous,
150150
// then replace
151-
AttributeOrder::KeepLast => {
151+
AttributeOrder::KeepOutermost => {
152152
if let Some((_, used)) = group.1 {
153153
T::ON_DUPLICATE.exec::<T>(cx, used, cx.attr_span);
154154
}
@@ -165,9 +165,6 @@ impl<T: SingleAttributeParser<S>, S: Stage> AttributeParser<S> for Single<T, S>
165165
}
166166
}
167167

168-
// FIXME(jdonszelmann): logic is implemented but the attribute parsers needing
169-
// them will be merged in another PR
170-
#[allow(unused)]
171168
pub(crate) enum OnDuplicate<S: Stage> {
172169
/// Give a default warning
173170
Warn,
@@ -213,39 +210,29 @@ impl<S: Stage> OnDuplicate<S> {
213210
}
214211
}
215212
}
216-
//
217-
// FIXME(jdonszelmann): logic is implemented but the attribute parsers needing
218-
// them will be merged in another PR
219-
#[allow(unused)]
213+
220214
pub(crate) enum AttributeOrder {
221-
/// Duplicates after the first attribute will be an error. I.e. only keep the lowest attribute.
215+
/// Duplicates after the innermost instance of the attribute will be an error/warning.
216+
/// Only keep the lowest attribute.
222217
///
223-
/// Attributes are processed from bottom to top, so this raises an error on all the attributes
218+
/// Attributes are processed from bottom to top, so this raises a warning/error on all the attributes
224219
/// further above the lowest one:
225220
/// ```
226221
/// #[stable(since="1.0")] //~ WARNING duplicated attribute
227222
/// #[stable(since="2.0")]
228223
/// ```
229-
///
230-
/// This should be used where duplicates would be ignored, but carry extra
231-
/// meaning that could cause confusion. For example, `#[stable(since="1.0")]
232-
/// #[stable(since="2.0")]`, which version should be used for `stable`?
233-
KeepFirst,
224+
KeepInnermost,
234225

235-
/// Duplicates preceding the last instance of the attribute will be a
236-
/// warning, with a note that this will be an error in the future.
226+
/// Duplicates before the outermost instance of the attribute will be an error/warning.
227+
/// Only keep the highest attribute.
237228
///
238-
/// Attributes are processed from bottom to top, so this raises a warning on all the attributes
239-
/// below the higher one:
229+
/// Attributes are processed from bottom to top, so this raises a warning/error on all the attributes
230+
/// below the highest one:
240231
/// ```
241232
/// #[path="foo.rs"]
242233
/// #[path="bar.rs"] //~ WARNING duplicated attribute
243234
/// ```
244-
///
245-
/// This is the same as `FutureWarnFollowing`, except the last attribute is
246-
/// the one that is "used". Ideally these can eventually migrate to
247-
/// `ErrorPreceding`.
248-
KeepLast,
235+
KeepOutermost,
249236
}
250237

251238
/// An even simpler version of [`SingleAttributeParser`]:
@@ -271,7 +258,7 @@ impl<T: NoArgsAttributeParser<S>, S: Stage> Default for WithoutArgs<T, S> {
271258

272259
impl<T: NoArgsAttributeParser<S>, S: Stage> SingleAttributeParser<S> for WithoutArgs<T, S> {
273260
const PATH: &[Symbol] = T::PATH;
274-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast;
261+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
275262
const ON_DUPLICATE: OnDuplicate<S> = T::ON_DUPLICATE;
276263
const TEMPLATE: AttributeTemplate = template!(Word);
277264

compiler/rustc_attr_parsing/src/attributes/must_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) struct MustUseParser;
1212

1313
impl<S: Stage> SingleAttributeParser<S> for MustUseParser {
1414
const PATH: &[Symbol] = &[sym::must_use];
15-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast;
15+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
1616
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
1717
const TEMPLATE: AttributeTemplate = template!(Word, NameValueStr: "reason");
1818

compiler/rustc_attr_parsing/src/attributes/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub(crate) struct PathParser;
1010

1111
impl<S: Stage> SingleAttributeParser<S> for PathParser {
1212
const PATH: &[Symbol] = &[sym::path];
13-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast;
13+
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
1414
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
1515
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "file");
1616

0 commit comments

Comments
 (0)