Skip to content

Commit a7be03c

Browse files
committed
---
yaml --- r: 96143 b: refs/heads/dist-snap c: 8e59c5d h: refs/heads/master i: 96141: 39b4cc2 96139: 9647bf8 96135: 3723164 96127: d68cdc4 v: v3
1 parent 4c743fe commit a7be03c

36 files changed

+266
-519
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 8eda5d831591e608b7de2910469a73d1dc02da42
9+
refs/heads/dist-snap: 8e59c5d34a19e7ce58fec377f3033296476c5e92
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/rust.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ common_escape : '\x5c'
254254
hex_digit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
255255
| 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
256256
| dec_digit ;
257-
oct_digit : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' ;
258257
dec_digit : '0' | nonzero_dec ;
259258
nonzero_dec: '1' | '2' | '3' | '4'
260259
| '5' | '6' | '7' | '8' | '9' ;
@@ -319,9 +318,8 @@ r##"foo #"# bar"##; // foo #"# bar
319318
~~~~ {.ebnf .gram}
320319
321320
num_lit : nonzero_dec [ dec_digit | '_' ] * num_suffix ?
322-
| '0' [ [ dec_digit | '_' ] * num_suffix ?
321+
| '0' [ [ dec_digit | '_' ] + num_suffix ?
323322
| 'b' [ '1' | '0' | '_' ] + int_suffix ?
324-
| 'o' [ oct_digit | '_' ] + int_suffix ?
325323
| 'x' [ hex_digit | '_' ] + int_suffix ? ] ;
326324
327325
num_suffix : int_suffix | float_suffix ;
@@ -1550,7 +1548,6 @@ keyword for struct fields and enum variants). When an item is declared as `pub`,
15501548
it can be thought of as being accessible to the outside world. For example:
15511549

15521550
~~~~
1553-
# fn main() {}
15541551
// Declare a private struct
15551552
struct Foo;
15561553

branches/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/mk/ctags.mk

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

1616
.PHONY: TAGS.emacs TAGS.vi
1717

18-
CTAGS_OPTS=--options=${CFG_SRC_DIR}/src/etc/ctags.rust -R ${CFG_SRC_DIR}/src
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.
1939

2040
TAGS.emacs:
2141
ctags -e -f $@ ${CTAGS_OPTS}

branches/dist-snap/src/libextra/num/bigint.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ impl ToStrRadix for BigUint {
660660
let divider = FromPrimitive::from_uint(base).unwrap();
661661
let mut result = ~[];
662662
let mut m = n;
663-
while m >= divider {
663+
while m > divider {
664664
let (d, m0) = m.div_mod_floor(&divider);
665665
result.push(m0.to_uint().unwrap() as BigDigit);
666666
m = d;
@@ -2520,11 +2520,6 @@ mod bigint_tests {
25202520
check("-10", Some(-10));
25212521
check("Z", None);
25222522
check("_", None);
2523-
2524-
// issue 10522, this hit an edge case that caused it to
2525-
// attempt to allocate a vector of size (-1u) == huge.
2526-
let x: BigInt = from_str("1" + "0".repeat(36)).unwrap();
2527-
let _y = x.to_str();
25282523
}
25292524

25302525
#[test]

branches/dist-snap/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/dist-snap/src/libextra/url.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,16 +364,6 @@ fn query_from_str(rawquery: &str) -> Query {
364364
return query;
365365
}
366366

367-
/**
368-
* Converts an instance of a URI `Query` type to a string.
369-
*
370-
* # Example
371-
*
372-
* ```rust
373-
* let query = ~[(~"title", ~"The Village"), (~"north", ~"52.91"), (~"west", ~"4.10")];
374-
* println(query_to_str(&query)); // title=The%20Village&north=52.91&west=4.10
375-
* ```
376-
*/
377367
pub fn query_to_str(query: &Query) -> ~str {
378368
let mut strvec = ~[];
379369
for kv in query.iter() {

branches/dist-snap/src/librustc/middle/check_const.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
117117
ExprUnary(_, UnDeref, _) => { }
118118
ExprUnary(_, UnBox(_), _) | ExprUnary(_, UnUniq, _) => {
119119
sess.span_err(e.span,
120-
"cannot do allocations in constant expressions");
120+
"disallowed operator in constant expression");
121121
return;
122122
}
123123
ExprLit(@codemap::Spanned {node: lit_str(*), _}) => { }
@@ -191,13 +191,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
191191
e.span,
192192
"borrowed pointers in constants may only refer to \
193193
immutable values");
194-
},
195-
ExprVstore(_, ExprVstoreUniq) |
196-
ExprVstore(_, ExprVstoreBox) |
197-
ExprVstore(_, ExprVstoreMutBox) => {
198-
sess.span_err(e.span, "cannot allocate vectors in constant expressions")
199-
},
200-
194+
}
201195
_ => {
202196
sess.span_err(e.span,
203197
"constant contains unimplemented expression type");

branches/dist-snap/src/librustc/middle/lint.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -883,23 +883,20 @@ fn check_unused_unsafe(cx: &Context, e: &ast::Expr) {
883883

884884
fn check_unused_mut_pat(cx: &Context, p: @ast::Pat) {
885885
match p.node {
886-
ast::PatIdent(ast::BindByValue(ast::MutMutable),
887-
ref path, _) if pat_util::pat_is_binding(cx.tcx.def_map, p)=> {
888-
// `let mut _a = 1;` doesn't need a warning.
889-
let initial_underscore = match path.segments {
890-
[ast::PathSegment { identifier: id, _ }] => {
891-
cx.tcx.sess.str_of(id).starts_with("_")
892-
}
893-
_ => {
894-
cx.tcx.sess.span_bug(p.span,
895-
"mutable binding that doesn't \
896-
consist of exactly one segment");
897-
}
898-
};
899-
900-
if !initial_underscore && !cx.tcx.used_mut_nodes.contains(&p.id) {
901-
cx.span_lint(unused_mut, p.span,
902-
"variable does not need to be mutable");
886+
ast::PatIdent(ast::BindByValue(ast::MutMutable), _, _) => {
887+
let mut used = false;
888+
let mut bindings = 0;
889+
do pat_util::pat_bindings(cx.tcx.def_map, p) |_, id, _, _| {
890+
used = used || cx.tcx.used_mut_nodes.contains(&id);
891+
bindings += 1;
892+
}
893+
if !used {
894+
let msg = if bindings == 1 {
895+
"variable does not need to be mutable"
896+
} else {
897+
"variables do not need to be mutable"
898+
};
899+
cx.span_lint(unused_mut, p.span, msg);
903900
}
904901
}
905902
_ => ()

branches/dist-snap/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,

branches/dist-snap/src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ pub fn subst_tps(tcx: ctxt, tps: &[t], self_ty_opt: Option<t>, typ: t) -> t {
14091409
let mut subst = TpsSubst { tcx: tcx, self_ty_opt: self_ty_opt, tps: tps };
14101410
return subst.fold_ty(typ);
14111411

1412-
struct TpsSubst<'self> {
1412+
pub struct TpsSubst<'self> {
14131413
tcx: ctxt,
14141414
self_ty_opt: Option<t>,
14151415
tps: &'self [t],

0 commit comments

Comments
 (0)