Skip to content

Change what's allowed in extern mod directives #6407

Closed

Description

@catamorphism

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).

Activity

  1. added a commit that references this issue on May 15, 2013
  2. catamorphism commented on May 29, 2013

    @catamorphism
    ContributorAuthor

    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.

  3. emberian commented on Jun 25, 2013

    @emberian
    Contributor

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

  4. catamorphism commented on Jun 25, 2013

    @catamorphism
    ContributorAuthor

    @cmr Right, forgot about that. Cleared milestone.

  5. graydon commented on Jun 26, 2013

    @graydon
    Contributor

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

  6. bblum commented on Jul 3, 2013

    @bblum
    Contributor

    nominating backwards-compatible milestone

  7. catamorphism commented on Aug 1, 2013

    @catamorphism
    ContributorAuthor

    Done pending #8176

  8. catamorphism commented on Aug 14, 2013

    @catamorphism
    ContributorAuthor

    Forgot to close this.

  9. removed their assignment
    on Jun 16, 2014
  10. added 2 commits that reference this issue on Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UnicodeArea: UnicodeA-grammarArea: The grammar of RustA-linkageArea: linking into static, shared libraries and binaries

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions