Skip to content

Commit 16d3bc6

Browse files
committed
---
yaml --- r: 146034 b: refs/heads/try2 c: 1cf029c h: refs/heads/master v: v3
1 parent 78721a9 commit 16d3bc6

File tree

130 files changed

+46260
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+46260
-169
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: cd623e3e36c1d59f4c8a528fc861a46ec46bd5ce
8+
refs/heads/try2: 1cf029c229660efeca92cf88350bba77b5b7d902
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ifneq ($(wildcard $(NON_BUILD_TARGET_TRIPLES)),)
8888
CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET_TRIPLES))
8989
endif
9090

91-
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
91+
CFG_RUSTC_FLAGS := $(RUSTFLAGS) --cfg nofmt
9292
CFG_GCCISH_CFLAGS :=
9393
CFG_GCCISH_LINK_FLAGS :=
9494

branches/try2/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ do
684684
make_dir $t/rt/libuv/src/ares
685685
make_dir $t/rt/libuv/src/eio
686686
make_dir $t/rt/libuv/src/ev
687+
make_dir $t/rt/jemalloc
687688
for i in \
688689
isaac sync test \
689690
arch/i386 arch/x86_64 arch/arm arch/mips \

branches/try2/mk/rt.mk

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ $$(RT_BUILD_DIR_$(1)_$(2))/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$
145145
$$(Q)$(AR_$(1)) rcs $$@ $$<
146146

147147
$$(RT_BUILD_DIR_$(1)_$(2))/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
148-
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1))
148+
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1)) $$(JEMALLOC_LIB_$(1))
149149
@$$(call E, link: $$@)
150150
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
151-
$$(LIBUV_LIB_$(1)) \
151+
$$(JEMALLOC_LIB_$(1)) $$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(LIBUV_LIB_$(1)) \
152152
$$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)_$(2)),$$(CFG_RUNTIME_$(1)))
153153

154154
# These could go in rt.mk or rustllvm.mk, they're needed for both.
@@ -197,22 +197,27 @@ define DEF_THIRD_PARTY_TARGETS
197197
# $(1) is the target triple
198198

199199
RT_OUTPUT_DIR_$(1) := $(1)/rt
200+
JEMALLOC_TARGET_$(1) := jemalloc_pic
200201

201202
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
202203
LIBUV_OSTYPE_$(1) := win
204+
JEMALLOC_TARGET_$(1) := jemalloc
203205
else ifeq ($(OSTYPE_$(1)), apple-darwin)
204206
LIBUV_OSTYPE_$(1) := mac
205207
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
206208
LIBUV_OSTYPE_$(1) := freebsd
207209
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
208210
LIBUV_OSTYPE_$(1) := android
211+
JEMALLOC_ARGS_$(1) := --disable-tls
209212
LIBUV_ARGS_$(1) := PLATFORM=android host=android OS=linux
210213
else
211214
LIBUV_OSTYPE_$(1) := linux
212215
endif
213216

214217
LIBUV_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),uv)
215218
LIBUV_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/libuv/$$(LIBUV_NAME_$(1))
219+
JEMALLOC_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),$$(JEMALLOC_TARGET_$(1)))
220+
JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc/lib/$$(JEMALLOC_NAME_$(1))
216221

217222
LIBUV_MAKEFILE_$(1) := $$(CFG_BUILD_DIR)$$(RT_OUTPUT_DIR_$(1))/libuv/Makefile
218223

@@ -248,6 +253,16 @@ $$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1))
248253
V=$$(VERBOSE)
249254
endif
250255

256+
$$(JEMALLOC_LIB_$(1)):
257+
cd $$(RT_OUTPUT_DIR_$(1))/jemalloc; $(S)src/rt/jemalloc/configure \
258+
$$(JEMALLOC_ARGS_$(1)) \
259+
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) \
260+
EXTRA_CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
261+
CC="$$(CC_$(1))" \
262+
CXX="$$(CXX_$(1))" \
263+
AR="$$(AR_$(1))"
264+
$$(Q)$$(MAKE) -C $$(RT_OUTPUT_DIR_$(1))/jemalloc build_lib_static
265+
251266
endef
252267

253268
# Instantiate template for all stages/targets

branches/try2/mk/tests.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ tidy:
265265
| grep '^$(S)src/libuv' -v \
266266
| grep '^$(S)src/gyp' -v \
267267
| grep '^$(S)src/etc' -v \
268+
| grep '^$(S)src/rt/jemalloc' -v \
268269
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
269270

270271
endif

branches/try2/src/libextra/workcache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl Logger {
219219
}
220220

221221
pub fn info(&self, i: &str) {
222-
io::println(~"workcache: " + i);
222+
info2!("workcache: {}", i);
223223
}
224224
}
225225

branches/try2/src/librustc/middle/privacy.rs

Lines changed: 38 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use middle::typeck::{method_static, method_object};
2121

2222
use syntax::ast;
2323
use syntax::ast_map;
24-
use syntax::ast_util::{is_local, def_id_of_def};
24+
use syntax::ast_util::is_local;
2525
use syntax::attr;
2626
use syntax::codemap::Span;
2727
use syntax::parse::token;
@@ -250,12 +250,6 @@ struct PrivacyVisitor<'self> {
250250
last_private_map: resolve::LastPrivateMap,
251251
}
252252

253-
enum PrivacyResult {
254-
Allowable,
255-
ExternallyDenied,
256-
DisallowedBy(ast::NodeId),
257-
}
258-
259253
impl<'self> PrivacyVisitor<'self> {
260254
// used when debugging
261255
fn nodestr(&self, id: ast::NodeId) -> ~str {
@@ -264,11 +258,11 @@ impl<'self> PrivacyVisitor<'self> {
264258

265259
// Determines whether the given definition is public from the point of view
266260
// of the current item.
267-
fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
261+
fn def_public(&self, did: ast::DefId) -> bool {
268262
if !is_local(did) {
269263
if self.external_exports.contains(&did) {
270264
debug2!("privacy - {:?} was externally exported", did);
271-
return Allowable;
265+
return true;
272266
}
273267
debug2!("privacy - is {:?} a public method", did);
274268
return match self.tcx.methods.find(&did) {
@@ -277,42 +271,38 @@ impl<'self> PrivacyVisitor<'self> {
277271
match meth.container {
278272
ty::TraitContainer(id) => {
279273
debug2!("privacy - recursing on trait {:?}", id);
280-
self.def_privacy(id)
274+
self.def_public(id)
281275
}
282276
ty::ImplContainer(id) => {
283277
match ty::impl_trait_ref(self.tcx, id) {
284278
Some(t) => {
285279
debug2!("privacy - impl of trait {:?}", id);
286-
self.def_privacy(t.def_id)
280+
self.def_public(t.def_id)
287281
}
288282
None => {
289283
debug2!("privacy - found a method {:?}",
290284
meth.vis);
291-
if meth.vis == ast::public {
292-
Allowable
293-
} else {
294-
ExternallyDenied
295-
}
285+
meth.vis == ast::public
296286
}
297287
}
298288
}
299289
}
300290
}
301291
None => {
302292
debug2!("privacy - nope, not even a method");
303-
ExternallyDenied
293+
false
304294
}
305295
};
306296
} else if self.exported_items.contains(&did.node) {
307297
debug2!("privacy - exported item {}", self.nodestr(did.node));
308-
return Allowable;
298+
return true;
309299
}
310300

311301
debug2!("privacy - local {:?} not public all the way down", did);
312302
// return quickly for things in the same module
313303
if self.parents.find(&did.node) == self.parents.find(&self.curitem) {
314304
debug2!("privacy - same parent, we're done here");
315-
return Allowable;
305+
return true;
316306
}
317307

318308
// We now know that there is at least one private member between the
@@ -340,11 +330,7 @@ impl<'self> PrivacyVisitor<'self> {
340330
assert!(closest_private_id != ast::DUMMY_NODE_ID);
341331
}
342332
debug2!("privacy - closest priv {}", self.nodestr(closest_private_id));
343-
if self.private_accessible(closest_private_id) {
344-
Allowable
345-
} else {
346-
DisallowedBy(closest_private_id)
347-
}
333+
return self.private_accessible(closest_private_id);
348334
}
349335

350336
/// For a local private node in the AST, this function will determine
@@ -379,51 +365,12 @@ impl<'self> PrivacyVisitor<'self> {
379365
}
380366
}
381367

382-
/// Guarantee that a particular definition is public, possibly emitting an
383-
/// error message if it's not.
384-
fn ensure_public(&self, span: Span, to_check: ast::DefId,
385-
source_did: Option<ast::DefId>, msg: &str) -> bool {
386-
match self.def_privacy(to_check) {
387-
ExternallyDenied => {
388-
self.tcx.sess.span_err(span, format!("{} is private", msg))
389-
}
390-
DisallowedBy(id) => {
391-
if id == source_did.unwrap_or(to_check).node {
392-
self.tcx.sess.span_err(span, format!("{} is private", msg));
393-
return false;
394-
} else {
395-
self.tcx.sess.span_err(span, format!("{} is inaccessible",
396-
msg));
397-
}
398-
match self.tcx.items.find(&id) {
399-
Some(&ast_map::node_item(item, _)) => {
400-
let desc = match item.node {
401-
ast::item_mod(*) => "module",
402-
ast::item_trait(*) => "trait",
403-
_ => return false,
404-
};
405-
let msg = format!("{} `{}` is private", desc,
406-
token::ident_to_str(&item.ident));
407-
self.tcx.sess.span_note(span, msg);
408-
}
409-
Some(*) | None => {}
410-
}
411-
}
412-
Allowable => return true
413-
}
414-
return false;
415-
}
416-
417368
// Checks that a dereference of a univariant enum can occur.
418369
fn check_variant(&self, span: Span, enum_id: ast::DefId) {
419370
let variant_info = ty::enum_variants(self.tcx, enum_id)[0];
420-
421-
match self.def_privacy(variant_info.id) {
422-
Allowable => {}
423-
ExternallyDenied | DisallowedBy(*) => {
424-
self.tcx.sess.span_err(span, "can only dereference enums \
425-
with a single, public variant");
426-
}
371+
if !self.def_public(variant_info.id) {
372+
self.tcx.sess.span_err(span, "can only dereference enums \
373+
with a single, public variant");
427374
}
428375
}
429376

@@ -452,24 +399,29 @@ impl<'self> PrivacyVisitor<'self> {
452399
let method_id = ty::method(self.tcx, method_id).provided_source
453400
.unwrap_or(method_id);
454401

455-
self.ensure_public(span, method_id, None,
456-
format!("method `{}`", token::ident_to_str(name)));
402+
if !self.def_public(method_id) {
403+
debug2!("private: {:?}", method_id);
404+
self.tcx.sess.span_err(span, format!("method `{}` is private",
405+
token::ident_to_str(name)));
406+
}
457407
}
458408

459409
// Checks that a path is in scope.
460410
fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
461411
debug2!("privacy - path {}", self.nodestr(path_id));
462-
let def = self.tcx.def_map.get_copy(&path_id);
463412
let ck = |tyname: &str| {
464-
let origdid = def_id_of_def(def);
465-
match *self.last_private_map.get(&path_id) {
466-
resolve::AllPublic => {},
467-
resolve::DependsOn(def) => {
468-
let name = token::ident_to_str(&path.segments.last()
469-
.identifier);
470-
self.ensure_public(span, def, Some(origdid),
471-
format!("{} `{}`", tyname, name));
472-
}
413+
let last_private = *self.last_private_map.get(&path_id);
414+
debug2!("privacy - {:?}", last_private);
415+
let public = match last_private {
416+
resolve::AllPublic => true,
417+
resolve::DependsOn(def) => self.def_public(def),
418+
};
419+
if !public {
420+
debug2!("denying {:?}", path);
421+
let name = token::ident_to_str(&path.segments.last()
422+
.identifier);
423+
self.tcx.sess.span_err(span,
424+
format!("{} `{}` is private", tyname, name));
473425
}
474426
};
475427
match self.tcx.def_map.get_copy(&path_id) {
@@ -504,8 +456,9 @@ impl<'self> PrivacyVisitor<'self> {
504456
method_num: method_num,
505457
_
506458
}) => {
507-
if !self.ensure_public(span, trait_id, None, "source trait") {
508-
return
459+
if !self.def_public(trait_id) {
460+
self.tcx.sess.span_err(span, "source trait is private");
461+
return;
509462
}
510463
match self.tcx.items.find(&trait_id.node) {
511464
Some(&ast_map::node_item(item, _)) => {
@@ -517,10 +470,12 @@ impl<'self> PrivacyVisitor<'self> {
517470
node: method.id,
518471
crate: trait_id.crate,
519472
};
520-
self.ensure_public(span, def, None,
521-
format!("method `{}`",
473+
if self.def_public(def) { return }
474+
let msg = format!("method `{}` is \
475+
private",
522476
token::ident_to_str(
523-
&method.ident)));
477+
&method.ident));
478+
self.tcx.sess.span_err(span, msg);
524479
}
525480
ast::required(_) => {
526481
// Required methods can't be private.

branches/try2/src/librustpkg/conditions.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ condition! {
2323
pub bad_stat: (Path, ~str) -> stat;
2424
}
2525

26+
condition! {
27+
pub bad_kind: (~str) -> ();
28+
}
29+
2630
condition! {
2731
pub nonexistent_package: (PkgId, ~str) -> Path;
2832
}

0 commit comments

Comments
 (0)