Skip to content

Building diesel fails using resolver = "2" #9450

@weiznich

Description

@weiznich

Problem
Building diesel with resolver = "2" enabled fails, while builds using the old resolver succeed. It's unclear from the documentation if something in diesel needs to be changed or if this is a bug in the new resolver. See diesel-rs/diesel#2753 for the initial report.

I believe that this is an issue in cargo rather than in diesel for the following reason:

Building with resolver = "2" issues the following rustc invocation:

rustc --crate-name diesel ~/.cargo/registry/github.com-1ecc6299db9ec823/diesel-1.4.6/src/lib.rs 
--error-format=json 
--json=diagnostic-rendered-ansi,artifacts 
--crate-type lib 
--emit=dep-info,metadata,link 
-C embed-bitcode=no 
-C debuginfo=2 
-C metadata=8e83eb228db88a74 
-C extra-filename=-8e83eb228db88a74 
--out-dir /tmp/diesel-issue/target/debug/deps 
-L dependency=/tmp/diesel-issue/target/debug/deps 
--extern byteorder=/tmp/diesel-issue/target/debug/deps/libbyteorder-3ba0d986ba1f8d3d.rmeta 
--extern diesel_derives=/tmp/diesel-issue/target/debug/deps/libdiesel_derives-d5f5028a84dbe804.so 
--cap-lints allow 

which misses all specified and default features for diesel.

Building without resolver = "2" issues the following rustc invocation:

rustc --crate-name diesel ~/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-1.4.6/src/lib.rs 
--error-format=json 
--json=diagnostic-rendered-ansi,artifacts 
--crate-type lib 
--emit=dep-info,metadata,link 
-C embed-bitcode=no 
-C debuginfo=2 
--cfg 'feature="32-column-tables"' 
--cfg 'feature="bitflags"' 
--cfg 'feature="default"' 
--cfg 'feature="postgres"' 
--cfg 'feature="pq-sys"' 
--cfg 'feature="with-deprecated"' 
-C metadata=e4c51cf46b9b40ed 
-C extra-filename=-e4c51cf46b9b40ed 
--out-dir /tmp/diesel-issue/target/debug/deps 
-L dependency=/tmp/diesel-issue/target/debug/deps 
--extern bitflags=/tmp/diesel-issue/target/debug/deps/libbitflags-2a943fc4d3e795d7.rmeta 
--extern byteorder=/tmp/diesel-issue/target/debug/deps/libbyteorder-3ba0d986ba1f8d3d.rmeta 
--extern diesel_derives=/tmp/diesel-issue/target/debug/deps/libdiesel_derives-d5f5028a84dbe804.so 
--extern pq_sys=/tmp/diesel-issue/target/debug/deps/libpq_sys-2f8097271b957b37.rmeta 
--cap-lints allow 
-L native=/usr/lib/x86_64-linux-gnu

which contains the specified feature flags.

Steps

  1. Clone this repository. (Or create a new project depending on diesel, enabling the "postgres" feature for diesel)
  2. Change into the project directory
  3. Issue cargo check

Notes

Output of cargo version:

cargo 1.51.0 (43b129a20 2021-03-16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-features2Area: issues specifically related to the v2 feature resolverC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions