Skip to content

Commit 0de880f

Browse files
committed
---
yaml --- r: 146685 b: refs/heads/try2 c: 4ddeef3 h: refs/heads/master i: 146683: a15b172 v: v3
1 parent 4a30e79 commit 0de880f

File tree

15 files changed

+162
-222
lines changed

15 files changed

+162
-222
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: 4dded4345fc148edea0e4b8354728c728784883f
8+
refs/heads/try2: 4ddeef35e52fdd80424897f3f9a253220691c1ac
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,6 @@ keyword for struct fields and enum variants). When an item is declared as `pub`,
15501550
it can be thought of as being accessible to the outside world. For example:
15511551

15521552
~~~~
1553-
# fn main() {}
15541553
// Declare a private struct
15551554
struct Foo;
15561555

branches/try2/doc/tutorial-container.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ Reaching the end of the iterator is signalled by returning `None` instead of
8787
`Some(item)`:
8888
8989
~~~
90-
# fn main() {}
9190
/// A stream of N zeroes
9291
struct ZeroStream {
9392
priv remaining: uint
@@ -302,7 +301,6 @@ the iterator can provide better information.
302301
The `ZeroStream` from earlier can provide an exact lower and upper bound:
303302

304303
~~~
305-
# fn main() {}
306304
/// A stream of N zeroes
307305
struct ZeroStream {
308306
priv remaining: uint

branches/try2/doc/tutorial-macros.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Now consider code like the following:
216216

217217
~~~~
218218
# enum t1 { good_1(t2, uint), bad_1 };
219-
# struct t2 { body: t3 }
219+
# pub struct t2 { body: t3 }
220220
# enum t3 { good_2(uint), bad_2};
221221
# fn f(x: t1) -> uint {
222222
match x {
@@ -262,7 +262,7 @@ macro_rules! biased_match (
262262
)
263263
264264
# enum t1 { good_1(t2, uint), bad_1 };
265-
# struct t2 { body: t3 }
265+
# pub struct t2 { body: t3 }
266266
# enum t3 { good_2(uint), bad_2};
267267
# fn f(x: t1) -> uint {
268268
biased_match!((x) ~ (good_1(g1, val)) else { return 0 };
@@ -364,7 +364,7 @@ macro_rules! biased_match (
364364
365365
366366
# enum t1 { good_1(t2, uint), bad_1 };
367-
# struct t2 { body: t3 }
367+
# pub struct t2 { body: t3 }
368368
# enum t3 { good_2(uint), bad_2};
369369
# fn f(x: t1) -> uint {
370370
biased_match!(

branches/try2/doc/tutorial.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,7 +2568,6 @@ pub fn foo() { bar(); }
25682568
~~~
25692569
// c.rs
25702570
pub fn bar() { println("Baz!"); }
2571-
# fn main() {}
25722571
~~~
25732572

25742573
There also exist two short forms for importing multiple names at once:
@@ -2744,7 +2743,7 @@ Therefore, if you plan to compile your crate as a library, you should annotate i
27442743
#[link(name = "farm", vers = "2.5")];
27452744
27462745
// ...
2747-
# fn farm() {}
2746+
# pub fn farm() {}
27482747
~~~~
27492748

27502749
You can also in turn require in a `extern mod` statement that certain link metadata items match some criteria.
@@ -2770,7 +2769,7 @@ or setting the crate type (library or executable) explicitly:
27702769
27712770
// Turn on a warning
27722771
#[warn(non_camel_case_types)]
2773-
# fn farm() {}
2772+
# pub fn farm() {}
27742773
~~~~
27752774

27762775
If you're compiling your crate with `rustpkg`,
@@ -2791,9 +2790,7 @@ We define two crates, and use one of them as a library in the other.
27912790
~~~~
27922791
// world.rs
27932792
#[link(name = "world", vers = "0.42")];
2794-
# extern mod extra;
27952793
pub fn explore() -> &'static str { "world" }
2796-
# fn main() {}
27972794
~~~~
27982795

27992796
~~~~ {.xfail-test}

branches/try2/mk/ctags.mk

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,7 @@
1515

1616
.PHONY: TAGS.emacs TAGS.vi
1717

18-
# This is using a blacklist approach, probably more durable than a whitelist.
19-
# We exclude: external dependencies (llvm, libuv, gyp, rt/{msvc,sundown,vg}),
20-
# tests (compiletest, test) and a couple of other things (rt/arch, etc)
21-
CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/llvm,,\
22-
$(patsubst ${CFG_SRC_DIR}src/libuv,,\
23-
$(patsubst ${CFG_SRC_DIR}src/compiletest,,\
24-
$(patsubst ${CFG_SRC_DIR}src/test,,\
25-
$(patsubst ${CFG_SRC_DIR}src/gyp,,\
26-
$(patsubst ${CFG_SRC_DIR}src/etc,,\
27-
$(patsubst ${CFG_SRC_DIR}src/rt,,\
28-
$(patsubst ${CFG_SRC_DIR}src/rt/arch,,\
29-
$(patsubst ${CFG_SRC_DIR}src/rt/msvc,,\
30-
$(patsubst ${CFG_SRC_DIR}src/rt/sundown,,\
31-
$(patsubst ${CFG_SRC_DIR}src/rt/vg,,\
32-
$(wildcard ${CFG_SRC_DIR}src/*) $(wildcard ${CFG_SRC_DIR}src/rt/*)\
33-
)))))))))))
34-
CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=-javascript --recurse ${CTAGS_LOCATIONS}
35-
# We could use `--languages=Rust`, but there is value in producing tags for the
36-
# C++ parts of the code base too (at the time of writing, those are .h and .cpp
37-
# files in src/rt, src/rt/sync and src/rustllvm); we mainly just want to
38-
# exclude the external dependencies.
18+
CTAGS_OPTS=--options=${CFG_SRC_DIR}/src/etc/ctags.rust -R ${CFG_SRC_DIR}/src
3919

4020
TAGS.emacs:
4121
ctags -e -f $@ ${CTAGS_OPTS}

branches/try2/src/libextra/sort.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ mod tests {
846846

847847
fn check_sort(v1: &[int], v2: &[int]) {
848848
let len = v1.len();
849-
fn le(a: &int, b: &int) -> bool { *a <= *b }
849+
pub fn le(a: &int, b: &int) -> bool { *a <= *b }
850850
let f = le;
851851
let v3 = merge_sort::<int>(v1, f);
852852
let mut i = 0u;
@@ -876,7 +876,7 @@ mod tests {
876876

877877
#[test]
878878
fn test_merge_sort_mutable() {
879-
fn le(a: &int, b: &int) -> bool { *a <= *b }
879+
pub fn le(a: &int, b: &int) -> bool { *a <= *b }
880880
let v1 = ~[3, 2, 1];
881881
let v2 = merge_sort(v1, le);
882882
assert_eq!(v2, ~[1, 2, 3]);

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

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
//! which are available for use externally when compiled as a library.
1414
1515
use std::hashmap::{HashSet, HashMap};
16-
use std::util;
1716

1817
use middle::resolve;
1918
use middle::ty;
@@ -276,7 +275,6 @@ impl<'self> Visitor<()> for EmbargoVisitor<'self> {
276275
struct PrivacyVisitor<'self> {
277276
tcx: ty::ctxt,
278277
curitem: ast::NodeId,
279-
in_fn: bool,
280278

281279
// See comments on the same field in `EmbargoVisitor`.
282280
path_all_public_items: &'self ExportedItems,
@@ -690,63 +688,6 @@ impl<'self> PrivacyVisitor<'self> {
690688
}
691689
}
692690
}
693-
694-
/// When inside of something like a function or a method, visibility has no
695-
/// control over anything so this forbids any mention of any visibility
696-
fn check_all_inherited(&self, item: @ast::item) {
697-
let tcx = self.tcx;
698-
let check_inherited = |sp: Span, vis: ast::visibility| {
699-
if vis != ast::inherited {
700-
tcx.sess.span_err(sp, "visibility has no effect inside functions");
701-
}
702-
};
703-
let check_struct = |def: &@ast::struct_def| {
704-
for f in def.fields.iter() {
705-
match f.node.kind {
706-
ast::named_field(_, p) => check_inherited(f.span, p),
707-
ast::unnamed_field => {}
708-
}
709-
}
710-
};
711-
check_inherited(item.span, item.vis);
712-
match item.node {
713-
ast::item_impl(_, _, _, ref methods) => {
714-
for m in methods.iter() {
715-
check_inherited(m.span, m.vis);
716-
}
717-
}
718-
ast::item_foreign_mod(ref fm) => {
719-
for i in fm.items.iter() {
720-
check_inherited(i.span, i.vis);
721-
}
722-
}
723-
ast::item_enum(ref def, _) => {
724-
for v in def.variants.iter() {
725-
check_inherited(v.span, v.node.vis);
726-
727-
match v.node.kind {
728-
ast::struct_variant_kind(ref s) => check_struct(s),
729-
ast::tuple_variant_kind(*) => {}
730-
}
731-
}
732-
}
733-
734-
ast::item_struct(ref def, _) => check_struct(def),
735-
736-
ast::item_trait(_, _, ref methods) => {
737-
for m in methods.iter() {
738-
match *m {
739-
ast::required(*) => {}
740-
ast::provided(ref m) => check_inherited(m.span, m.vis),
741-
}
742-
}
743-
}
744-
745-
ast::item_static(*) |
746-
ast::item_fn(*) | ast::item_mod(*) | ast::item_ty(*) |
747-
ast::item_mac(*) => {}
748-
}
749-
}
750691
}
751692

752693
impl<'self> Visitor<()> for PrivacyVisitor<'self> {
@@ -758,28 +699,12 @@ impl<'self> Visitor<()> for PrivacyVisitor<'self> {
758699
}
759700

760701
// Disallow unnecessary visibility qualifiers
761-
if self.in_fn {
762-
self.check_all_inherited(item);
763-
} else {
764-
self.check_sane_privacy(item);
765-
}
702+
self.check_sane_privacy(item);
766703

767-
let orig_curitem = util::replace(&mut self.curitem, item.id);
768-
let orig_in_fn = util::replace(&mut self.in_fn, match item.node {
769-
ast::item_mod(*) => false, // modules turn privacy back on
770-
_ => self.in_fn, // otherwise we inherit
771-
});
704+
let orig_curitem = self.curitem;
705+
self.curitem = item.id;
772706
visit::walk_item(self, item, ());
773707
self.curitem = orig_curitem;
774-
self.in_fn = orig_in_fn;
775-
}
776-
777-
fn visit_fn(&mut self, fk: &visit::fn_kind, fd: &ast::fn_decl,
778-
b: &ast::Block, s: Span, n: ast::NodeId, _: ()) {
779-
// This catches both functions and methods
780-
let orig_in_fn = util::replace(&mut self.in_fn, true);
781-
visit::walk_fn(self, fk, fd, b, s, n, ());
782-
self.in_fn = orig_in_fn;
783708
}
784709

785710
fn visit_expr(&mut self, expr: @ast::Expr, _: ()) {
@@ -982,7 +907,6 @@ pub fn check_crate(tcx: ty::ctxt,
982907
{
983908
let mut visitor = PrivacyVisitor {
984909
curitem: ast::DUMMY_NODE_ID,
985-
in_fn: false,
986910
tcx: tcx,
987911
path_all_public_items: &path_all_public_items,
988912
parents: &parents,

0 commit comments

Comments
 (0)