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

Change what's allowed in extern mod directives #6407

Closed
catamorphism opened this issue May 10, 2013 · 7 comments
Closed

Change what's allowed in extern mod directives #6407

catamorphism opened this issue May 10, 2013 · 7 comments
Labels
A-grammar Area: The grammar of Rust A-linkage Area: linking into static, shared libraries and binaries A-Unicode Area: Unicode

Comments

@catamorphism
Copy link
Contributor

Sub-bug of #5677

Currently, extern mod directives take an identifier, like: extern mod foo;. We need to instead allow two different forms of extern 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 the foo = in the first case would be a usage error, since the stem of the URL fragment is not a valid identifier (it contains hyphens).

@ghost ghost assigned catamorphism May 10, 2013
catamorphism added a commit to catamorphism/rust that referenced this issue May 15, 2013
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.
bors added a commit that referenced this issue May 15, 2013
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.
catamorphism added a commit to catamorphism/rust that referenced this issue May 29, 2013
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
Copy link
Contributor Author

For now we're going to say extern mod foo (id = "github.com/catamorphism/an-awesome-package-called-foo");, since that syntax is already supported. Leaving this bug open but not blocking on it.

catamorphism added a commit to catamorphism/rust that referenced this issue May 30, 2013
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.
catamorphism added a commit to catamorphism/rust that referenced this issue Jun 2, 2013
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.
catamorphism added a commit to catamorphism/rust that referenced this issue Jun 12, 2013
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.
@emberian
Copy link
Member

@catamorphism can this be removed from 0.7 if the syntax isn't an issue?

@catamorphism
Copy link
Contributor Author

@cmr Right, forgot about that. Cleared milestone.

@graydon
Copy link
Contributor

graydon commented Jun 26, 2013

Note: 'foo' is not the short name of the package you compile; it's just the local in-crate binding.

@bblum
Copy link
Contributor

bblum commented Jul 3, 2013

nominating backwards-compatible milestone

@catamorphism
Copy link
Contributor Author

Done pending #8176

@catamorphism
Copy link
Contributor Author

Forgot to close this.

@catamorphism catamorphism removed their assignment Jun 16, 2014
flip1995 added a commit to flip1995/rust that referenced this issue Dec 6, 2020
…arth

CONTRIBUTING: update bors queue url from buildbot2.rlo to bors.rlo

changelog: CONTRIBUTING: update homu links to bors.rust-lang.org
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 6, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-grammar Area: The grammar of Rust A-linkage Area: linking into static, shared libraries and binaries A-Unicode Area: Unicode
Projects
None yet
Development

No branches or pull requests

4 participants