Background
After #38 was merged, I checked proc-macro-error3 because @SOF3 mentioned a concern about the reliability of the new crate.
I compared its source with proc-macro-error2. I did not find any suspicious changes, and the source published on crates.io matches the GitHub source. During this check, I noticed that its nightly diagnostics require an explicit Cargo feature.
Current behavior
On master at commit 4118d8e, include-flate uses emit_warning! from proc-macro-error3, but does not enable its nightly feature.
The result is:
proc-macro-error3/nightly |
stable |
nightly |
| disabled |
No compression warnings |
No compression warnings |
| enabled |
Compilation fails with E0554 |
Warnings are shown with the correct source spans |
This means compression warnings are never shown with the default configuration, even when the compiler is nightly.
Why this happens
proc-macro-error3 only enables proc_macro::Diagnostic when its nightly feature is enabled. Without that feature, emit_warning! is a no-op.
Cargo features cannot be enabled only for a nightly compiler. If include-flate enables this dependency feature by default, stable builds will fail because proc_macro_diagnostic is unstable.
Possible directions
I see three possible options:
- Remove compression warnings if this behavior is no longer useful.
- Remove
proc-macro-error3, detect nightly with rustversion, and call proc_macro::Diagnostic directly. Stable builds would skip the warning.
- Add an explicit
include-flate feature that enables proc-macro-error3/nightly. Users could opt in on nightly, but enabling it on stable would fail to compile.
Which behavior would be preferred?
Background
After #38 was merged, I checked
proc-macro-error3because @SOF3 mentioned a concern about the reliability of the new crate.I compared its source with
proc-macro-error2. I did not find any suspicious changes, and the source published on crates.io matches the GitHub source. During this check, I noticed that its nightly diagnostics require an explicit Cargo feature.Current behavior
On master at commit 4118d8e,
include-flateusesemit_warning!fromproc-macro-error3, but does not enable itsnightlyfeature.The result is:
proc-macro-error3/nightlyE0554This means compression warnings are never shown with the default configuration, even when the compiler is nightly.
Why this happens
proc-macro-error3only enablesproc_macro::Diagnosticwhen itsnightlyfeature is enabled. Without that feature,emit_warning!is a no-op.Cargo features cannot be enabled only for a nightly compiler. If
include-flateenables this dependency feature by default, stable builds will fail becauseproc_macro_diagnosticis unstable.Possible directions
I see three possible options:
proc-macro-error3, detect nightly withrustversion, and callproc_macro::Diagnosticdirectly. Stable builds would skip the warning.include-flatefeature that enablesproc-macro-error3/nightly. Users could opt in on nightly, but enabling it on stable would fail to compile.Which behavior would be preferred?