Skip to content

Commit 58b5352

Browse files
committed
---
yaml --- r: 143931 b: refs/heads/try2 c: 433fbe8 h: refs/heads/master i: 143929: 0376251 143927: 032d93d v: v3
1 parent 7d52316 commit 58b5352

Some content is hidden

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

52 files changed

+783
-677
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: 983cc777c5090df18188dd417cdfda8acfc2cb1b
8+
refs/heads/try2: 433fbe8fcf13724445cc57c85cc454352c969429
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/crypto/sha1.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Sha1 {
159159
}
160160

161161
impl Digest for Sha1 {
162-
pub fn reset(&mut self) {
162+
fn reset(&mut self) {
163163
self.length_bits = 0;
164164
self.h[0] = 0x67452301u32;
165165
self.h[1] = 0xEFCDAB89u32;
@@ -169,9 +169,9 @@ impl Digest for Sha1 {
169169
self.buffer.reset();
170170
self.computed = false;
171171
}
172-
pub fn input(&mut self, msg: &[u8]) { add_input(self, msg); }
173-
pub fn result(&mut self, out: &mut [u8]) { return mk_result(self, out); }
174-
pub fn output_bits(&self) -> uint { 160 }
172+
fn input(&mut self, msg: &[u8]) { add_input(self, msg); }
173+
fn result(&mut self, out: &mut [u8]) { return mk_result(self, out); }
174+
fn output_bits(&self) -> uint { 160 }
175175
}
176176

177177
#[cfg(test)]

branches/try2/src/libextra/enum_set.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pub struct EnumSet<E> {
2121
/// An iterface for casting C-like enum to uint and back.
2222
pub trait CLike {
2323
/// Converts C-like enum to uint.
24-
pub fn to_uint(&self) -> uint;
24+
fn to_uint(&self) -> uint;
2525
/// Converts uint to C-like enum.
26-
pub fn from_uint(uint) -> Self;
26+
fn from_uint(uint) -> Self;
2727
}
2828

2929
fn bit<E:CLike>(e: E) -> uint {
@@ -142,11 +142,11 @@ mod test {
142142
}
143143

144144
impl CLike for Foo {
145-
pub fn to_uint(&self) -> uint {
145+
fn to_uint(&self) -> uint {
146146
*self as uint
147147
}
148148

149-
pub fn from_uint(v: uint) -> Foo {
149+
fn from_uint(v: uint) -> Foo {
150150
unsafe { cast::transmute(v) }
151151
}
152152
}

branches/try2/src/libextra/num/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ impl ToStrRadix for BigUint {
537537
impl FromStrRadix for BigUint {
538538
/// Creates and initializes an BigUint.
539539
540-
pub fn from_str_radix(s: &str, radix: uint)
540+
fn from_str_radix(s: &str, radix: uint)
541541
-> Option<BigUint> {
542542
BigUint::parse_bytes(s.as_bytes(), radix)
543543
}

branches/try2/src/libextra/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub struct Metric {
104104
pub struct MetricMap(TreeMap<~str,Metric>);
105105

106106
impl Clone for MetricMap {
107-
pub fn clone(&self) -> MetricMap {
107+
fn clone(&self) -> MetricMap {
108108
MetricMap((**self).clone())
109109
}
110110
}

branches/try2/src/libextra/treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ impl<K: TotalOrd, V, T: Iterator<(K, V)>> Extendable<(K, V), T> for TreeMap<K, V
853853
}
854854

855855
impl<T: TotalOrd, Iter: Iterator<T>> FromIterator<T, Iter> for TreeSet<T> {
856-
pub fn from_iterator(iter: &mut Iter) -> TreeSet<T> {
856+
fn from_iterator(iter: &mut Iter) -> TreeSet<T> {
857857
let mut set = TreeSet::new();
858858
set.extend(iter);
859859
set

branches/try2/src/libextra/url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ pub fn to_str(url: &Url) -> ~str {
701701
}
702702

703703
impl ToStr for Url {
704-
pub fn to_str(&self) -> ~str {
704+
fn to_str(&self) -> ~str {
705705
to_str(self)
706706
}
707707
}

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

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
351351
// Do not check privacy inside items with the resolve_unexported
352352
// attribute. This is used for the test runner.
353353
if !attr::contains_name(item.attrs, "!resolve_unexported") {
354+
check_sane_privacy(tcx, item);
354355
oldvisit::visit_item(item, (method_map, visitor));
355356
}
356357
},
@@ -540,3 +541,81 @@ pub fn check_crate<'mm>(tcx: ty::ctxt,
540541
});
541542
oldvisit::visit_crate(crate, (method_map, visitor));
542543
}
544+
545+
/// Validates all of the visibility qualifers placed on the item given. This
546+
/// ensures that there are no extraneous qualifiers that don't actually do
547+
/// anything. In theory these qualifiers wouldn't parse, but that may happen
548+
/// later on down the road...
549+
fn check_sane_privacy(tcx: ty::ctxt, item: @ast::item) {
550+
match item.node {
551+
// implementations of traits don't need visibility qualifiers because
552+
// that's controlled by having the trait in scope.
553+
ast::item_impl(_, Some(*), _, ref methods) => {
554+
for m in methods.iter() {
555+
match m.vis {
556+
ast::private | ast::public => {
557+
tcx.sess.span_err(m.span, "unnecessary visibility")
558+
}
559+
ast::inherited => {}
560+
}
561+
}
562+
}
563+
564+
ast::item_enum(ref def, _) => {
565+
for v in def.variants.iter() {
566+
match v.node.vis {
567+
ast::public => {
568+
if item.vis == ast::public {
569+
tcx.sess.span_err(v.span, "unnecessary `pub` \
570+
visibility");
571+
}
572+
}
573+
ast::private => {
574+
if item.vis != ast::public {
575+
tcx.sess.span_err(v.span, "unnecessary `priv` \
576+
visibility");
577+
}
578+
}
579+
ast::inherited => {}
580+
}
581+
}
582+
}
583+
584+
ast::item_struct(ref def, _) => {
585+
for f in def.fields.iter() {
586+
match f.node.kind {
587+
ast::named_field(_, ast::public) => {
588+
tcx.sess.span_err(f.span, "unnecessary `pub` \
589+
visibility");
590+
}
591+
ast::named_field(_, ast::private) => {
592+
// Fields should really be private by default...
593+
}
594+
ast::named_field(*) | ast::unnamed_field => {}
595+
}
596+
}
597+
}
598+
599+
ast::item_trait(_, _, ref methods) => {
600+
for m in methods.iter() {
601+
match *m {
602+
ast::provided(ref m) => {
603+
match m.vis {
604+
ast::private | ast::public => {
605+
tcx.sess.span_err(m.span, "unnecessary \
606+
visibility");
607+
}
608+
ast::inherited => {}
609+
}
610+
}
611+
// this is warned about in the parser
612+
ast::required(*) => {}
613+
}
614+
}
615+
}
616+
617+
ast::item_impl(*) | ast::item_static(*) | ast::item_foreign_mod(*) |
618+
ast::item_fn(*) | ast::item_mod(*) | ast::item_ty(*) |
619+
ast::item_mac(*) => {}
620+
}
621+
}

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'self> StatRecorder<'self> {
165165

166166
#[unsafe_destructor]
167167
impl<'self> Drop for StatRecorder<'self> {
168-
pub fn drop(&self) {
168+
fn drop(&self) {
169169
if self.ccx.sess.trans_stats() {
170170
let end = time::precise_time_ns();
171171
let elapsed = ((end - self.start) / 1_000_000) as uint;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -709,10 +709,10 @@ pub fn AllBuiltinBounds() -> BuiltinBounds {
709709
}
710710

711711
impl CLike for BuiltinBound {
712-
pub fn to_uint(&self) -> uint {
712+
fn to_uint(&self) -> uint {
713713
*self as uint
714714
}
715-
pub fn from_uint(v: uint) -> BuiltinBound {
715+
fn from_uint(v: uint) -> BuiltinBound {
716716
unsafe { cast::transmute(v) }
717717
}
718718
}
@@ -4345,16 +4345,16 @@ pub fn normalize_ty(cx: ctxt, t: t) -> t {
43454345
}
43464346

43474347
pub trait ExprTyProvider {
4348-
pub fn expr_ty(&self, ex: &ast::expr) -> t;
4349-
pub fn ty_ctxt(&self) -> ctxt;
4348+
fn expr_ty(&self, ex: &ast::expr) -> t;
4349+
fn ty_ctxt(&self) -> ctxt;
43504350
}
43514351

43524352
impl ExprTyProvider for ctxt {
4353-
pub fn expr_ty(&self, ex: &ast::expr) -> t {
4353+
fn expr_ty(&self, ex: &ast::expr) -> t {
43544354
expr_ty(*self, ex)
43554355
}
43564356

4357-
pub fn ty_ctxt(&self) -> ctxt {
4357+
fn ty_ctxt(&self) -> ctxt {
43584358
*self
43594359
}
43604360
}

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,11 @@ pub fn blank_fn_ctxt(ccx: @mut CrateCtxt,
287287
}
288288

289289
impl ExprTyProvider for FnCtxt {
290-
pub fn expr_ty(&self, ex: &ast::expr) -> ty::t {
290+
fn expr_ty(&self, ex: &ast::expr) -> ty::t {
291291
self.expr_ty(ex)
292292
}
293293

294-
pub fn ty_ctxt(&self) -> ty::ctxt {
294+
fn ty_ctxt(&self) -> ty::ctxt {
295295
self.ccx.tcx
296296
}
297297
}

branches/try2/src/librustc/middle/typeck/infer/error_reporting.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ use util::ppaux::UserString;
7676
use util::ppaux::note_and_explain_region;
7777

7878
pub trait ErrorReporting {
79-
pub fn report_region_errors(@mut self,
80-
errors: &OptVec<RegionResolutionError>);
79+
fn report_region_errors(@mut self,
80+
errors: &OptVec<RegionResolutionError>);
8181

82-
pub fn report_and_explain_type_error(@mut self,
83-
trace: TypeTrace,
84-
terr: &ty::type_err);
82+
fn report_and_explain_type_error(@mut self,
83+
trace: TypeTrace,
84+
terr: &ty::type_err);
8585

8686
fn values_str(@mut self, values: &ValuePairs) -> Option<~str>;
8787

@@ -112,8 +112,8 @@ pub trait ErrorReporting {
112112

113113

114114
impl ErrorReporting for InferCtxt {
115-
pub fn report_region_errors(@mut self,
116-
errors: &OptVec<RegionResolutionError>) {
115+
fn report_region_errors(@mut self,
116+
errors: &OptVec<RegionResolutionError>) {
117117
for error in errors.iter() {
118118
match *error {
119119
ConcreteFailure(origin, sub, sup) => {
@@ -139,7 +139,7 @@ impl ErrorReporting for InferCtxt {
139139
}
140140
}
141141

142-
pub fn report_and_explain_type_error(@mut self,
142+
fn report_and_explain_type_error(@mut self,
143143
trace: TypeTrace,
144144
terr: &ty::type_err) {
145145
let tcx = self.tcx;

branches/try2/src/librustc/middle/typeck/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,11 @@ trait get_and_find_region {
294294
}
295295

296296
impl get_and_find_region for isr_alist {
297-
pub fn get(&self, br: ty::bound_region) -> ty::Region {
297+
fn get(&self, br: ty::bound_region) -> ty::Region {
298298
self.find(br).unwrap()
299299
}
300300

301-
pub fn find(&self, br: ty::bound_region) -> Option<ty::Region> {
301+
fn find(&self, br: ty::bound_region) -> Option<ty::Region> {
302302
let mut ret = None;
303303
do list::each(*self) |isr| {
304304
let (isr_br, isr_r) = *isr;

branches/try2/src/librustdoc/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ use extra::getopts;
2222
#[deriving(Clone, Eq)]
2323
pub enum OutputFormat {
2424
/// Markdown
25-
pub Markdown,
25+
Markdown,
2626
/// HTML, via markdown and pandoc
27-
pub PandocHtml
27+
PandocHtml
2828
}
2929

3030
/// How to organize the output
3131
#[deriving(Clone, Eq)]
3232
pub enum OutputStyle {
3333
/// All in a single document
34-
pub DocPerCrate,
34+
DocPerCrate,
3535
/// Each module in its own document
36-
pub DocPerMod
36+
DocPerMod
3737
}
3838

3939
/// The configuration for a rustdoc session

branches/try2/src/librustpkg/package_source.rs

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,19 @@ impl PkgSrc {
5252
use conditions::nonexistent_package::cond;
5353

5454
debug!("Pushing onto root: %s | %s", self.id.path.to_str(), self.root.to_str());
55-
let dir;
55+
5656
let dirs = pkgid_src_in_workspace(&self.id, &self.root);
5757
debug!("Checking dirs: %?", dirs);
5858
let path = dirs.iter().find(|&d| os::path_exists(d));
59-
match path {
60-
Some(d) => dir = (*d).clone(),
61-
None => dir = match self.fetch_git() {
59+
60+
let dir = match path {
61+
Some(d) => (*d).clone(),
62+
None => match self.fetch_git() {
63+
Some(d) => d,
6264
None => cond.raise((self.id.clone(), ~"supplied path for package dir does not \
63-
exist, and couldn't interpret it as a URL fragment")),
64-
Some(d) => d
65+
exist, and couldn't interpret it as a URL fragment"))
6566
}
66-
}
67+
};
6768
if !os::path_is_dir(&dir) {
6869
cond.raise((self.id.clone(), ~"supplied path for package dir is a \
6970
non-directory"));
@@ -145,26 +146,26 @@ impl PkgSrc {
145146
let prefix = dir.components.len();
146147
debug!("Matching against %?", self.id.short_name);
147148
do os::walk_dir(&dir) |pth| {
148-
match pth.filename() {
149-
Some(~"lib.rs") => PkgSrc::push_crate(&mut self.libs,
150-
prefix,
151-
pth),
152-
Some(~"main.rs") => PkgSrc::push_crate(&mut self.mains,
153-
prefix,
154-
pth),
155-
Some(~"test.rs") => PkgSrc::push_crate(&mut self.tests,
156-
prefix,
157-
pth),
158-
Some(~"bench.rs") => PkgSrc::push_crate(&mut self.benchs,
159-
prefix,
160-
pth),
161-
_ => ()
149+
let maybe_known_crate_set = match pth.filename() {
150+
Some(filename) => match filename {
151+
~"lib.rs" => Some(&mut self.libs),
152+
~"main.rs" => Some(&mut self.mains),
153+
~"test.rs" => Some(&mut self.tests),
154+
~"bench.rs" => Some(&mut self.benchs),
155+
_ => None
156+
},
157+
_ => None
158+
};
159+
160+
match maybe_known_crate_set {
161+
Some(crate_set) => PkgSrc::push_crate(crate_set, prefix, pth),
162+
None => ()
162163
}
163164
true
164165
};
165166

166-
if self.libs.is_empty() && self.mains.is_empty()
167-
&& self.tests.is_empty() && self.benchs.is_empty() {
167+
let crate_sets = [&self.libs, &self.mains, &self.tests, &self.benchs];
168+
if crate_sets.iter().all(|crate_set| crate_set.is_empty()) {
168169

169170
note("Couldn't infer any crates to build.\n\
170171
Try naming a crate `main.rs`, `lib.rs`, \

0 commit comments

Comments
 (0)