Skip to content

Commit 00e0124

Browse files
committed
Unrolled build for #162985 in rollup 163002
Rollup merge of #162985 - mejrs:nightly_attr_errors, r=JonathanBrouwer Error on invalid placements for unstable attributes These are unstable, no need to have a warning.
2 parents 971903d + f773f16 commit 00e0124

5 files changed

Lines changed: 31 additions & 49 deletions

File tree

‎compiler/rustc_attr_parsing/src/attributes/allow_unstable.rs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ impl CombineAttributeParser for AllowInternalUnstableParser {
1212
type Item = (Symbol, Span);
1313
const CONVERT: ConvertFn<Self::Item> =
1414
|items, span| AttributeKind::AllowInternalUnstable(items, span);
15-
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
16-
Allow(Target::MacroDef),
17-
Allow(Target::Fn),
18-
Warn(Target::Field),
19-
Warn(Target::Arm),
20-
]);
15+
const ALLOWED_TARGETS: AllowedTargets<'_> =
16+
AllowedTargets::AllowList(&[Allow(Target::MacroDef), Allow(Target::Fn)]);
2117
const TEMPLATE: AttributeTemplate = template!(Word, List: &["feat1, feat2, ..."]);
2218
const STABILITY: AttributeStability = unstable!(allow_internal_unstable);
2319

‎compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,8 @@ pub(crate) struct AllowInternalUnsafeParser;
131131
impl NoArgsAttributeParser for AllowInternalUnsafeParser {
132132
const PATH: &[Symbol] = &[sym::allow_internal_unsafe];
133133
const ON_DUPLICATE: OnDuplicate = OnDuplicate::Ignore;
134-
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
135-
Allow(Target::Fn),
136-
Allow(Target::MacroDef),
137-
Warn(Target::Field),
138-
Warn(Target::Arm),
139-
]);
134+
const ALLOWED_TARGETS: AllowedTargets<'_> =
135+
AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::MacroDef)]);
140136
const STABILITY: AttributeStability = unstable!(allow_internal_unsafe);
141137
const CREATE: fn(Span) -> AttributeKind = |span| AttributeKind::AllowInternalUnsafe(span);
142138

‎compiler/rustc_attr_parsing/src/attributes/traits.rs‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::attributes::{NoArgsAttributeParser, SingleAttributeParser};
88
use crate::context::AcceptContext;
99
use crate::parser::ArgParser;
1010
use crate::target_checking::AllowedTargets;
11-
use crate::target_checking::Policy::{Allow, Warn};
11+
use crate::target_checking::Policy::Allow;
1212

1313
pub(crate) struct RustcSkipDuringMethodDispatchParser;
1414
impl SingleAttributeParser for RustcSkipDuringMethodDispatchParser {
@@ -63,12 +63,7 @@ impl NoArgsAttributeParser for RustcParenSugarParser {
6363
pub(crate) struct MarkerParser;
6464
impl NoArgsAttributeParser for MarkerParser {
6565
const PATH: &[Symbol] = &[sym::marker];
66-
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
67-
Allow(Target::Trait),
68-
Warn(Target::Field),
69-
Warn(Target::Arm),
70-
Warn(Target::MacroDef),
71-
]);
66+
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
7267
const STABILITY: AttributeStability = unstable!(marker_trait_attr);
7368
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::Marker;
7469
}

‎tests/ui/internal/internal-unstable.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ extern crate internal_unstable;
88

99
struct Baz {
1010
#[allow_internal_unstable] //~ ERROR `allow_internal_unstable` expects a list of feature names
11-
//~^ WARN cannot be used on
12-
//~| WARN previously accepted
11+
//~^ ERROR cannot be used on
1312
baz: u8,
1413
}
1514

@@ -59,8 +58,7 @@ fn main() {
5958

6059
match true {
6160
#[allow_internal_unstable] //~ ERROR `allow_internal_unstable` expects a list of feature names
62-
//~^ WARN cannot be used on
63-
//~| WARN previously accepted
61+
//~^ ERROR cannot be used on
6462
_ => {}
6563
}
6664

‎tests/ui/internal/internal-unstable.stderr‎

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,30 @@ error: `allow_internal_unstable` expects a list of feature names
44
LL | #[allow_internal_unstable]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
66

7+
error: the `allow_internal_unstable` attribute cannot be used on struct fields
8+
--> $DIR/internal-unstable.rs:10:7
9+
|
10+
LL | #[allow_internal_unstable]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^
12+
|
13+
= help: the `allow_internal_unstable` attribute can be applied to functions and macro defs
14+
715
error: `allow_internal_unstable` expects a list of feature names
8-
--> $DIR/internal-unstable.rs:61:9
16+
--> $DIR/internal-unstable.rs:60:9
917
|
1018
LL | #[allow_internal_unstable]
1119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1220

21+
error: the `allow_internal_unstable` attribute cannot be used on match arms
22+
--> $DIR/internal-unstable.rs:60:11
23+
|
24+
LL | #[allow_internal_unstable]
25+
| ^^^^^^^^^^^^^^^^^^^^^^^
26+
|
27+
= help: the `allow_internal_unstable` attribute can be applied to functions and macro defs
28+
1329
error[E0658]: use of unstable library feature `function`
14-
--> $DIR/internal-unstable.rs:50:25
30+
--> $DIR/internal-unstable.rs:49:25
1531
|
1632
LL | pass_through_allow!(internal_unstable::unstable());
1733
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -20,7 +36,7 @@ LL | pass_through_allow!(internal_unstable::unstable());
2036
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2137

2238
error[E0658]: use of unstable library feature `function`
23-
--> $DIR/internal-unstable.rs:52:27
39+
--> $DIR/internal-unstable.rs:51:27
2440
|
2541
LL | pass_through_noallow!(internal_unstable::unstable());
2642
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -29,7 +45,7 @@ LL | pass_through_noallow!(internal_unstable::unstable());
2945
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3046

3147
error[E0658]: use of unstable library feature `function`
32-
--> $DIR/internal-unstable.rs:56:22
48+
--> $DIR/internal-unstable.rs:55:22
3349
|
3450
LL | println!("{:?}", internal_unstable::unstable());
3551
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -38,7 +54,7 @@ LL | println!("{:?}", internal_unstable::unstable());
3854
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3955

4056
error[E0658]: use of unstable library feature `function`
41-
--> $DIR/internal-unstable.rs:58:10
57+
--> $DIR/internal-unstable.rs:57:10
4258
|
4359
LL | bar!(internal_unstable::unstable());
4460
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -47,7 +63,7 @@ LL | bar!(internal_unstable::unstable());
4763
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4864

4965
error[E0658]: use of unstable library feature `function`
50-
--> $DIR/internal-unstable.rs:20:9
66+
--> $DIR/internal-unstable.rs:19:9
5167
|
5268
LL | internal_unstable::unstable();
5369
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -59,25 +75,6 @@ LL | bar!(internal_unstable::unstable());
5975
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
6076
= note: this error originates in the macro `foo` which comes from the expansion of the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info)
6177

62-
warning: the `allow_internal_unstable` attribute cannot be used on struct fields
63-
--> $DIR/internal-unstable.rs:10:7
64-
|
65-
LL | #[allow_internal_unstable]
66-
| ^^^^^^^^^^^^^^^^^^^^^^^
67-
|
68-
= help: the `allow_internal_unstable` attribute can be applied to functions and macro defs
69-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
70-
= note: requested on the command line with `-W unused-attributes`
71-
72-
warning: the `allow_internal_unstable` attribute cannot be used on match arms
73-
--> $DIR/internal-unstable.rs:61:11
74-
|
75-
LL | #[allow_internal_unstable]
76-
| ^^^^^^^^^^^^^^^^^^^^^^^
77-
|
78-
= help: the `allow_internal_unstable` attribute can be applied to functions and macro defs
79-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
80-
81-
error: aborting due to 7 previous errors; 2 warnings emitted
78+
error: aborting due to 9 previous errors
8279

8380
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)