-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Change what's allowed in extern mod
directives
#6407
Comments
This patch implements package IDs like github.com/catamorphism/test-pkg. To support such package IDs, I changed the PkgId struct to contain a LocalPath and a RemotePath field, where the RemotePath reflects the actual URL and the LocalPath reflects the file name of the cached copy. Right now, the only difference is that the local path doesn't contain dashes, but this will change when we implement rust-lang#6407. Also, PkgIds now have a short_name field -- though the short name can be derived from the LocalPath, I thought it was cleaner not to call option::get() wantonly.
r? @brson This patch implements package IDs like github.com/catamorphism/test-pkg. To support such package IDs, I changed the PkgId struct to contain a LocalPath and a RemotePath field, where the RemotePath reflects the actual URL and the LocalPath reflects the file name of the cached copy. Right now, the only difference is that the local path doesn't contain dashes, but this will change when we implement #6407. Also, PkgIds now have a short_name field -- though the short name can be derived from the LocalPath, I thought it was cleaner not to call option::get() wantonly.
This commit won't be quite as useful until I implement RUST_PATH and until we change `extern mod` to take a general string instead of an identifier (rust-lang#5682 and rust-lang#6407). With that said, now if you're using rustpkg and a program contains: extern mod foo; rustpkg will attempt to search for `foo`, so that you don't have to provide a -L directory explicitly. In addition, rustpkg will actually try to build and install `foo`, unless it's already installed (specifically, I tested that `extern mod extra;` would not cause it to try to find source for `extra` and compile it again). This is as per rust-lang#5681. Incidentally, I changed some driver code to infer the link name from the crate link_meta attributes. If that change isn't ok, say something.
For now we're going to say |
This commit won't be quite as useful until I implement RUST_PATH and until we change `extern mod` to take a general string instead of an identifier (rust-lang#5682 and rust-lang#6407). With that said, now if you're using rustpkg and a program contains: extern mod foo; rustpkg will attempt to search for `foo`, so that you don't have to provide a -L directory explicitly. In addition, rustpkg will actually try to build and install `foo`, unless it's already installed (specifically, I tested that `extern mod extra;` would not cause it to try to find source for `extra` and compile it again). This is as per rust-lang#5681. Incidentally, I changed some driver code to infer the link name from the crate link_meta attributes. If that change isn't ok, say something. Also, I changed the addl_lib_search_paths field in the session options to be an @mut ~[Path] so that it can be modified after expansion but before later phases.
This commit won't be quite as useful until I implement RUST_PATH and until we change `extern mod` to take a general string instead of an identifier (rust-lang#5682 and rust-lang#6407). With that said, now if you're using rustpkg and a program contains: extern mod foo; rustpkg will attempt to search for `foo`, so that you don't have to provide a -L directory explicitly. In addition, rustpkg will actually try to build and install `foo`, unless it's already installed (specifically, I tested that `extern mod extra;` would not cause it to try to find source for `extra` and compile it again). This is as per rust-lang#5681. Incidentally, I changed some driver code to infer the link name from the crate link_meta attributes. If that change isn't ok, say something. Also, I changed the addl_lib_search_paths field in the session options to be an @mut ~[Path] so that it can be modified after expansion but before later phases.
This commit won't be quite as useful until I implement RUST_PATH and until we change `extern mod` to take a general string instead of an identifier (rust-lang#5682 and rust-lang#6407). With that said, now if you're using rustpkg and a program contains: extern mod foo; rustpkg will attempt to search for `foo`, so that you don't have to provide a -L directory explicitly. In addition, rustpkg will actually try to build and install `foo`, unless it's already installed (specifically, I tested that `extern mod extra;` would not cause it to try to find source for `extra` and compile it again). This is as per rust-lang#5681. Incidentally, I changed some driver code to infer the link name from the crate link_meta attributes. If that change isn't ok, say something.
@catamorphism can this be removed from 0.7 if the syntax isn't an issue? |
@cmr Right, forgot about that. Cleared milestone. |
Note: 'foo' is not the short name of the package you compile; it's just the local in-crate binding. |
nominating backwards-compatible milestone |
Done pending #8176 |
Forgot to close this. |
…arth CONTRIBUTING: update bors queue url from buildbot2.rlo to bors.rlo changelog: CONTRIBUTING: update homu links to bors.rust-lang.org
Rollup of 4 pull requests Successful merges: - rust-lang#6308 (add `internal-lints` feature to enable clippys internal lints (off by default)) - rust-lang#6395 (switch Version/VersionReq usages to RustcVersion ) - rust-lang#6402 (Add Collapsible match lint) - rust-lang#6407 (CONTRIBUTING: update bors queue url from buildbot2.rlo to bors.rlo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup changelog: rollup
Sub-bug of #5677
Currently,
extern mod
directives take an identifier, like:extern mod foo;
. We need to instead allow two different forms ofextern mod
:First,
extern mod foo = "github.com/catamorphism/an-awesome-package-called-foo";
Second,
extern mod "github.com/catamorphism/a_valid_identifier";
In the first case, you specify that
foo
is the short name for the package at the URL (or URL-fragment) on the right-hand side of the =. This allows remote paths to contain any Unicode characters while also associating the package with a valid Rust identifier.In the second case, rustpkg guesses that
a_valid_identifier
is the short name. Omitting thefoo =
in the first case would be a usage error, since the stem of the URL fragment is not a valid identifier (it contains hyphens).The text was updated successfully, but these errors were encountered: