Skip to content

Compute does not build with --no-default-features #6220

Closed

Description

@dbolduc

Repro:

cargo new test-compute && cd test-compute
cargo add google-cloud-compute-v1 --no-default-features
cargo build
Output:
error[E0432]: unresolved imports `crate::model::InstancesBulkInsertOperationMetadata`, `crate::model::SetCommonInstanceMetadataOperationMetadata`
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/errors.rs:16:5
       |
    16 |     InstancesBulkInsertOperationMetadata, SetCommonInstanceMetadataOperationMetadata,
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `SetCommonInstanceMetadataOperationMetadata` in `model`
       |     |
       |     no `InstancesBulkInsertOperationMetadata` in `model`
       |
note: found an item that was configured out
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/model.rs:159288:12
       |
159174 |   #[cfg(any(
       |  __________-
159175 | |     feature = "addresses",
159176 | |     feature = "autoscalers",
159177 | |     feature = "backend-buckets",
...      |
159284 | |     feature = "zone-vm-extension-policies",
159285 | | ))]
       | |_- the item is gated here
...
159288 |   pub struct InstancesBulkInsertOperationMetadata {
       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: found an item that was configured out
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/model.rs:359762:12
       |
359648 |   #[cfg(any(
       |  __________-
359649 | |     feature = "addresses",
359650 | |     feature = "autoscalers",
359651 | |     feature = "backend-buckets",
...      |
359758 | |     feature = "zone-vm-extension-policies",
359759 | | ))]
       | |_- the item is gated here
...
359762 |   pub struct SetCommonInstanceMetadataOperationMetadata {
       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `crate::model::Operation`
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/operation.rs:15:5
       |
    15 | use crate::model::Operation;
       |     ^^^^^^^^^^^^^^^^^^^^^^^ no `Operation` in `model`
       |
note: found an item that was configured out
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/model.rs:253564:12
       |
253450 |   #[cfg(any(
       |  __________-
253451 | |     feature = "addresses",
253452 | |     feature = "autoscalers",
253453 | |     feature = "backend-buckets",
...      |
253560 | |     feature = "zone-vm-extension-policies",
253561 | | ))]
       | |_- the item is gated here
...
253564 |   pub struct Operation {
       |              ^^^^^^^^^

error[E0433]: failed to resolve: could not find `operation` in `model`
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/errors.rs:114:39
       |
   114 |     pub details: Option<crate::model::operation::Error>,
       |                                       ^^^^^^^^^ could not find `operation` in `model`
       |
note: found an item that was configured out
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/model.rs:254883:9
       |
254771 |   #[cfg(any(
       |  __________-
254772 | |     feature = "addresses",
254773 | |     feature = "autoscalers",
254774 | |     feature = "backend-buckets",
...      |
254881 | |     feature = "zone-vm-extension-policies",
254882 | | ))]
       | |_- the item is gated here
254883 |   pub mod operation {
       |           ^^^^^^^^^

error[E0433]: failed to resolve: could not find `operation` in `model`
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/errors.rs:162:46
       |
   162 | ...::model::operation::Error>>(mut self, v: V) -> Self {
       |             ^^^^^^^^^ could not find `operation` in `model`
       |
note: found an item that was configured out
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/model.rs:254883:9
       |
254771 |   #[cfg(any(
       |  __________-
254772 | |     feature = "addresses",
254773 | |     feature = "autoscalers",
254774 | |     feature = "backend-buckets",
...      |
254881 | |     feature = "zone-vm-extension-policies",
254882 | | ))]
       | |_- the item is gated here
254883 |   pub mod operation {
       |           ^^^^^^^^^

error[E0425]: cannot find type `Operation` in module `crate::model`
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/errors.rs:19:20
       |
    19 | impl crate::model::Operation {
       |                    ^^^^^^^^^ not found in `crate::model`
       |
note: found an item that was configured out
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/model.rs:253564:12
       |
253450 |   #[cfg(any(
       |  __________-
253451 | |     feature = "addresses",
253452 | |     feature = "autoscalers",
253453 | |     feature = "backend-buckets",
...      |
253560 | |     feature = "zone-vm-extension-policies",
253561 | | ))]
       | |_- the item is gated here
