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

Improve handling of simultaneous rlibs and dylibs #12164

Merged
merged 1 commit into from
Feb 21, 2014

Conversation

alexcrichton
Copy link
Member

The first commit improves error messages during linking, and the second commit improves error messages during crate-loading time.

Closes #12297
Closes #12377

@emberian
Copy link
Member

r=me with typo fix

This commit rewrites crate loading internally in attempt to look at less
metadata and provide nicer errors. The loading is now split up into a few
stages:

1. Collect a mapping of (hash => ~[Path]) for a set of candidate libraries for a
   given search. The hash is the hash in the filename and the Path is the
   location of the library in question. All candidates are filtered based on
   their prefix/suffix (dylib/rlib appropriate) and then the hash/version are
   split up and are compared (if necessary).

   This means that if you're looking for an exact hash of library you don't have
   to open up the metadata of all libraries named the same, but also in your
   path.

2. Once this mapping is constructed, each (hash, ~[Path]) pair is filtered down
   to just a Path. This is necessary because the same rlib could show up twice
   in the path in multiple locations. Right now the filenames are based on just
   the crate id, so this could be indicative of multiple version of a crate
   during one crate_id lifetime in the path. If multiple duplicate crates are
   found, an error is generated.

3. Now that we have a mapping of (hash => Path), we error on multiple versions
   saying that multiple versions were found. Only if there's one (hash => Path)
   pair do we actually return that Path and its metadata.

With this restructuring, it restructures code so errors which were assertions
previously are now first-class errors. Additionally, this should read much less
metadata with lots of crates of the same name or same version in a path.

Closes rust-lang#11908
bors added a commit that referenced this pull request Feb 21, 2014
The first commit improves error messages during linking, and the second commit improves error messages during crate-loading time.

Closes #12297
Closes #12377
@bors bors closed this Feb 21, 2014
@bors bors merged commit afa5f57 into rust-lang:master Feb 21, 2014
@alexcrichton alexcrichton deleted the rlibs-and-dylibs branch February 21, 2014 04:44
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
internal: Remove `unqualified_path` completions module

cc rust-lang/rust-analyzer#12144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler error when referencing crate "glfw-rs" Unexpected internal compiler error using incompatible rlib
3 participants