Skip to content

Compiler lookup path separation #19767

@alexcrichton

Description

@alexcrichton

Right now the compiler has one lookup path, defined by -L and RUST_PATH. This one lookup path is used for many different purposes, leading to a number of conflicts. In the compiler today there are a number of distinct concepts of lookup paths, including:

  • A lookup path to find native libraries for inclusion in rlibs
  • A lookup path to find extern crate dependencies
  • A lookup path to find transitive dependencies of extern crate directives.

Conflating all of these concepts into one lookup path leads to bugs such as rust-lang/cargo#1037 and #16402 which would benefit greatly from distinct sets of lookup paths.

I would initially propose something like:

    -L [KIND=]PATH      Add a directory to the compiler's search paths. The
                        KIND provided may be omitted or one of `crate`,
                        `native`, or `dependency`. Each value adds the lookup
                        path to a separate lookup path in the compiler, and if
                        omitted the path is added to all lookup paths.

Using this, cargo itself would only pass -L dependency=..., build scripts would pass -L native=..., and normal uses of the compiler would continue just using -L. This behavior is also backwards compatible with today's semantics.

I'd like to nominate this issue, however, as rust-lang/cargo#1037 is quite a worrying issue which needs to be solved as part of Cargo's stability story.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions