You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #83127 - Aaron1011:time-macros-impl-warn, r=petrochenkov
Introduce `proc_macro_back_compat` lint, and emit for `time-macros-impl`
Now that future-incompat-report support has landed in nightly Cargo, we
can start to make progress towards removing the various proc-macro
back-compat hacks that have accumulated in the compiler.
This PR introduces a new lint `proc_macro_back_compat`, which results in
a future-incompat-report entry being generated. All proc-macro
back-compat warnings will be grouped under this lint. Note that this
lint will never actually become a hard error - instead, we will remove
the special cases for various macros, which will cause older versions of
those crates to emit some other error.
I've added code to fire this lint for the `time-macros-impl` case. This
is the easiest case out of all of our current back-compat hacks - the
crate was renamed to `time-macros`, so seeing a filename with
`time-macros-impl` guarantees that an older version of the parent `time`
crate is in use.
When Cargo's future-incompat-report feature gets stabilized, affected
users will start to see future-incompat warnings when they build their
crates.
/// The `proc_macro_back_compat` lint detects uses of old versions of certain
3089
+
/// proc-macro crates, which have hardcoded workarounds in the compiler.
3090
+
///
3091
+
/// ### Example
3092
+
///
3093
+
/// ```rust,ignore (needs-dependency)
3094
+
///
3095
+
/// use time_macros_impl::impl_macros;
3096
+
/// struct Foo;
3097
+
/// impl_macros!(Foo);
3098
+
/// ```
3099
+
///
3100
+
/// This will produce:
3101
+
///
3102
+
/// ```text
3103
+
/// warning: using an old version of `time-macros-impl`
3104
+
/// ::: $DIR/group-compat-hack.rs:27:5
3105
+
/// |
3106
+
/// LL | impl_macros!(Foo);
3107
+
/// | ------------------ in this macro invocation
3108
+
/// |
3109
+
/// = note: `#[warn(proc_macro_back_compat)]` on by default
3110
+
/// = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3111
+
/// = note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
3112
+
/// = note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
3113
+
/// = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
3114
+
/// ```
3115
+
///
3116
+
/// ### Explanation
3117
+
///
3118
+
/// Eventually, the backwards-compatibility hacks present in the compiler will be removed,
3119
+
/// causing older versions of certain crates to stop compiling.
3120
+
/// This is a [future-incompatible] lint to ease the transition to an error.
warning: using an old version of `time-macros-impl`
2
+
--> $DIR/time-macros-impl/src/lib.rs:5:32
3
+
|
4
+
LL | #[my_macro] struct One($name);
5
+
| ^^^^^
6
+
|
7
+
::: $DIR/group-compat-hack.rs:27:5
8
+
|
9
+
LL | impl_macros!(Foo);
10
+
| ------------------ in this macro invocation
11
+
|
12
+
= note: `#[warn(proc_macro_back_compat)]` on by default
13
+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
14
+
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
15
+
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
16
+
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
17
+
18
+
warning: using an old version of `time-macros-impl`
19
+
--> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32
20
+
|
21
+
LL | #[my_macro] struct One($name);
22
+
| ^^^^^
23
+
|
24
+
::: $DIR/group-compat-hack.rs:44:5
25
+
|
26
+
LL | impl_macros!(Foo);
27
+
| ------------------ in this macro invocation
28
+
|
29
+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
30
+
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
31
+
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
32
+
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
warning: using an old version of `time-macros-impl`
38
+
--> $DIR/time-macros-impl/src/lib.rs:5:32
39
+
|
40
+
LL | #[my_macro] struct One($name);
41
+
| ^^^^^
42
+
|
43
+
::: $DIR/group-compat-hack.rs:27:5
44
+
|
45
+
LL | impl_macros!(Foo);
46
+
| ------------------ in this macro invocation
47
+
|
48
+
= note: `#[warn(proc_macro_back_compat)]` on by default
49
+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
50
+
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
51
+
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
52
+
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
53
+
54
+
Future breakage date: None, diagnostic:
55
+
warning: using an old version of `time-macros-impl`
56
+
--> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32
57
+
|
58
+
LL | #[my_macro] struct One($name);
59
+
| ^^^^^
60
+
|
61
+
::: $DIR/group-compat-hack.rs:44:5
62
+
|
63
+
LL | impl_macros!(Foo);
64
+
| ------------------ in this macro invocation
65
+
|
66
+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
67
+
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
68
+
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
69
+
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
0 commit comments