Skip to content

Commit 17c602d

Browse files
authored
Rollup merge of #88041 - Aaron1011:deny-proc-macro-hack, r=wesleywiser
Make all proc-macro back-compat lints deny-by-default The affected crates have had plenty of time to update. By keeping these as lints rather than making them hard errors, we ensure that downstream crates will still be able to compile, even if they transitive depend on broken versions of the affected crates. This should hopefully discourage anyone from writing any new code which relies on the backwards-compatibility behavior.
2 parents dcf9242 + 02e4d0b commit 17c602d

9 files changed

+86
-88
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,7 @@ declare_lint! {
19571957
/// [issue #50504]: https://github.com/rust-lang/rust/issues/50504
19581958
/// [future-incompatible]: ../index.md#future-incompatible-lints
19591959
pub PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
1960-
Warn,
1960+
Deny,
19611961
"detects proc macro derives using inaccessible names from parent modules",
19621962
@future_incompatible = FutureIncompatibleInfo {
19631963
reference: "issue #83583 <https://github.com/rust-lang/rust/issues/83583>",
@@ -3253,7 +3253,7 @@ declare_lint! {
32533253
/// [issue #83125]: https://github.com/rust-lang/rust/issues/83125
32543254
/// [future-incompatible]: ../index.md#future-incompatible-lints
32553255
pub PROC_MACRO_BACK_COMPAT,
3256-
Warn,
3256+
Deny,
32573257
"detects usage of old versions of certain proc-macro crates",
32583258
@future_incompatible = FutureIncompatibleInfo {
32593259
reference: "issue #83125 <https://github.com/rust-lang/rust/issues/83125>",

src/test/ui/proc-macro/generate-mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope
1313
//~| ERROR cannot find type `OuterAttr` in this scope
1414
struct S;
1515

16-
#[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope
17-
//~| WARN cannot find type `OuterDerive` in this scope
16+
#[derive(generate_mod::CheckDerive)] //~ ERROR cannot find type `FromOutside` in this scope
17+
//~| ERROR cannot find type `OuterDerive` in this scope
1818
//~| WARN this was previously accepted
1919
//~| WARN this was previously accepted
2020
struct Z;
2121

2222
fn inner_block() {
23-
#[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope
24-
//~| WARN cannot find type `OuterDerive` in this scope
23+
#[derive(generate_mod::CheckDerive)] //~ ERROR cannot find type `FromOutside` in this scope
24+
//~| ERROR cannot find type `OuterDerive` in this scope
2525
//~| WARN this was previously accepted
2626
//~| WARN this was previously accepted
2727
struct InnerZ;

src/test/ui/proc-macro/generate-mod.stderr

+19-19
Original file line numberDiff line numberDiff line change
@@ -38,94 +38,94 @@ LL | #[generate_mod::check_attr]
3838
OuterAttr
3939
= note: this error originates in the attribute macro `generate_mod::check_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
4040

41-
warning: cannot find type `FromOutside` in this scope
41+
error: cannot find type `FromOutside` in this scope
4242
--> $DIR/generate-mod.rs:16:10
4343
|
4444
LL | #[derive(generate_mod::CheckDerive)]
4545
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
4646
|
47-
= note: `#[warn(proc_macro_derive_resolution_fallback)]` on by default
47+
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
4848
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4949
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
50-
= note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
50+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
5151

52-
warning: cannot find type `OuterDerive` in this scope
52+
error: cannot find type `OuterDerive` in this scope
5353
--> $DIR/generate-mod.rs:16:10
5454
|
5555
LL | #[derive(generate_mod::CheckDerive)]
5656
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
5757
|
5858
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5959
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
60-
= note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
60+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
6161

62-
warning: cannot find type `FromOutside` in this scope
62+
error: cannot find type `FromOutside` in this scope
6363
--> $DIR/generate-mod.rs:23:14
6464
|
6565
LL | #[derive(generate_mod::CheckDerive)]
6666
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
6767
|
6868
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
6969
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
70-
= note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
70+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
7171

72-
warning: cannot find type `OuterDerive` in this scope
72+
error: cannot find type `OuterDerive` in this scope
7373
--> $DIR/generate-mod.rs:23:14
7474
|
7575
LL | #[derive(generate_mod::CheckDerive)]
7676
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
7777
|
7878
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7979
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
80-
= note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
80+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
8181

82-
error: aborting due to 4 previous errors; 4 warnings emitted
82+
error: aborting due to 8 previous errors
8383

8484
For more information about this error, try `rustc --explain E0412`.
8585
Future incompatibility report: Future breakage diagnostic:
86-
warning: cannot find type `FromOutside` in this scope
86+
error: cannot find type `FromOutside` in this scope
8787
--> $DIR/generate-mod.rs:16:10
8888
|
8989
LL | #[derive(generate_mod::CheckDerive)]
9090
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
9191
|
92-
= note: `#[warn(proc_macro_derive_resolution_fallback)]` on by default
92+
= note: `#[deny(proc_macro_derive_resolution_fallback)]` on by default
9393
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
9494
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
95-
= note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
95+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
9696

9797
Future breakage diagnostic:
98-
warning: cannot find type `OuterDerive` in this scope
98+
error: cannot find type `OuterDerive` in this scope
9999
--> $DIR/generate-mod.rs:16:10
100100
|
101101
LL | #[derive(generate_mod::CheckDerive)]
102102
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
103103
|
104104
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
105105
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
106-
= note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
106+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
107107

108108
Future breakage diagnostic:
109-
warning: cannot find type `FromOutside` in this scope
109+
error: cannot find type `FromOutside` in this scope
110110
--> $DIR/generate-mod.rs:23:14
111111
|
112112
LL | #[derive(generate_mod::CheckDerive)]
113113
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
114114
|
115115
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
116116
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
117-
= note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
117+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
118118

119119
Future breakage diagnostic:
120-
warning: cannot find type `OuterDerive` in this scope
120+
error: cannot find type `OuterDerive` in this scope
121121
--> $DIR/generate-mod.rs:23:14
122122
|
123123
LL | #[derive(generate_mod::CheckDerive)]
124124
| ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import
125125
|
126126
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
127127
= note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583>
128-
= note: this warning originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
128+
= note: this error originates in the derive macro `generate_mod::CheckDerive` (in Nightly builds, run with -Z macro-backtrace for more info)
129129

130130
Future breakage diagnostic:
131131
warning: cannot find type `FromOutside` in this scope

src/test/ui/proc-macro/group-compat-hack/group-compat-hack.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// check-pass
21
// aux-build:pin-project-internal-0.4.0.rs
32
// compile-flags: -Z span-debug
43

@@ -24,7 +23,7 @@ mod no_version {
2423
}
2524

2625
struct Foo;
27-
impl_macros!(Foo); //~ WARN using an old version
26+
impl_macros!(Foo); //~ ERROR using an old version
2827
//~| WARN this was previously
2928
arrays!(Foo);
3029
other!(Foo);
@@ -41,9 +40,9 @@ mod with_version {
4140
}
4241

4342
struct Foo;
44-
impl_macros!(Foo); //~ WARN using an old version
43+
impl_macros!(Foo); //~ ERROR using an old version
4544
//~| WARN this was previously
46-
arrays!(Foo); //~ WARN using an old version
45+
arrays!(Foo); //~ ERROR using an old version
4746
//~| WARN this was previously
4847
other!(Foo);
4948
}
@@ -52,15 +51,15 @@ mod actix_web_test {
5251
include!("actix-web/src/extract.rs");
5352

5453
struct Foo;
55-
tuple_from_req!(Foo); //~ WARN using an old version
54+
tuple_from_req!(Foo); //~ ERROR using an old version
5655
//~| WARN this was previously
5756
}
5857

5958
mod actix_web_version_test {
6059
include!("actix-web-2.0.0/src/extract.rs");
6160

6261
struct Foo;
63-
tuple_from_req!(Foo); //~ WARN using an old version
62+
tuple_from_req!(Foo); //~ ERROR using an old version
6463
//~| WARN this was previously
6564
}
6665

0 commit comments

Comments
 (0)