Skip to content

--cfg=sqlx_macros_unstable broken in recent rust nightly #4150

Description

@gpluscb

I have found these related issues/pull requests

rust-lang/rust#149400
rust-lang/rust#99515

Description

rust-lang/rust#149400 restructured the nightly proc_macro_tracked_path feature (previously track_path), causing errors when compiling with --cfg=sqlx_macros_unstable on recent rust nightly:

error[E0433]: failed to resolve: could not find `tracked_path` in `proc_macro`
   --> /home/marrue/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-macros-core-0.8.6/src/migrate.rs:119:21
    |
119 |         proc_macro::tracked_path::path(path);
    |                     ^^^^^^^^^^^^ could not find `tracked_path` in `proc_macro`

error[E0635]: unknown feature `track_path`
  --> /home/marrue/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-macros-core-0.8.6/src/lib.rs:19:13
   |
19 |     feature(track_path)
   |             ^^^^^^^^^^

Some errors have detailed explanations: E0433, E0635.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `sqlx-macros-core` (lib) due to 2 previous errors

The first error is because proc_macro::tracked_path::path was renamed to proc_macro::tracked::path, the second error is because the feature was renamed to proc_macro_tracked_path.

This affects at least sqlx 0.8.x and 0.9.0-alpha.1. On 0.9.0-alpha.1, the compiler additionally complains about the change from proc_macro::tracked_env::var to proc_macro::tracked::env_var as well as about a use of unresolved module or unlinked crate 'proc_macro'. I'm not sure whether the unresolved module issue is related to the feature structure changes:

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `proc_macro`
  --> /home/marrue/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-macros-core-0.9.0-alpha.1/src/query/cache.rs:74:13
   |
74 |             proc_macro::tracked_path::path(&path);
   |             ^^^^^^^^^^ use of unresolved module or unlinked crate `proc_macro`
   |
help: there is a crate or module with a similar name
   |
74 |             proc_macro2::tracked_path::path(&path);
   |                       +

error[E0433]: failed to resolve: could not find `tracked_path` in `proc_macro`
   --> /home/marrue/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-macros-core-0.9.0-alpha.1/src/migrate.rs:135:21
    |
135 |         proc_macro::tracked_path::path(path);
    |                     ^^^^^^^^^^^^ could not find `tracked_path` in `proc_macro`

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `proc_macro`
  --> /home/marrue/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-macros-core-0.9.0-alpha.1/src/lib.rs:99:41
   |
99 |     let res: Result<String, VarError> = proc_macro::tracked_env::var(var);
   |                                         ^^^^^^^^^^ use of unresolved module or unlinked crate `proc_macro`
   |
help: there is a crate or module with a similar name
   |
99 |     let res: Result<String, VarError> = proc_macro2::tracked_env::var(var);
   |                                                   +

error[E0635]: unknown feature `track_path`
  --> /home/marrue/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-macros-core-0.9.0-alpha.1/src/lib.rs:19:13
   |
19 |     feature(track_path)
   |             ^^^^^^^^^^

Some errors have detailed explanations: E0433, E0635.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `sqlx-macros-core` (lib) due to 4 previous errors

Reproduction steps

As far as I can tell, compiling any crate using sqlx macros on latest nightly with --cfg=sqlx_macros_unstable should reproduce this.

SQLx version

Tested for 0.8.6, 0.9.0-alpha.1

Enabled SQLx features

"postgres", "runtime-tokio", "time"

Database server and version

PostgreSQL 18.0 (Debian 18.0-1.pgdg13+3)

Operating system

Linux

Rust version

rustc 1.95.0-nightly (d222ddc4d 2026-01-23)

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions