Skip to content

Commit 6a02ded

Browse files
committed
---
yaml --- r: 227769 b: refs/heads/try c: db5b463 h: refs/heads/master i: 227767: 44485b5 v: v3
1 parent 278155f commit 6a02ded

Some content is hidden

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

51 files changed

+1012
-1202
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 27ecbba388877467d2f4d62e2c5e15fe0d415650
4+
refs/heads/try: db5b4637052eafc25e51f325b8ec84a51daf35c0
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/doc/footer.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ or the <a href="http://opensource.org/licenses/MIT">MIT license</a>, at your opt
55
</p><p>
66
This file may not be copied, modified, or distributed except according to those terms.
77
</p></footer>
8+
<script type="text/javascript" src="jquery.js"></script>
89
<script type="text/javascript" src="playpen.js"></script>

branches/try/src/doc/style/features/traits/generics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ yielding items of type `A` to produce a collection of `A`:
88
fn from_iter<T: Iterator<A>>(iterator: T) -> SomeCollection<A>
99
```
1010

11-
Here, the `Iterator` trait specifies an interface that a type `T` must
11+
Here, the `Iterator` trait is specifies an interface that a type `T` must
1212
explicitly implement to be used by this generic function.
1313

1414
**Pros**:

branches/try/src/doc/trpl/documentation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ we could have added more explanation in a new paragraph.
101101

102102
#### Special sections
103103

104+
```rust
105+
/// # Examples
106+
# fn foo() {}
107+
```
108+
104109
Next, are special sections. These are indicated with a header, `#`. There
105110
are three kinds of headers that are commonly used. They aren't special syntax,
106111
just convention, for now.

branches/try/src/doc/trpl/error-handling.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ There's another way of doing this that's a bit nicer than `unwrap()`:
225225

226226
```rust,ignore
227227
let mut buffer = String::new();
228-
let num_bytes_read = io::stdin().read_line(&mut buffer)
229-
.ok()
230-
.expect("Failed to read line");
228+
let input = io::stdin().read_line(&mut buffer)
229+
.ok()
230+
.expect("Failed to read line");
231231
```
232232

233233
`ok()` converts the `Result` into an `Option`, and `expect()` does the same

branches/try/src/liblibc/lib.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5493,17 +5493,17 @@ pub mod funcs {
54935493
pub fn dup2(src: c_int, dst: c_int) -> c_int;
54945494
#[link_name = "_execv"]
54955495
pub fn execv(prog: *const c_char,
5496-
argv: *const *const c_char) -> intptr_t;
5496+
argv: *mut *const c_char) -> intptr_t;
54975497
#[link_name = "_execve"]
5498-
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5499-
envp: *const *const c_char)
5498+
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5499+
envp: *mut *const c_char)
55005500
-> c_int;
55015501
#[link_name = "_execvp"]
55025502
pub fn execvp(c: *const c_char,
5503-
argv: *const *const c_char) -> c_int;
5503+
argv: *mut *const c_char) -> c_int;
55045504
#[link_name = "_execvpe"]
5505-
pub fn execvpe(c: *const c_char, argv: *const *const c_char,
5506-
envp: *const *const c_char) -> c_int;
5505+
pub fn execvpe(c: *const c_char, argv: *mut *const c_char,
5506+
envp: *mut *const c_char) -> c_int;
55075507
#[link_name = "_getcwd"]
55085508
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
55095509
#[link_name = "_getpid"]
@@ -5687,12 +5687,12 @@ pub mod funcs {
56875687
pub fn dup(fd: c_int) -> c_int;
56885688
pub fn dup2(src: c_int, dst: c_int) -> c_int;
56895689
pub fn execv(prog: *const c_char,
5690-
argv: *const *const c_char) -> c_int;
5691-
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5692-
envp: *const *const c_char)
5690+
argv: *mut *const c_char) -> c_int;
5691+
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5692+
envp: *mut *const c_char)
56935693
-> c_int;
56945694
pub fn execvp(c: *const c_char,
5695-
argv: *const *const c_char) -> c_int;
5695+
argv: *mut *const c_char) -> c_int;
56965696
pub fn fork() -> pid_t;
56975697
pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
56985698
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
@@ -5702,9 +5702,7 @@ pub mod funcs {
57025702
pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
57035703
-> c_int;
57045704
pub fn getlogin() -> *mut c_char;
5705-
// GNU getopt(3) modifies its arguments despite the
5706-
// char * const [] prototype; see the manpage.
5707-
pub fn getopt(argc: c_int, argv: *mut *mut c_char,
5705+
pub fn getopt(argc: c_int, argv: *mut *const c_char,
57085706
optstr: *const c_char) -> c_int;
57095707
pub fn getpgrp() -> pid_t;
57105708
pub fn getpid() -> pid_t;
@@ -5754,19 +5752,19 @@ pub mod funcs {
57545752
pub fn dup(fd: c_int) -> c_int;
57555753
pub fn dup2(src: c_int, dst: c_int) -> c_int;
57565754
pub fn execv(prog: *const c_char,
5757-
argv: *const *const c_char) -> c_int;
5758-
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5759-
envp: *const *const c_char)
5755+
argv: *mut *const c_char) -> c_int;
5756+
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5757+
envp: *mut *const c_char)
57605758
-> c_int;
57615759
pub fn execvp(c: *const c_char,
5762-
argv: *const *const c_char) -> c_int;
5760+
argv: *mut *const c_char) -> c_int;
57635761
pub fn fork() -> pid_t;
57645762
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
57655763
pub fn getegid() -> gid_t;
57665764
pub fn geteuid() -> uid_t;
57675765
pub fn getgid() -> gid_t;
57685766
pub fn getlogin() -> *mut c_char;
5769-
pub fn getopt(argc: c_int, argv: *const *const c_char,
5767+
pub fn getopt(argc: c_int, argv: *mut *const c_char,
57705768
optstr: *const c_char) -> c_int;
57715769
pub fn getuid() -> uid_t;
57725770
pub fn getsid(pid: pid_t) -> pid_t;

branches/try/src/librustc/metadata/tydecode.rs

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,15 @@ pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: us
195195
parse_substs(&mut st, conv)
196196
}
197197

198+
pub fn parse_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum,
199+
pos: usize, tcx: &ty::ctxt<'tcx>, conv: F)
200+
-> ty::ParamBounds<'tcx> where
201+
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
202+
{
203+
let mut st = parse_state_from_data(data, crate_num, pos, tcx);
204+
parse_bounds(&mut st, conv)
205+
}
206+
198207
pub fn parse_existential_bounds_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum,
199208
pos: usize, tcx: &ty::ctxt<'tcx>, conv: F)
200209
-> ty::ExistentialBounds<'tcx> where
@@ -870,23 +879,11 @@ fn parse_existential_bounds_<'a,'tcx, F>(st: &mut PState<'a,'tcx>,
870879
-> ty::ExistentialBounds<'tcx> where
871880
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
872881
{
873-
let builtin_bounds = parse_builtin_bounds_(st, conv);
874-
let region_bound = parse_region_(st, conv);
875-
let mut projection_bounds = Vec::new();
876-
877-
loop {
878-
match next(st) {
879-
'P' => {
880-
projection_bounds.push(
881-
ty::Binder(parse_projection_predicate_(st, conv)));
882-
}
883-
'.' => { break; }
884-
c => {
885-
panic!("parse_bounds: bad bounds ('{}')", c)
886-
}
887-
}
888-
}
889-
882+
let ty::ParamBounds { trait_bounds, mut region_bounds, builtin_bounds, projection_bounds } =
883+
parse_bounds_(st, conv);
884+
assert_eq!(region_bounds.len(), 1);
885+
assert_eq!(trait_bounds.len(), 0);
886+
let region_bound = region_bounds.pop().unwrap();
890887
return ty::ExistentialBounds { region_bound: region_bound,
891888
builtin_bounds: builtin_bounds,
892889
projection_bounds: projection_bounds };
@@ -926,3 +923,60 @@ fn parse_builtin_bounds_<F>(st: &mut PState, _conv: &mut F) -> ty::BuiltinBounds
926923
}
927924
}
928925
}
926+
927+
fn parse_bounds<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, mut conv: F)
928+
-> ty::ParamBounds<'tcx> where
929+
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
930+
{
931+
parse_bounds_(st, &mut conv)
932+
}
933+
934+
fn parse_bounds_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F)
935+
-> ty::ParamBounds<'tcx> where
936+
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
937+
{
938+
let builtin_bounds = parse_builtin_bounds_(st, conv);
939+
940+
let region_bounds = parse_region_bounds_(st, conv);
941+
942+
let mut param_bounds = ty::ParamBounds {
943+
region_bounds: region_bounds,
944+
builtin_bounds: builtin_bounds,
945+
trait_bounds: Vec::new(),
946+
projection_bounds: Vec::new(),
947+
};
948+
949+
950+
loop {
951+
match next(st) {
952+
'I' => {
953+
param_bounds.trait_bounds.push(
954+
ty::Binder(parse_trait_ref_(st, conv)));
955+
}
956+
'P' => {
957+
param_bounds.projection_bounds.push(
958+
ty::Binder(parse_projection_predicate_(st, conv)));
959+
}
960+
'.' => {
961+
return param_bounds;
962+
}
963+
c => {
964+
panic!("parse_bounds: bad bounds ('{}')", c)
965+
}
966+
}
967+
}
968+
}
969+
970+
fn parse_region_bounds_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F)
971+
-> Vec<ty::Region> where
972+
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
973+
{
974+
let mut region_bounds = Vec::new();
975+
loop {
976+
match next(st) {
977+
'R' => { region_bounds.push(parse_region_(st, conv)); }
978+
'.' => { return region_bounds; }
979+
c => { panic!("parse_bounds: bad bounds ('{}')", c); }
980+
}
981+
}
982+
}

branches/try/src/librustc/metadata/tyencode.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,23 @@ pub fn enc_builtin_bounds(w: &mut Encoder, _cx: &ctxt, bs: &ty::BuiltinBounds) {
380380
pub fn enc_existential_bounds<'a,'tcx>(w: &mut Encoder,
381381
cx: &ctxt<'a,'tcx>,
382382
bs: &ty::ExistentialBounds<'tcx>) {
383+
let param_bounds = ty::ParamBounds { trait_bounds: vec!(),
384+
region_bounds: vec!(bs.region_bound),
385+
builtin_bounds: bs.builtin_bounds,
386+
projection_bounds: bs.projection_bounds.clone() };
387+
enc_bounds(w, cx, &param_bounds);
388+
}
389+
390+
pub fn enc_bounds<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>,
391+
bs: &ty::ParamBounds<'tcx>) {
383392
enc_builtin_bounds(w, cx, &bs.builtin_bounds);
384393

385-
enc_region(w, cx, bs.region_bound);
394+
enc_region_bounds(w, cx, &bs.region_bounds);
395+
396+
for tp in &bs.trait_bounds {
397+
mywrite!(w, "I");
398+
enc_trait_ref(w, cx, tp.0);
399+
}
386400

387401
for tp in &bs.projection_bounds {
388402
mywrite!(w, "P");

branches/try/src/librustc/middle/check_match.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub use self::Constructor::*;
1212
use self::Usefulness::*;
1313
use self::WitnessPreference::*;
1414

15-
use middle::const_eval::{compare_const_vals, ConstVal};
15+
use middle::const_eval::{compare_const_vals, const_bool, const_float, const_val};
1616
use middle::const_eval::{eval_const_expr, eval_const_expr_partial};
1717
use middle::const_eval::{const_expr_to_pat, lookup_const_by_id};
1818
use middle::def::*;
@@ -111,9 +111,9 @@ pub enum Constructor {
111111
/// Enum variants.
112112
Variant(ast::DefId),
113113
/// Literal values.
114-
ConstantValue(ConstVal),
114+
ConstantValue(const_val),
115115
/// Ranges of literal values (2..5).
116-
ConstantRange(ConstVal, ConstVal),
116+
ConstantRange(const_val, const_val),
117117
/// Array patterns of length n.
118118
Slice(usize),
119119
/// Array patterns with a subslice.
@@ -262,7 +262,7 @@ fn check_for_static_nan(cx: &MatchCheckCtxt, pat: &Pat) {
262262
ast_util::walk_pat(pat, |p| {
263263
if let ast::PatLit(ref expr) = p.node {
264264
match eval_const_expr_partial(cx.tcx, &**expr, None) {
265-
Ok(ConstVal::Float(f)) if f.is_nan() => {
265+
Ok(const_float(f)) if f.is_nan() => {
266266
span_warn!(cx.tcx.sess, p.span, E0003,
267267
"unmatchable NaN in pattern, \
268268
use the is_nan method in a guard instead");
@@ -391,9 +391,9 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, matrix: &Matrix, source: ast:
391391
}
392392
}
393393

394-
fn const_val_to_expr(value: &ConstVal) -> P<ast::Expr> {
394+
fn const_val_to_expr(value: &const_val) -> P<ast::Expr> {
395395
let node = match value {
396-
&ConstVal::Bool(b) => ast::LitBool(b),
396+
&const_bool(b) => ast::LitBool(b),
397397
_ => unreachable!()
398398
};
399399
P(ast::Expr {
@@ -596,7 +596,7 @@ fn all_constructors(cx: &MatchCheckCtxt, left_ty: Ty,
596596
max_slice_length: usize) -> Vec<Constructor> {
597597
match left_ty.sty {
598598
ty::TyBool =>
599-
[true, false].iter().map(|b| ConstantValue(ConstVal::Bool(*b))).collect(),
599+
[true, false].iter().map(|b| ConstantValue(const_bool(*b))).collect(),
600600

601601
ty::TyRef(_, ty::mt { ty, .. }) => match ty.sty {
602602
ty::TySlice(_) =>
@@ -826,7 +826,7 @@ pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> usi
826826
}
827827

828828
fn range_covered_by_constructor(ctor: &Constructor,
829-
from: &ConstVal, to: &ConstVal) -> Option<bool> {
829+
from: &const_val, to: &const_val) -> Option<bool> {
830830
let (c_from, c_to) = match *ctor {
831831
ConstantValue(ref value) => (value, value),
832832
ConstantRange(ref from, ref to) => (from, to),

0 commit comments

Comments
 (0)