Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo: prevent dashes in lib.name #12783

Merged
merged 3 commits into from
Mar 16, 2024
Merged

cargo: prevent dashes in lib.name #12783

merged 3 commits into from
Mar 16, 2024

Commits on Oct 17, 2023

  1. cargo/manifest: remember whether target names were inferred

    Add a boolean state to `Target` that tells us whether the name of the
    target was inferred by Cargo, or whether it was directly specified in
    the Manifest.
    
    This value will be required in the future, to allow changing the
    inferred names of targets, but retaining enough information to keep
    backwards compatibility.
    dvdhrm committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    8bcc0fa View commit details
    Browse the repository at this point in the history
  2. cargo/artifact: prepare compatibility env-vars

    We are about to change the default value for target-names of libraries.
    They used to match the package-name. In the future, they will use the
    package-name with dashes converted to underscores. This will affect the
    artifact env-variables, since they expose target-names. Hence, set the
    old env-vars, too, to avoid breakage.
    
    Note that we do not retain the name of a target before it was converted,
    and the conversion is lossy, so we cannot reconstruct it. However, we
    can rely on the fact that the conversion only happens for default values
    (since user-supplied values never allowed dashes). Furthermore, we now
    remember whether a target-name was inferred, so we can exactly
    reconstruct whether a library-target could have contained dashes in
    older releases, or not.
    dvdhrm committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    8b2cc62 View commit details
    Browse the repository at this point in the history
  3. cargo: prevent dashes in lib.name

    The TOML parser of Cargo currently refuses `lib.name` entries that
    contain dashes. Unfortunately, it uses the package-name as default if no
    explicit `lib.name` entry is specified. This package-name, however, can
    contain dashes.
    
    Cargo documentation states that the package name is converted first, yet
    this was never implemented by the code-base.
    
    Fix this inconsistency and convert the package name to a suitable
    crate-name first.
    dvdhrm committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    3ca04e2 View commit details
    Browse the repository at this point in the history