...
253564 |   pub struct Operation {
       |              ^^^^^^^^^

error[E0433]: failed to resolve: could not find `operation` in `model`
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/operation.rs:23:43
       |
    23 |         self.status == Some(crate::model::operation::Status::Done)
       |                                           ^^^^^^^^^ could not find `operation` in `model`
       |
note: found an item that was configured out
      --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/model.rs:254883:9
       |
254771 |   #[cfg(any(
       |  __________-
254772 | |     feature = "addresses",
254773 | |     feature = "autoscalers",
254774 | |     feature = "backend-buckets",
...      |
254881 | |     feature = "zone-vm-extension-policies",
254882 | | ))]
       | |_- the item is gated here
254883 |   pub mod operation {
       |           ^^^^^^^^^
help: consider importing one of these structs
       |
    15 + use gaxi::grpc::tonic::Status;
       |
    15 + use google_cloud_gax::error::rpc::Status;
       |
    15 + use google_cloud_rpc::model::Status;
       |
help: if you import `Status`, refer to it directly
       |
    23 -         self.status == Some(crate::model::operation::Status::Done)
    23 +         self.status == Some(Status::Done)
       |

error[E0282]: type annotations needed
  --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/errors.rs:26:61
   |
26 | ...).fold(error, |e, v| e.set_details(v));
   |                   ^     - type must be known at this point
   |
help: consider giving this closure parameter an explicit type
   |
26 |             let error = self.error.into_iter().fold(error, |e: /* Type */, v| e.set_details(v));
   |                                                              ++++++++++++

error[E0282]: type annotations needed
  --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/errors.rs:30:31
   |
30 |                 .fold(error, |e, v| e.set_status_code(v));
   |                               ^     - type must be known at this point
   |
help: consider giving this closure parameter an explicit type
   |
30 |                 .fold(error, |e: /* Type */, v| e.set_status_code(v));
   |                                ++++++++++++

error[E0282]: type annotations needed
  --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/errors.rs:34:31
   |
34 |                 .fold(error, |e, v| e.set_message(v));
   |                               ^     - type must be known at this point
   |
help: consider giving this closure parameter an explicit type
   |
34 |                 .fold(error, |e: /* Type */, v| e.set_message(v));
   |                                ++++++++++++

error[E0282]: type annotations needed
  --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/operation.rs:59:30
   |
