Skip to content

Commit bcf9417

Browse files
committed
---
yaml --- r: 88605 b: refs/heads/snap-stage3 c: 3d3a663 h: refs/heads/master i: 88603: c5d0c5a v: v3
1 parent 90deb6e commit bcf9417

File tree

21 files changed

+141
-201
lines changed

21 files changed

+141
-201
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a67b8863c2d2e31f834e7a2b39b0afa6f8be7492
4+
refs/heads/snap-stage3: 3d3a663d2530dd49fee235667e98f2767dfd1b57
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/rust.md

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,8 @@ Attributes on the anonymous crate module define important metadata that influenc
609609
the 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.
775773
The external crate is then bound into the declaring scope
776774
as 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

798784
Four 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
37953782
by passing `--cfg ndebug` to `rustc`.
37963783

37973784
As 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,
38003787
you would set it to `rustc::metadata::creader`. To see just error logging
38013788
use `rustc=0`.

branches/snap-stage3/doc/rustdoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ comments":
1313
~~~
1414
// the "link" crate attribute is currently required for rustdoc, but normally
1515
// isn't needed.
16-
#[link(name="universe")];
16+
#[pkgid = "universe"];
1717
#[crate_type="lib"];
1818
1919
//! Tools for dealing with universes (this is a doc comment, and is shown on

branches/snap-stage3/doc/rustpkg.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ as well as `foo/src/bar/extras/baz/lib.rs`,
8989
then both `bar` and `bar/extras/baz` are valid package identifiers
9090
in the workspace `foo`.
9191

92+
Because rustpkg uses generic source file names as the main inputs, you will
93+
need to specify the package identifier in them using the `pkgid` attribute
94+
on the crate.
95+
9296
## Source files
9397

9498
rustpkg searches for four different fixed filenames in order to determine the crates to build:
@@ -108,9 +112,6 @@ When building a package that is not under version control,
108112
or that has no tags, `rustpkg` assumes the intended version is 0.1.
109113

110114
> **Note:** A future version of rustpkg will support semantic versions.
111-
> Also, a future version will add the option to specify a version with a metadata
112-
> attribute like `#[link(vers = "3.1415")]` inside the crate module,
113-
> though this attribute will never be mandatory.
114115
115116
# Dependencies
116117

branches/snap-stage3/doc/tutorial.md

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,22 +3070,21 @@ Therefore, if you plan to compile your crate as a library, you should annotate i
30703070
// lib.rs
30713071
30723072
# #[crate_type = "lib"];
3073-
// Crate linkage metadata
3074-
#[link(name = "farm", vers = "2.5")];
3073+
// Package ID
3074+
#[pkgid = "farm#2.5"];
30753075
30763076
// ...
30773077
# fn farm() {}
30783078
~~~~
30793079

3080-
You can also in turn require in a `extern mod` statement that certain link metadata items match some criteria.
3081-
For that, Rust currently parses a comma-separated list of name/value pairs that appear after
3082-
it, and ensures that they match the attributes provided in the `link` attribute of a crate file.
3083-
This enables you to, e.g., pick a crate based on its version number, or link a library under a
3084-
different name. For example, these two `mod` statements would both accept and select the crate define above:
3080+
You can also specify package ID information in a `extern mod` statement. For
3081+
example, these `extern mod` statements would both accept and select the
3082+
crate define above:
30853083

30863084
~~~~ {.xfail-test}
3087-
extern mod farm(vers = "2.5");
3088-
extern mod my_farm(name = "farm", vers = "2.5");
3085+
extern mod farm;
3086+
extern mod farm = "farm#2.5";
3087+
extern mod my_farm = "farm";
30893088
~~~~
30903089

30913090
Other crate settings and metadata include things like enabling/disabling certain errors or warnings,
@@ -3096,21 +3095,18 @@ or setting the crate type (library or executable) explicitly:
30963095
// ...
30973096
30983097
// This crate is a library ("bin" is the default)
3098+
#[pkgid = "farm#2.5"];
30993099
#[crate_type = "lib"];
31003100
31013101
// Turn on a warning
31023102
#[warn(non_camel_case_types)]
31033103
# fn farm() {}
31043104
~~~~
31053105

3106-
If you're compiling your crate with `rustpkg`,
3107-
link annotations will not be necessary, because they get
3108-
inferred by `rustpkg` based on the Package id and naming conventions.
3109-
3110-
3111-
> ***Note:*** The rules regarding link metadata, both as attributes and on `extern mod`,
3112-
as well as their interaction with `rustpkg`
3113-
are currently not clearly defined and will likely change in the future.
3106+
> ***Note:*** The rules regarding package IDs, both as attributes and as used
3107+
in `extern mod`, as well as their interaction with `rustpkg` are
3108+
currently not clearly defined and will likely change in the
3109+
future.
31143110

