Skip to content

Change what's allowed in extern mod directives #6407

Closed
@catamorphism

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

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