Skip to content

Commit 4faa899

Browse files
committed
---
yaml --- r: 88602 b: refs/heads/snap-stage3 c: d5ad32f h: refs/heads/master v: v3
1 parent fceb2b8 commit 4faa899

File tree

23 files changed

+228
-162
lines changed

23 files changed

+228
-162
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: f73c9c9bbcaf1595f766ad8bb01e21c78fcba84b
4+
refs/heads/snap-stage3: d5ad32f388557c6b1f709d59a940adfa3332a5f2
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: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,10 @@ Attributes on the anonymous crate module define important metadata that influenc
609609
the behavior of the compiler.
610610

611611
~~~~
612-
// Package ID
613-
#[ pkgid = "projx#2.5" ];
612+
// Linkage attributes
613+
#[ link(name = "projx",
614+
vers = "2.5",
615+
uuid = "9cccc5d5-aceb-4af5-8285-811211826b82") ];
614616
615617
// Additional metadata attributes
616618
#[ desc = "Project X" ];
@@ -773,24 +775,36 @@ An _`extern mod` declaration_ specifies a dependency on an external crate.
773775
The external crate is then bound into the declaring scope
774776
as the `ident` provided in the `extern_mod_decl`.
775777

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`.
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`.
783797

784798
Four examples of `extern mod` declarations:
785799

786800
~~~~ {.xfail-test}
787-
extern mod pcre;
801+
extern mod pcre (uuid = "54aba0f8-a7b1-4beb-92f1-4cf625264841");
788802
789-
extern mod extra; // equivalent to: extern mod extra = "extra";
803+
extern mod extra; // equivalent to: extern mod extra ( name = "extra" );
790804
791-
extern mod rustextra = "extra"; // linking to 'extra' under another name
805+
extern mod rustextra (name = "extra"); // linking to 'extra' under another name
792806
793-
extern mod foo = "some/where/foo#1.0"; // a full package ID for rustpkg
807+
extern mod complicated_mod = "some-file/in/the-rust/path";
794808
~~~~
795809

796810
##### Use declarations
@@ -1728,8 +1742,7 @@ names are effectively reserved. Some significant attributes include:
17281742
* The `doc` attribute, for documenting code in-place.
17291743
* The `cfg` attribute, for conditional-compilation by build-configuration.
17301744
* The `lang` attribute, for custom definitions of traits and functions that are known to the Rust compiler (see [Language items](#language-items)).
1731-
* The `link` attribute, for describing linkage metadata for a extern blocks.
1732-
* The `pkgid` attribute, for describing the package ID of a crate.
1745+
* The `link` attribute, for describing linkage metadata for a crate.
17331746
* The `test` attribute, for marking functions as unit tests.
17341747
* The `allow`, `warn`, `forbid`, and `deny` attributes, for
17351748
controlling lint checks (see [Lint check attributes](#lint-check-attributes)).
@@ -3782,7 +3795,7 @@ specified then log level 4 is assumed. Debug messages can be omitted
37823795
by passing `--cfg ndebug` to `rustc`.
37833796

37843797
As an example, to see all the logs generated by the compiler, you would set
3785-
`RUST_LOG` to `rustc`, which is the crate name (as specified in its `pkgid`
3798+
`RUST_LOG` to `rustc`, which is the crate name (as specified in its `link`
37863799
[attribute](#attributes)). To narrow down the logs to just crate resolution,
37873800
you would set it to `rustc::metadata::creader`. To see just error logging
37883801
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-
#[pkgid = "universe"];
16+
#[link(name="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: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ 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-
9692
## Source files
9793

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

114110
> **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.
115114
116115
# Dependencies
117116

branches/snap-stage3/doc/tutorial.md

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

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:
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:
30833085

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

30903091
Other crate settings and metadata include things like enabling/disabling certain errors or warnings,
@@ -3095,18 +3096,21 @@ or setting the crate type (library or executable) explicitly:
30953096
// ...
30963097
30973098
// 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-
> ***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.
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.
31103114

31113115
## A minimal example
31123116

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

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

31453149
## The standard library and the prelude
31463150

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++
290+
CFG_GCCISH_LINK_FLAGS_arm-linux-androideabi := -shared -fPIC -ldl -g -lm -lsupc++ -lgnustl_shared
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ $(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) \
159161
$(shell adb push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD))/$(CFG_RUNTIME_arm-linux-androideabi) \
160162
$(CFG_ADB_TEST_DIR)) \
161163
$(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-
char_set: CharacterSet,
25+
priv char_set: CharacterSet,
2626
/// True to pad output with `=` characters
27-
pad: bool,
27+
priv pad: bool,
2828
/// `Some(len)` to wrap lines at `len`, `None` to disable line wrapping
29-
line_length: Option<uint>
29+
priv line_length: Option<uint>
3030
}
3131

3232
/// Configuration for RFC 4648 standard base64 encoding

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

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

122127
impl Summary {

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

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

702+
visit::fk_anon(..) |
702703
visit::fk_fn_block(..) => {
703704
check_captured_variables(this, id, sp);
704705
}

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_fn_block(..) => {
143+
&visit::fk_anon(..) | &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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ fn borrowck_fn(this: &mut BorrowckCtxt,
127127
sp: Span,
128128
id: ast::NodeId) {
129129
match fk {
130+
&visit::fk_anon(..) |
130131
&visit::fk_fn_block(..) => {
131132
// Closures are checked as part of their containing fn item.
132133
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ impl MarkSymbolVisitor {
6161
}
6262
}
6363

64-
fn lookup_and_handle_definition(&mut self, id: &ast::NodeId,
65-
span: codemap::Span) {
64+
fn lookup_and_handle_definition(&mut self, id: &ast::NodeId) {
6665
let def = match self.tcx.def_map.find(id) {
6766
Some(&def) => def,
68-
None => self.tcx.sess.span_bug(span, "def ID not in def map?!"),
67+
None => return
6968
};
7069
let def_id = match def {
7170
ast::DefVariant(enum_id, _, _) => Some(enum_id),
@@ -129,9 +128,6 @@ impl Visitor<()> for MarkSymbolVisitor {
129128

130129
fn visit_expr(&mut self, expr: @ast::Expr, _: ()) {
131130
match expr.node {
132-
ast::ExprPath(_) | ast::ExprStruct(..) => {
133-
self.lookup_and_handle_definition(&expr.id, expr.span);
134-
}
135131
ast::ExprMethodCall(..) => {
136132
match self.method_map.find(&expr.id) {
137133
Some(&typeck::method_map_entry {
@@ -160,12 +156,16 @@ impl Visitor<()> for MarkSymbolVisitor {
160156
fn visit_ty(&mut self, typ: &ast::Ty, _: ()) {
161157
match typ.node {
162158
ast::ty_path(_, _, ref id) => {
163-
self.lookup_and_handle_definition(id, typ.span);
159+
self.lookup_and_handle_definition(id);
164160
}
165161
_ => visit::walk_ty(self, typ, ()),
166162
}
167163
}
168164

165+
fn visit_path(&mut self, _: &ast::Path, id: ast::NodeId, _: ()) {
166+
self.lookup_and_handle_definition(&id);
167+
}
168+
169169
fn visit_item(&mut self, _item: @ast::item, _: ()) {
170170
// Do not recurse into items. These items will be added to the
171171
// worklist and recursed into manually if necessary.

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_fn_block(..) => {}
404+
visit::fk_item_fn(..) | visit::fk_anon(..) | 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
456456
visit::fk_method(..) => {
457457
Context {parent: None, var_parent: None, ..cx}
458458
}
459+
visit::fk_anon(..) |
459460
visit::fk_fn_block(..) => {
460461
cx
461462
}

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_fn_block(..) => {
100+
visit::fk_anon(..) | 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: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ 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;
2019
use rustc::driver::driver::host_triple;
2120

2221
use std::libc;
@@ -114,7 +113,7 @@ pub fn target_build_dir(workspace: &Path) -> Path {
114113
/// Return the target-specific lib subdirectory, pushed onto `base`;
115114
/// doesn't check that it exists or create it
116115
fn target_lib_dir(workspace: &Path) -> Path {
117-
let mut dir = workspace.join(libdir());
116+
let mut dir = workspace.join("lib");
118117
dir.push(host_triple());
119118
dir
120119
}
@@ -185,7 +184,7 @@ pub fn installed_library_in_workspace(pkg_path: &Path, workspace: &Path) -> Opti
185184
short_name,
186185
Install,
187186
workspace,
188-
libdir(),
187+
"lib",
189188
&NoVersion)
190189
}
191190
}
@@ -213,7 +212,7 @@ pub fn library_in_workspace(path: &Path, short_name: &str, where: Target,
213212

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

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ extern {}
3333
#[link(name = "dl")]
3434
#[link(name = "log")]
3535
#[link(name = "supc++")]
36+
#[link(name = "gnustl_shared")]
3637
#[link(name = "m")]
3738
extern {}
3839

0 commit comments

Comments
 (0)