Skip to content

Unhelpful error messages with env-vars that don't set all fields of a config struct #13688

Closed
@Nemo157

Description

@Nemo157

Problem

I have been using the gitoxide integration for a while, via setting env-vars so it doesn't impact running the stable compiler:

CARGO_UNSTABLE_GITOXIDE_CHECKOUT=true
CARGO_UNSTABLE_GITOXIDE_FETCH=true
CARGO_UNSTABLE_GITOXIDE_INTERNAL_USE_GIT2=false
CARGO_UNSTABLE_GITOXIDE_SHALLOW_DEPS=true
CARGO_UNSTABLE_GITOXIDE_SHALLOW_INDEX=true

After updating to a version that includes #13592 any usage of cargo starts failing with

> cargo test -- --ignored zero_byte
error: missing field `list_files`

which makes no mention of where this field is missing

Steps

> CARGO_UNSTABLE_GITOXIDE_FETCH=true cargo build
error: missing field `list_files`

Possible Solution(s)

No response

Notes

#13687 will likely fix this specific issue by making the fields of this struct default, but the general issue of the error message not having enough context will remain.

Version

cargo 1.79.0-nightly (a59aba136 2024-03-28)
release: 1.79.0-nightly
commit-hash: a59aba136aab5510c16b0750a36cbd9916f91796
commit-date: 2024-03-28
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: NixOS 23.11.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env varsA-diagnosticsArea: Error and warning messages generated by Cargo itself.A-environment-variablesArea: environment variablesC-bugCategory: bugS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions