Skip to content

config errors with alias may not be reported #11013

Closed
@ehuss

Description

@ehuss

Problem

If there is a syntax error in a .cargo/config file, and the user tries to run an alias command, there is no indication of why it failed to find the alias.

Steps

  1. Create a .cargo/config:

    [alias]
    foo = ["a" "b"]

    Notice the missing comma.

  2. Run cargo foo

  3. Observe the output:

    error: no such subcommand: `foo`
    
         Did you mean `doc`?
    

    At this point, it isn't immediately clear what went wrong.

Possible Solution(s)

If there is an error loading the config, and cargo is unable to find the command to run, then it should probably relay the config error to the user.

There may be other situations where it might be useful to relay the config error. For example, if I have an alias like clippy, and the config fails to load, cargo will go ahead and run clippy without the aliased arguments.

I'm not sure when and how it would be best to relay the information about the malformed config. It also may be difficult to plumb the error up to the alias-handling code.

Notes

No response

Version

cargo 1.65.0-nightly (9809f8ff3 2022-08-16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-aliasesArea: command aliasesA-configurationArea: cargo config files and env varsA-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions