Skip to content

Compression warnings are disabled by default, including on nightly #39

Description

@DCjanus

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:

  1. Remove compression warnings if this behavior is no longer useful.
  2. Remove proc-macro-error3, detect nightly with rustversion, and call proc_macro::Diagnostic directly. Stable builds would skip the warning.
  3. 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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions