Skip to content

Commit db88b28

Browse files
committed
---
yaml --- r: 146043 b: refs/heads/try2 c: 404a461 h: refs/heads/master i: 146041: 5465f51 146039: 40ece36 v: v3
1 parent 28061e7 commit db88b28

File tree

134 files changed

+388
-46180
lines changed

Some content is hidden

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

134 files changed

+388
-46180
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: 62cb92d4ea46b73a18e43c45b7445e71cd926d4c
8+
refs/heads/try2: 404a4619dc132c53c6c5c9e023316c779275b223
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) --cfg nofmt
91+
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
9292
CFG_GCCISH_CFLAGS :=
9393
CFG_GCCISH_LINK_FLAGS :=
9494

branches/try2/configure

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,6 @@ 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
688687
for i in \
689688
isaac sync test \
690689
arch/i386 arch/x86_64 arch/arm arch/mips \

branches/try2/mk/rt.mk

Lines changed: 2 additions & 17 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)) $$(JEMALLOC_LIB_$(1))
148+
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1))
149149
@$$(call E, link: $$@)
150150
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
151-
$$(JEMALLOC_LIB_$(1)) $$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(LIBUV_LIB_$(1)) \
151+
$$(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,27 +197,22 @@ 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
201200

202201
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
203202
LIBUV_OSTYPE_$(1) := win
204-
JEMALLOC_TARGET_$(1) := jemalloc
205203
else ifeq ($(OSTYPE_$(1)), apple-darwin)
206204
LIBUV_OSTYPE_$(1) := mac
207205
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
208206
LIBUV_OSTYPE_$(1) := freebsd
209207
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
210208
LIBUV_OSTYPE_$(1) := android
211-
JEMALLOC_ARGS_$(1) := --disable-tls
212209
LIBUV_ARGS_$(1) := PLATFORM=android host=android OS=linux
213210
else
214211
LIBUV_OSTYPE_$(1) := linux
215212
endif
216213

217214
LIBUV_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),uv)
218215
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))
221216

222217
LIBUV_MAKEFILE_$(1) := $$(CFG_BUILD_DIR)$$(RT_OUTPUT_DIR_$(1))/libuv/Makefile
223218

@@ -253,16 +248,6 @@ $$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1))
253248
V=$$(VERBOSE)
254249
endif
255250

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-
266251
endef
267252

268253
# Instantiate template for all stages/targets

branches/try2/mk/tests.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ 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 \
269268
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
270269

271270
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/back/link.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,16 @@ pub fn link_binary(sess: Session,
959959
}
960960
}
961961

962+
fn is_writeable(p: &Path) -> bool {
963+
use std::libc::consts::os::posix88::S_IWUSR;
964+
965+
!os::path_exists(p) ||
966+
(match p.get_mode() {
967+
None => false,
968+
Some(m) => m & S_IWUSR as uint == S_IWUSR as uint
969+
})
970+
}
971+
962972
pub fn link_args(sess: Session,
963973
obj_filename: &Path,
964974
out_filename: &Path,
@@ -982,6 +992,21 @@ pub fn link_args(sess: Session,
982992
out_filename.clone()
983993
};
984994

995+
// Make sure the output and obj_filename are both writeable.
996+
// Mac, FreeBSD, and Windows system linkers check this already --
997+
// however, the Linux linker will happily overwrite a read-only file.
998+
// We should be consistent.
999+
let obj_is_writeable = is_writeable(obj_filename);
1000+
let out_is_writeable = is_writeable(&output);
1001+
if !out_is_writeable {
1002+
sess.fatal(format!("Output file {} is not writeable -- check its permissions.",
1003+
output.display()));
1004+
}
1005+
else if !obj_is_writeable {
1006+
sess.fatal(format!("Object file {} is not writeable -- check its permissions.",
1007+
obj_filename.display()));
1008+
}
1009+
9851010
// The default library location, we need this to find the runtime.
9861011
// The location of crates will be determined as needed.
9871012
// FIXME (#9639): This needs to handle non-utf8 paths

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

Lines changed: 83 additions & 38 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;
24+
use syntax::ast_util::{is_local, def_id_of_def};
2525
use syntax::attr;
2626
use syntax::codemap::Span;
2727
use syntax::parse::token;
@@ -250,6 +250,12 @@ struct PrivacyVisitor<'self> {
250250
last_private_map: resolve::LastPrivateMap,
251251
}
252252

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

259265
// Determines whether the given definition is public from the point of view
260266
// of the current item.
261-
fn def_public(&self, did: ast::DefId) -> bool {
267+
fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
262268
if !is_local(did) {
263269
if self.external_exports.contains(&did) {
264270
debug2!("privacy - {:?} was externally exported", did);
265-
return true;
271+
return Allowable;
266272
}
267273
debug2!("privacy - is {:?} a public method", did);
268274
return match self.tcx.methods.find(&did) {
@@ -271,38 +277,42 @@ impl<'self> PrivacyVisitor<'self> {
271277
match meth.container {
272278
ty::TraitContainer(id) => {
273279
debug2!("privacy - recursing on trait {:?}", id);
274-
self.def_public(id)
280+
self.def_privacy(id)
275281
}
276282
ty::ImplContainer(id) => {
277283
match ty::impl_trait_ref(self.tcx, id) {
278284
Some(t) => {
279285
debug2!("privacy - impl of trait {:?}", id);
280-
self.def_public(t.def_id)
286+
self.def_privacy(t.def_id)
281287
}
282288
None => {
283289
debug2!("privacy - found a method {:?}",
284290
meth.vis);
285-
meth.vis == ast::public
291+
if meth.vis == ast::public {
292+
Allowable
293+
} else {
294+
ExternallyDenied
295+
}
286296
}
287297
}
288298
}
289299
}
290300
}
291301
None => {
292302
debug2!("privacy - nope, not even a method");
293-
false
303+
ExternallyDenied
294304
}
295305
};
296306
} else if self.exported_items.contains(&did.node) {
297307
debug2!("privacy - exported item {}", self.nodestr(did.node));
298-
return true;
308+
return Allowable;
299309
}
300310

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

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

336350
/// For a local private node in the AST, this function will determine
@@ -365,12 +379,51 @@ impl<'self> PrivacyVisitor<'self> {
365379
}
366380
}
367381

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+
368417
// Checks that a dereference of a univariant enum can occur.
369418
fn check_variant(&self, span: Span, enum_id: ast::DefId) {
370419
let variant_info = ty::enum_variants(self.tcx, enum_id)[0];
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");
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+
}
374427
}
375428
}
376429

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

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-
}
455+
self.ensure_public(span, method_id, None,
456+
format!("method `{}`", token::ident_to_str(name)));
407457
}
408458

409459
// Checks that a path is in scope.
410460
fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
411461
debug2!("privacy - path {}", self.nodestr(path_id));
462+
let def = self.tcx.def_map.get_copy(&path_id);
412463
let ck = |tyname: &str| {
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));
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+
}
425473
}
426474
};
427475
match self.tcx.def_map.get_copy(&path_id) {
@@ -456,9 +504,8 @@ impl<'self> PrivacyVisitor<'self> {
456504
method_num: method_num,
457505
_
458506
}) => {
459-
if !self.def_public(trait_id) {
460-
self.tcx.sess.span_err(span, "source trait is private");
461-
return;
507+
if !self.ensure_public(span, trait_id, None, "source trait") {
508+
return
462509
}
463510
match self.tcx.items.find(&trait_id.node) {
464511
Some(&ast_map::node_item(item, _)) => {
@@ -470,12 +517,10 @@ impl<'self> PrivacyVisitor<'self> {
470517
node: method.id,
471518
crate: trait_id.crate,
472519
};
473-
if self.def_public(def) { return }
474-
let msg = format!("method `{}` is \
475-
private",
520+
self.ensure_public(span, def, None,
521+
format!("method `{}`",
476522
token::ident_to_str(
477-
&method.ident));
478-
self.tcx.sess.span_err(span, msg);
523+
&method.ident)));
479524
}
480525
ast::required(_) => {
481526
// 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)