59 |                 code = match err_code.as_str() {
   |                              ^^^^^^^^ cannot infer type

error[E0282]: type annotations needed
  --> /usr/local/google/home/dbolduc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/google-cloud-compute-v1-3.3.0/src/operation.rs:65:27
   |
65 |                 message = err_msg.clone();
   |                           ^^^^^^^ cannot infer type

Some errors have detailed explanations: E0282, E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0282`.
error: could not compile `google-cloud-compute-v1` (lib) due to 11 previous errors

We probably want to gate the extra modules as an OR over the PerServiceFearures.

Activity

  1. added theissue type on Jul 29, 2026
  2. suzmue commented on Aug 13, 2026

    @suzmue
    Contributor

    Note that this also is a problem for specific features, not just --no-default-features:

    cargo check -p google-cloud-compute-v1 --no-default-features --features accelerator-types
    
    Output:
    error[E0432]: unresolved imports `crate::model::InstancesBulkInsertOperationMetadata`, `crate::model::SetCommonInstanceMetadataOperationMetadata`
          --> src/generated/cloud/compute/v1/src/errors.rs:16:5
           |
        16 |     InstancesBulkInsertOperationMetadata, SetCommonInstanceMetadataOperationMetadata,
           |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `SetCommonInstanceMetadataOperationMetadata` in `model`
           |     |
           |     no `InstancesBulkInsertOperationMetadata` in `model`
           |
    note: found an item that was configured out
          --> src/generated/cloud/compute/v1/src/model.rs:161862:12
           |
    161747 |   #[cfg(any(
           |  __________-
    161748 | |     feature = "addresses",
    161749 | |     feature = "autoscalers",
    161750 | |     feature = "backend-buckets",
    ...      |
    161858 | |     feature = "zone-vm-extension-policies",
    161859 | | ))]
           | |_- the item is gated here
    ...
    161862 |   pub struct InstancesBulkInsertOperationMetadata {
           |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    note: found an item that was configured out
          --> src/generated/cloud/compute/v1/src/model.rs:367042:12
           |
    366927 |   #[cfg(any(
           |  __________-
    366928 | |     feature = "addresses",
    366929 | |     feature = "autoscalers",
    366930 | |     feature = "backend-buckets",
    ...      |
    367038 | |     feature = "zone-vm-extension-policies",
    367039 | | ))]
           | |_- the item is gated here
    ...
    367042 |   pub struct SetCommonInstanceMetadataOperationMetadata {
           |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error[E0432]: unresolved import `crate::model::Operation`
          --> src/generated/cloud/compute/v1/src/operation.rs:15:5
           |
        15 | use crate::model::Operation;
           |     ^^^^^^^^^^^^^^^^^^^^^^^ no `Operation` in `model`
           |
    note: found an item that was configured out
          --> src/generated/cloud/compute/v1/src/model.rs:256781:12
           |
    256666 |   #[cfg(any(
           |  __________-
    256667 | |     feature = "addresses",
    256668 | |     feature = "autoscalers",
    256669 | |     feature = "backend-buckets",
    ...      |
    256777 | |     feature = "zone-vm-extension-policies",
    256778 | | ))]
           | |_- the item is gated here
    ...
    256781 |   pub struct Operation {
           |              ^^^^^^^^^
    
    error[E0433]: cannot find `operation` in `model`
          --> src/generated/cloud/compute/v1/src/errors.rs:114:39
           |
       114 |     pub details: Option<crate::model::operation::Error>,
           |                                       ^^^^^^^^^ could not find `operation` in `model`
           |
    note: found an item that was configured out
          --> src/generated/cloud/compute/v1/src/model.rs:258103:9
           |
    257990 |   #[cfg(any(
           |  __________-
    257991 | |     feature = "addresses",
    257992 | |     feature = "autoscalers",
    257993 | |     feature = "backend-buckets",
    ...      |
    258101 | |     feature = "zone-vm-extension-policies",
    258102 | | ))]
           | |_- the item is gated here
    258103 |   pub mod operation {
           |           ^^^^^^^^^
    
    error[E0433]: cannot find `operation` in `model`
          --> src/generated/cloud/compute/v1/src/errors.rs:162:46
           |
       162 |     pub fn set_details<V: Into<crate::model::operation::Error>>(mut self, v: V) -> Self {
           |                                              ^^^^^^^^^ could not find `operation` in `model`
           |
    note: found an item that was configured out
          --> src/generated/cloud/compute/v1/src/model.rs:258103:9
           |
    257990 |   #[cfg(any(
           |  __________-
    257991 | |     feature = "addresses",
    257992 | |     feature = "autoscalers",
    257993 | |     feature = "backend-buckets",
    ...      |
    258101 | |     feature = "zone-vm-extension-policies",
    258102 | | ))]
           | |_- the item is gated here
    258103 |   pub mod operation {
           |           ^^^^^^^^^
    
    error[E0433]: cannot find `operation` in `model`
          --> src/generated/cloud/compute/v1/src/operation.rs:23:43
           |
        23 |         self.status == Some(crate::model::operation::Status::Done)
           |                                           ^^^^^^^^^ could not find `operation` in `model`
           |
    note: found an item that was configured out
          --> src/generated/cloud/compute/v1/src/model.rs:258103:9
           |
    257990 |   #[cfg(any(
           |  __________-
    257991 | |     feature = "addresses",
    257992 | |     feature = "autoscalers",
    257993 | |     feature = "backend-buckets",
    ...      |
    258101 | |     feature = "zone-vm-extension-policies",
    258102 | | ))]
           | |_- the item is gated here
    258103 |   pub mod operation {
           |           ^^^^^^^^^
    
    error[E0425]: cannot find type `Operation` in module `crate::model`
          --> src/generated/cloud/compute/v1/src/errors.rs:19:20
           |
        19 | impl crate::model::Operation {
           |                    ^^^^^^^^^ not found in `crate::model`
           |
    note: found an item that was configured out
          --> src/generated/cloud/compute/v1/src/model.rs:256781:12
           |
    256666 |   #[cfg(any(
           |  __________-
    256667 | |     feature = "addresses",
    256668 | |     feature = "autoscalers",
    256669 | |     feature = "backend-buckets",
    ...      |
    256777 | |     feature = "zone-vm-extension-policies",
    256778 | | ))]
           | |_- the item is gated here
    ...
    256781 |   pub struct Operation {
           |              ^^^^^^^^^
    
    Some errors have detailed explanations: E0425, E0432, E0433.
    For more information about an error, try `rustc --explain E0425`.
    error: could not compile `google-cloud-compute-v1` (lib) due to 6 previous errors
    
    

    I think it is worth prioritizing a fix to this since needing to enable an unrelated feature is a bad user experience (if it only affected --no-default-features I think it would be ok to deprioritize since that is not a useful build of the crate anyway).

  3. self-assigned this
    on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: computeIssues related to the Compute Engine API.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions