@@ -612,10 +612,8 @@ Attributes on the anonymous crate module define important metadata that influenc
612612the behavior of the compiler.
613613
614614~~~~
615- // Linkage attributes
616- #[ link(name = "projx",
617- vers = "2.5",
618- uuid = "9cccc5d5-aceb-4af5-8285-811211826b82") ];
615+ // Package ID
616+ #[ pkgid = "projx#2.5" ];
619617
620618// Additional metadata attributes
621619#[ desc = "Project X" ];
@@ -778,36 +776,24 @@ An _`extern mod` declaration_ specifies a dependency on an external crate.
778776The external crate is then bound into the declaring scope
779777as the ` ident ` provided in the ` extern_mod_decl ` .
780778
781- The external crate is resolved to a specific ` soname ` at compile time,
782- and a runtime linkage requirement to that ` soname ` is passed to the linker for
783- loading at runtime.
784- The ` soname ` is resolved at compile time by scanning the compiler's library path
785- and matching the ` link_attrs ` provided in the ` use_decl ` against any ` #link ` attributes that
786- were declared on the external crate when it was compiled.
787- If no ` link_attrs ` are provided,
788- a default ` name ` attribute is assumed,
789- equal to the ` ident ` given in the ` use_decl ` .
790-
791- Optionally, an identifier in an ` extern mod ` declaration may be followed by an equals sign,
792- then a string literal denoting a relative path on the filesystem.
793- This path should exist in one of the directories in the Rust path,
794- which by default contains the ` .rust ` subdirectory of the current directory and each of its parents,
795- as well as any directories in the colon-separated (or semicolon-separated on Windows)
796- list of paths that is the ` RUST_PATH ` environment variable.
797- The meaning of ` extern mod a = "b/c/d"; ` , supposing that ` /a ` is in the RUST_PATH,
798- is that the name ` a ` should be taken as a reference to the crate whose absolute location is
799- ` /a/b/c/d ` .
779+ The external crate is resolved to a specific ` soname ` at compile time, and a
780+ runtime linkage requirement to that ` soname ` is passed to the linker for
781+ loading at runtime. The ` soname ` is resolved at compile time by scanning the
782+ compiler's library path and matching the optional ` pkgid ` provided as a string literal
783+ against the ` pkgid ` attributes that were declared on the external crate when
784+ it was compiled. If no ` pkgid ` is provided, a default ` name ` attribute is
785+ assumed, equal to the ` ident ` given in the ` extern_mod_decl ` .
800786
801787Four examples of ` extern mod ` declarations:
802788
803789~~~~ {.xfail-test}
804- extern mod pcre (uuid = "54aba0f8-a7b1-4beb-92f1-4cf625264841") ;
790+ extern mod pcre;
805791
806- extern mod extra; // equivalent to: extern mod extra ( name = "extra" ) ;
792+ extern mod extra; // equivalent to: extern mod extra = "extra";
807793
808- extern mod rustextra (name = "extra") ; // linking to 'extra' under another name
794+ extern mod rustextra = "extra"; // linking to 'extra' under another name
809795
810- extern mod complicated_mod = "some-file/in/the-rust/path";
796+ extern mod foo = "some/where/foo#1.0"; // a full package ID for rustpkg
811797~~~~
812798
813799##### Use declarations
@@ -1745,7 +1731,8 @@ names are effectively reserved. Some significant attributes include:
17451731* The ` doc ` attribute, for documenting code in-place.
17461732* The ` cfg ` attribute, for conditional-compilation by build-configuration.
17471733* The ` lang ` attribute, for custom definitions of traits and functions that are known to the Rust compiler (see [ Language items] ( #language-items ) ).
1748- * The ` link ` attribute, for describing linkage metadata for a crate.
1734+ * The ` link ` attribute, for describing linkage metadata for a extern blocks.
1735+ * The ` pkgid ` attribute, for describing the package ID of a crate.
17491736* The ` test ` attribute, for marking functions as unit tests.
17501737* The ` allow ` , ` warn ` , ` forbid ` , and ` deny ` attributes, for
17511738 controlling lint checks (see [ Lint check attributes] ( #lint-check-attributes ) ).
@@ -3798,7 +3785,7 @@ specified then log level 4 is assumed. Debug messages can be omitted
37983785by passing ` --cfg ndebug ` to ` rustc ` .
37993786
38003787As an example, to see all the logs generated by the compiler, you would set
3801- ` RUST_LOG ` to ` rustc ` , which is the crate name (as specified in its ` link `
3788+ ` RUST_LOG ` to ` rustc ` , which is the crate name (as specified in its ` pkgid `
38023789[ attribute] ( #attributes ) ). To narrow down the logs to just crate resolution,
38033790you would set it to ` rustc::metadata::creader ` . To see just error logging
38043791use ` rustc=0 ` .
0 commit comments