@@ -609,10 +609,8 @@ Attributes on the anonymous crate module define important metadata that influenc
609609the behavior of the compiler.
610610
611611~~~~
612- // Linkage attributes
613- #[ link(name = "projx",
614- vers = "2.5",
615- uuid = "9cccc5d5-aceb-4af5-8285-811211826b82") ];
612+ // Package ID
613+ #[ pkgid = "projx#2.5" ];
616614
617615// Additional metadata attributes
618616#[ desc = "Project X" ];
@@ -775,36 +773,24 @@ An _`extern mod` declaration_ specifies a dependency on an external crate.
775773The external crate is then bound into the declaring scope
776774as the ` ident ` provided in the ` extern_mod_decl ` .
777775
778- The external crate is resolved to a specific ` soname ` at compile time,
779- and a runtime linkage requirement to that ` soname ` is passed to the linker for
780- loading at runtime.
781- The ` soname ` is resolved at compile time by scanning the compiler's library path
782- and matching the ` link_attrs ` provided in the ` use_decl ` against any ` #link ` attributes that
783- were declared on the external crate when it was compiled.
784- If no ` link_attrs ` are provided,
785- a default ` name ` attribute is assumed,
786- equal to the ` ident ` given in the ` use_decl ` .
787-
788- Optionally, an identifier in an ` extern mod ` declaration may be followed by an equals sign,
789- then a string literal denoting a relative path on the filesystem.
790- This path should exist in one of the directories in the Rust path,
791- which by default contains the ` .rust ` subdirectory of the current directory and each of its parents,
792- as well as any directories in the colon-separated (or semicolon-separated on Windows)
793- list of paths that is the ` RUST_PATH ` environment variable.
794- The meaning of ` extern mod a = "b/c/d"; ` , supposing that ` /a ` is in the RUST_PATH,
795- is that the name ` a ` should be taken as a reference to the crate whose absolute location is
796- ` /a/b/c/d ` .
776+ The external crate is resolved to a specific ` soname ` at compile time, and a
777+ runtime linkage requirement to that ` soname ` is passed to the linker for
778+ loading at runtime. The ` soname ` is resolved at compile time by scanning the
779+ compiler's library path and matching the optional ` pkgid ` provided as a string literal
780+ against the ` pkgid ` attributes that were declared on the external crate when
781+ it was compiled. If no ` pkgid ` is provided, a default ` name ` attribute is
782+ assumed, equal to the ` ident ` given in the ` extern_mod_decl ` .
797783
798784Four examples of ` extern mod ` declarations:
799785
800786~~~~ {.xfail-test}
801- extern mod pcre (uuid = "54aba0f8-a7b1-4beb-92f1-4cf625264841") ;
787+ extern mod pcre;
802788
803- extern mod extra; // equivalent to: extern mod extra ( name = "extra" ) ;
789+ extern mod extra; // equivalent to: extern mod extra = "extra";
804790
805- extern mod rustextra (name = "extra") ; // linking to 'extra' under another name
791+ extern mod rustextra = "extra"; // linking to 'extra' under another name
806792
807- extern mod complicated_mod = "some-file/in/the-rust/path";
793+ extern mod foo = "some/where/foo#1.0"; // a full package ID for rustpkg
808794~~~~
809795
810796##### Use declarations
@@ -1742,7 +1728,8 @@ names are effectively reserved. Some significant attributes include:
17421728* The ` doc ` attribute, for documenting code in-place.
17431729* The ` cfg ` attribute, for conditional-compilation by build-configuration.
17441730* The ` lang ` attribute, for custom definitions of traits and functions that are known to the Rust compiler (see [ Language items] ( #language-items ) ).
1745- * The ` link ` attribute, for describing linkage metadata for a crate.
1731+ * The ` link ` attribute, for describing linkage metadata for a extern blocks.
1732+ * The ` pkgid ` attribute, for describing the package ID of a crate.
17461733* The ` test ` attribute, for marking functions as unit tests.
17471734* The ` allow ` , ` warn ` , ` forbid ` , and ` deny ` attributes, for
17481735 controlling lint checks (see [ Lint check attributes] ( #lint-check-attributes ) ).
@@ -3795,7 +3782,7 @@ specified then log level 4 is assumed. Debug messages can be omitted
37953782by passing ` --cfg ndebug ` to ` rustc ` .
37963783
37973784As an example, to see all the logs generated by the compiler, you would set
3798- ` RUST_LOG ` to ` rustc ` , which is the crate name (as specified in its ` link `
3785+ ` RUST_LOG ` to ` rustc ` , which is the crate name (as specified in its ` pkgid `
37993786[ attribute] ( #attributes ) ). To narrow down the logs to just crate resolution,
38003787you would set it to ` rustc::metadata::creader ` . To see just error logging
38013788use ` rustc=0 ` .
0 commit comments