<p dir="auto">The problem is, of course, as follows:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import names::{Alice, Bob};
...
match name {
    Alice =&gt; ...,
    Bob   =&gt; ...,
    Carol =&gt; ..., // &lt;- treated as a variable because of forgotten import
    _     =&gt; ..., //~ WARNING unreachable pattern
}"><pre class="notranslate"><code class="notranslate">import names::{Alice, Bob};
...
match name {
    Alice =&gt; ...,
    Bob   =&gt; ...,
    Carol =&gt; ..., // &lt;- treated as a variable because of forgotten import
    _     =&gt; ..., //~ WARNING unreachable pattern
}
</code></pre></div>
<p dir="auto">or:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="match name {
    Alice =&gt; ...,
    Bob | Carol =&gt; ..., //~ ERROR variable Carol not bound in all patterns
}"><pre class="notranslate"><code class="notranslate">match name {
    Alice =&gt; ...,
    Bob | Carol =&gt; ..., //~ ERROR variable Carol not bound in all patterns
}
</code></pre></div>
<p dir="auto">We should be able to emit a hint that says something like <code class="notranslate">Maybe you forgot to import </code>Carol<code class="notranslate">?</code>.</p>
<p dir="auto">Right now the compiler has one lookup path, defined by <code class="notranslate">-L</code> and <code class="notranslate">RUST_PATH</code>. 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:</p>
<ul dir="auto">
<li>A lookup path to find native libraries for inclusion in rlibs</li>
<li>A lookup path to find <code class="notranslate">extern crate</code> dependencies</li>
<li>A lookup path to find transitive dependencies of <code class="notranslate">extern crate</code> directives.</li>
</ul>
<p dir="auto">Conflating all of these concepts into one lookup path leads to bugs such as <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="51755200" data-permission-text="Title is private" data-url="https://github.com/rust-lang/cargo/issues/1037" data-hovercard-type="issue" data-hovercard-url="/rust-lang/cargo/issues/1037/hovercard" href="https://github.com/rust-lang/cargo/issues/1037">rust-lang/cargo#1037</a> and <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="39910179" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/16402" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/16402/hovercard" href="https://github.com/rust-lang/rust/issues/16402">#16402</a> which would benefit greatly from distinct sets of lookup paths.</p>
<p dir="auto">I would initially propose something like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    -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."><pre class="notranslate"><code class="notranslate">    -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.
</code></pre></div>
<p dir="auto">Using this, cargo itself would only pass <code class="notranslate">-L dependency=...</code>, build scripts would pass <code class="notranslate">-L native=...</code>, and normal uses of the compiler would continue just using <code class="notranslate">-L</code>. This behavior is also backwards compatible with today's semantics.</p>
<p dir="auto">I'd like to nominate this issue, however, as <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="51755200" data-permission-text="Title is private" data-url="https://github.com/rust-lang/cargo/issues/1037" data-hovercard-type="issue" data-hovercard-url="/rust-lang/cargo/issues/1037/hovercard" href="https://github.com/rust-lang/cargo/issues/1037">rust-lang/cargo#1037</a> is quite a worrying issue which needs to be solved as part of Cargo's stability story.</p>