31153111
## A minimal example
31163112

@@ -3120,7 +3116,7 @@ We define two crates, and use one of them as a library in the other.
31203116

31213117
~~~~
31223118
// world.rs
3123-
#[link(name = "world", vers = "0.42")];
3119+
#[pkgid = "world#0.42"];
31243120
# extern mod extra;
31253121
pub fn explore() -> &'static str { "world" }
31263122
# fn main() {}
@@ -3144,7 +3140,7 @@ Now compile and run like this (adjust to your platform if necessary):
31443140
Notice that the library produced contains the version in the file name
31453141
as well as an inscrutable string of alphanumerics. As explained in the previous paragraph,
31463142
these are both part of Rust's library versioning scheme. The alphanumerics are
3147-
a hash representing the crates link metadata.
3143+
a hash representing the crates package ID.
31483144

31493145
## The standard library and the prelude
31503146

branches/snap-stage3/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ CFG_LIB_GLOB_arm-linux-androideabi=lib$(1)-*.so
287287
CFG_LIB_DSYM_GLOB_arm-linux-androideabi=lib$(1)-*.dylib.dSYM
288288
CFG_GCCISH_CFLAGS_arm-linux-androideabi := -Wall -g -fPIC -D__arm__ -DANDROID -D__ANDROID__
289289
CFG_GCCISH_CXXFLAGS_arm-linux-androideabi := -fno-rtti
290-
CFG_GCCISH_LINK_FLAGS_arm-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++ -lgnustl_shared
290+
CFG_GCCISH_LINK_FLAGS_arm-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++
291291
CFG_GCCISH_DEF_FLAG_arm-linux-androideabi := -Wl,--export-dynamic,--dynamic-list=
292292
CFG_GCCISH_PRE_LIB_FLAGS_arm-linux-androideabi := -Wl,-whole-archive
293293
CFG_GCCISH_POST_LIB_FLAGS_arm-linux-androideabi := -Wl,-no-whole-archive

branches/snap-stage3/mk/tests.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
156156
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR)) \
157157
$(shell adb shell mkdir $(CFG_ADB_TEST_DIR)/tmp) \
158158
$(shell adb push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
159-
$(shell adb push $(CFG_ANDROID_CROSS_PATH)/arm-linux-androideabi/lib/armv7-a/libgnustl_shared.so \
160-
$(CFG_ADB_TEST_DIR) 1>/dev/null) \
161159
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD))/$(CFG_RUNTIME_arm-linux-androideabi) \
162160
$(CFG_ADB_TEST_DIR)) \
163161
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD))/$(STDLIB_GLOB_arm-linux-androideabi) \

branches/snap-stage3/src/libextra/base64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ pub enum CharacterSet {
2222
/// Contains configuration parameters for `to_base64`.
2323
pub struct Config {
2424
/// Character set to use
25-
priv char_set: CharacterSet,
25+
char_set: CharacterSet,
2626
/// True to pad output with `=` characters
27-
priv pad: bool,
27+
pad: bool,
2828
/// `Some(len)` to wrap lines at `len`, `None` to disable line wrapping
29-
priv line_length: Option<uint>
29+
line_length: Option<uint>
3030
}
3131

3232
/// Configuration for RFC 4648 standard base64 encoding

branches/snap-stage3/src/libextra/stats.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,18 @@ pub trait Stats {
105105
#[deriving(Clone, Eq)]
106106
#[allow(missing_doc)]
107107
pub struct Summary {
108-
priv sum: f64,
109-
// public
108+
sum: f64,
110109
min: f64,
111-
// public
112110
max: f64,
113-
priv mean: f64,
114-
// public
111+
mean: f64,
115112
median: f64,
116-
priv var: f64,
117-
priv std_dev: f64,
118-
priv std_dev_pct: f64,
119-
// public
113+
var: f64,
114+
std_dev: f64,
115+
std_dev_pct: f64,
120116
median_abs_dev: f64,
121-
// public
122117
median_abs_dev_pct: f64,
123-
priv quartiles: (f64,f64,f64),
124-
priv iqr: f64,
118+
quartiles: (f64,f64,f64),
119+
iqr: f64,
125120
}
126121

127122
impl Summary {

branches/snap-stage3/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ fn check_loans_in_fn<'a>(this: &mut CheckLoanCtxt<'a>,
699699
return;
700700
}
701701

702-
visit::fk_anon(..) |
703702
visit::fk_fn_block(..) => {
704703
check_captured_variables(this, id, sp);
705704
}

branches/snap-stage3/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn gather_loans_in_fn(this: &mut GatherLoanCtxt,
140140
}
141141

142142
// Visit closures as part of the containing item.
143-
&visit::fk_anon(..) | &visit::fk_fn_block(..) => {
143+
&visit::fk_fn_block(..) => {
144144
this.push_repeating_id(body.id);
145145
visit::walk_fn(this, fk, decl, body, sp, id, ());
146146
this.pop_repeating_id(body.id);

branches/snap-stage3/src/librustc/middle/borrowck/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ fn borrowck_fn(this: &mut BorrowckCtxt,
127127
sp: Span,
128128
id: ast::NodeId) {
129129
match fk {
130-
&visit::fk_anon(..) |
131130
&visit::fk_fn_block(..) => {
132131
// Closures are checked as part of their containing fn item.
133132
}

branches/snap-stage3/src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ fn visit_fn(v: &mut LivenessVisitor,
401401
sty_static => {}
402402
}
403403
}
404-
visit::fk_item_fn(..) | visit::fk_anon(..) | visit::fk_fn_block(..) => {}
404+
visit::fk_item_fn(..) | visit::fk_fn_block(..) => {}
405405
}
406406

407407
// gather up the various local variables, significant expressions,

branches/snap-stage3/src/librustc/middle/region.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
456456
visit::fk_method(..) => {
457457
Context {parent: None, var_parent: None, ..cx}
458458
}
459-
visit::fk_anon(..) |
460459
visit::fk_fn_block(..) => {
461460
cx
462461
}

branches/snap-stage3/src/librustc/middle/resolve_lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<'a> Visitor<&'a ScopeChain<'a>> for LifetimeContext {
9797
visit::walk_fn(self, fk, fd, b, s, n, &scope1);
9898
debug!("popping fn scope id={} due to item/method", n);
9999
}
100-
visit::fk_anon(..) | visit::fk_fn_block(..) => {
100+
visit::fk_fn_block(..) => {
101101
visit::walk_fn(self, fk, fd, b, s, n, scope);
102102
}
103103
}

branches/snap-stage3/src/librustpkg/path_util.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub use package_id::PkgId;
1616
pub use target::{OutputType, Main, Lib, Test, Bench, Target, Build, Install};
1717
pub use version::{Version, NoVersion, split_version_general, try_parsing_version};
1818
pub use rustc::metadata::filesearch::rust_path;
19+
use rustc::metadata::filesearch::libdir;
1920
use rustc::driver::driver::host_triple;
2021

2122
use std::libc;
@@ -113,7 +114,7 @@ pub fn target_build_dir(workspace: &Path) -> Path {
113114
/// Return the target-specific lib subdirectory, pushed onto `base`;
114115
/// doesn't check that it exists or create it
115116
fn target_lib_dir(workspace: &Path) -> Path {
116-
let mut dir = workspace.join("lib");
117+
let mut dir = workspace.join(libdir());
117118
dir.push(host_triple());
118119
dir
119120
}
@@ -184,7 +185,7 @@ pub fn installed_library_in_workspace(pkg_path: &Path, workspace: &Path) -> Opti
184185
short_name,
185186
Install,
186187
workspace,
187-
"lib",
188+
libdir(),
188189
&NoVersion)
189190
}
190191
}
@@ -212,7 +213,7 @@ pub fn library_in_workspace(path: &Path, short_name: &str, where: Target,
212213

213214
// rustc doesn't use target-specific subdirectories
214215
pub fn system_library(sysroot: &Path, lib_name: &str) -> Option<Path> {
215-
library_in(lib_name, &NoVersion, &sysroot.join("lib"))
216+
library_in(lib_name, &NoVersion, &sysroot.join(libdir()))
216217
}
217218

218219
fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Option<Path> {

branches/snap-stage3/src/libstd/rtdeps.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ extern {}
3333
#[link(name = "dl")]
3434
#[link(name = "log")]
3535
#[link(name = "supc++")]
36-
#[link(name = "gnustl_shared")]
3736
#[link(name = "m")]
3837
extern {}
3938

branches/snap-stage3/src/libsyntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> {
542542
self.operation.visit_id(method.self_id);
543543
self.visit_generics_helper(generics)
544544
}
545-
visit::fk_anon(_) | visit::fk_fn_block => {}
545+
visit::fk_fn_block => {}
546546
}
547547

548548
for argument in function_declaration.inputs.iter() {

0 commit comments

Comments
 (0)