-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
8 changed files
with
206 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
src/test/ui/proc-macro/group-compat-hack/group-compat-hack.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
warning: using an old version of `time-macros-impl` | ||
--> $DIR/time-macros-impl/src/lib.rs:5:32 | ||
| | ||
LL | #[my_macro] struct One($name); | ||
| ^^^^^ | ||
| | ||
::: $DIR/group-compat-hack.rs:27:5 | ||
| | ||
LL | impl_macros!(Foo); | ||
| ------------------ in this macro invocation | ||
| | ||
= note: `#[warn(proc_macro_back_compat)]` on by default | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> | ||
= 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 | ||
= 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` | ||
--> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32 | ||
| | ||
LL | #[my_macro] struct One($name); | ||
| ^^^^^ | ||
| | ||
::: $DIR/group-compat-hack.rs:44:5 | ||
| | ||
LL | impl_macros!(Foo); | ||
| ------------------ in this macro invocation | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> | ||
= 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 | ||
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
warning: 2 warnings emitted | ||
|
||
Future incompatibility report: Future breakage date: None, diagnostic: | ||
warning: using an old version of `time-macros-impl` | ||
--> $DIR/time-macros-impl/src/lib.rs:5:32 | ||
| | ||
LL | #[my_macro] struct One($name); | ||
| ^^^^^ | ||
| | ||
::: $DIR/group-compat-hack.rs:27:5 | ||
| | ||
LL | impl_macros!(Foo); | ||
| ------------------ in this macro invocation | ||
| | ||
= note: `#[warn(proc_macro_back_compat)]` on by default | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> | ||
= 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 | ||
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
Future breakage date: None, diagnostic: | ||
warning: using an old version of `time-macros-impl` | ||
--> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32 | ||
| | ||
LL | #[my_macro] struct One($name); | ||
| ^^^^^ | ||
| | ||
::: $DIR/group-compat-hack.rs:44:5 | ||
| | ||
LL | impl_macros!(Foo); | ||
| ------------------ in this macro invocation | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125> | ||
= 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 | ||
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
Oops, something went wrong.