@@ -612,10 +612,8 @@ Attributes on the anonymous crate module define important metadata that influenc
612
612
the behavior of the compiler.
613
613
614
614
~~~~
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" ];
619
617
620
618
// Additional metadata attributes
621
619
#[ desc = "Project X" ];
@@ -778,36 +776,24 @@ An _`extern mod` declaration_ specifies a dependency on an external crate.
778
776
The external crate is then bound into the declaring scope
779
777
as the ` ident ` provided in the ` extern_mod_decl ` .
780
778
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 ` .
800
786
801
787
Four examples of ` extern mod ` declarations:
802
788
803
789
~~~~ {.xfail-test}
804
- extern mod pcre (uuid = "54aba0f8-a7b1-4beb-92f1-4cf625264841") ;
790
+ extern mod pcre;
805
791
806
- extern mod extra; // equivalent to: extern mod extra ( name = "extra" ) ;
792
+ extern mod extra; // equivalent to: extern mod extra = "extra";
807
793
808
- extern mod rustextra (name = "extra") ; // linking to 'extra' under another name
794
+ extern mod rustextra = "extra"; // linking to 'extra' under another name
809
795
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
811
797
~~~~
812
798
813
799
##### Use declarations
@@ -1745,7 +1731,8 @@ names are effectively reserved. Some significant attributes include:
1745
1731
* The ` doc ` attribute, for documenting code in-place.
1746
1732
* The ` cfg ` attribute, for conditional-compilation by build-configuration.
1747
1733
* 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.
1749
1736
* The ` test ` attribute, for marking functions as unit tests.
1750
1737
* The ` allow ` , ` warn ` , ` forbid ` , and ` deny ` attributes, for
1751
1738
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
3798
3785
by passing ` --cfg ndebug ` to ` rustc ` .
3799
3786
3800
3787
As 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 `
3802
3789
[ attribute] ( #attributes ) ). To narrow down the logs to just crate resolution,
3803
3790
you would set it to ` rustc::metadata::creader ` . To see just error logging
3804
3791
use ` rustc=0 ` .
0 commit comments