Add named path bases to cargo (v2) by dpaoliello · Pull Request #3529 · rust-lang/rfcs (original) (raw)

We discussed this in today's @rust-lang/cargo meeting. We were generally in favor, but wanted to see a few changes made.

@rfcbot merge

First, this should be base-paths, rather than base_path, for consistency with other manifest fields which use plurals and dashes.

@rfcbot concern rename-to-base-paths

Second, it should be possible to define this in Cargo.toml, not only in config.toml. config.toml or environment variables can always override, but Cargo.toml should be able to define the default values.

@rfcbot concern define-in-manifest-override-in-config

Third, we should restrict the possible names for bases, to reserve space for extension in the future. We felt that base names should be restricted to the same naming as package names: "The name must use only alphanumeric characters or - or _, and cannot be empty."

@rfcbot concern base-names-alphanumeric-with-dash-or-underscore

Finally, this should define a mechanism for Cargo to provide built-in base paths. User-defined base paths should shadow built-in base paths, so that we can add more in the future without creating conflicts. And we should provide a built-in workspace base path that refers to your workspace root.

@rfcbot concern allow-built-in-base-paths-with-shadowing
@rfcbot concern define-built-in-workspace-base-path