rustc: Add knowledge of separate lookup paths #19941
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds support for the compiler to distinguish between different forms
of lookup paths in the compiler itself. Issue #19767 has some background on this
topic, as well as some sample bugs which can occur if these lookup paths are not
separated.
This commits extends the existing command line flag
-L
with the same trailingsyntax as the
-l
flag. Each argument to-L
can now have a trailing:all
,:native
,:crate
, or:dependency
. This suffix indicates what form of lookuppath the compiler should add the argument to. The
dependency
lookup path isused when looking up crate dependencies, the
crate
lookup path is used whenlooking for immediate dependencies (
extern crate
statements), and thenative
lookup path is used for probing for native libraries to insert into rlibs. Paths
with
all
are used for all of these purposes (the default).The default compiler lookup path (the rustlib libdir) is by default added to all
of these paths. Additionally, the
RUST_PATH
lookup path is added to all ofthese paths.
Closes #19767