Skip to content

Commit c566bd9

Browse files
committed
---
yaml --- r: 210936 b: refs/heads/try c: 09a473e h: refs/heads/master v: v3
1 parent 370f77e commit c566bd9

34 files changed

+55
-110
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 8a8583c160c0784730b9fd487e0e82615db7ba5b
5+
refs/heads/try: 09a473ea7bd85361af971e2f66ec23cfe1d62362
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/AUTHORS.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Aaron Raimist <[email protected]>
88
Aaron Todd <[email protected]>
99
Aaron Turon <[email protected]>
1010
Aaron Weiss <[email protected]>
11-
Abhishek Chanda <abhishek.becs@gmail.com>
11+
Abhishek Chanda <abhishek@cloudscaling.com>
1212
Adam Bozanich <[email protected]>
1313
Adam Jacob <[email protected]>
1414
Adam Roben <[email protected]>

branches/try/src/doc/complement-lang-faq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
There aren't many large programs yet. The Rust [compiler][rustc], 60,000+ lines at the time of writing, is written in Rust. As the oldest body of Rust code it has gone through many iterations of the language, and some parts are nicer to look at than others. It may not be the best code to learn from, but [borrowck] and [resolve] were written recently.
66

77
[rustc]: https://github.com/rust-lang/rust/tree/master/src/librustc
8-
[resolve]: https://github.com/rust-lang/rust/tree/master/src/librustc_resolve
9-
[borrowck]: https://github.com/rust-lang/rust/tree/master/src/librustc_borrowck/borrowck
8+
[resolve]: https://github.com/rust-lang/rust/blob/master/src/librustc/middle/resolve.rs
9+
[borrowck]: https://github.com/rust-lang/rust/blob/master/src/librustc/middle/borrowck/
1010

1111
A research browser engine called [Servo][servo], currently 30,000+ lines across more than a dozen crates, will be exercising a lot of Rust's distinctive type-system and concurrency features, and integrating many native libraries.
1212

@@ -20,8 +20,8 @@ Some examples that demonstrate different aspects of the language:
2020
* The standard library's [json] module. Enums and pattern matching
2121

2222
[sprocketnes]: https://github.com/pcwalton/sprocketnes
23-
[hash]: https://github.com/rust-lang/rust/tree/master/src/libcore/hash
24-
[HashMap]: https://github.com/rust-lang/rust/tree/master/src/libstd/collections/hash
23+
[hash]: https://github.com/rust-lang/rust/blob/master/src/libstd/hash/mod.rs
24+
[HashMap]: https://github.com/rust-lang/rust/blob/master/src/libcollections/hashmap.rs
2525
[json]: https://github.com/rust-lang/rust/blob/master/src/libserialize/json.rs
2626

2727
You may also be interested in browsing [trending Rust repositories][github-rust] on GitHub.

branches/try/src/doc/trpl/dining-philosophers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ from the standard library, and so we need to `use` it.
320320
We now print out two messages, with a `sleep_ms()` in the middle. This will
321321
simulate the time it takes a philosopher to eat.
322322

323-
If you run this program, you should see each philosopher eat in turn:
323+
If you run this program, You should see each philosopher eat in turn:
324324

325325
```text
326326
Baruch Spinoza is eating.
@@ -480,7 +480,7 @@ struct Table {
480480
}
481481
```
482482

483-
This `Table` has a vector of `Mutex`es. A mutex is a way to control
483+
This `Table` has an vector of `Mutex`es. A mutex is a way to control
484484
concurrency: only one thread can access the contents at once. This is exactly
485485
the property we need with our forks. We use an empty tuple, `()`, inside the
486486
mutex, since we’re not actually going to use the value, just hold onto it.

branches/try/src/doc/trpl/installing-rust.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ $ sh rustup.sh
2323
If you're on Windows, please download either the [32-bit installer][win32] or
2424
the [64-bit installer][win64] and run it.
2525

26-
[win32]: https://static.rust-lang.org/dist/rust-1.0.0-i686-pc-windows-gnu.msi
27-
[win64]: https://static.rust-lang.org/dist/rust-1.0.0-x86_64-pc-windows-gnu.msi
26+
[win32]: https://static.rust-lang.org/dist/rust-1.0.0-beta-i686-pc-windows-gnu.msi
27+
[win64]: https://static.rust-lang.org/dist/rust-1.0.0-beta-x86_64-pc-windows-gnu.msi
2828

2929
## Uninstalling
3030

@@ -74,7 +74,7 @@ $ rustc --version
7474
You should see the version number, commit hash, commit date and build date:
7575

7676
```bash
77-
rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)
77+
rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
7878
```
7979

8080
If you did, Rust has been installed successfully! Congrats!

branches/try/src/doc/trpl/references-and-borrowing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ We can’t modify `v` because it’s borrowed by the loop.
297297
References must live as long as the resource they refer to. Rust will check the
298298
scopes of your references to ensure that this is true.
299299

300-
If Rust didn’t check that this property, we could accidentally use a reference
300+
If Rust didn’t check this property, we could accidentally use a reference
301301
which was invalid. For example:
302302

303303
```rust,ignore

branches/try/src/doc/trpl/rust-inside-other-languages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn process() {
104104
let handles: Vec<_> = (0..10).map(|_| {
105105
thread::spawn(|| {
106106
let mut _x = 0;
107-
for _ in (0..5_000_000) {
107+
for _ in (0..5_000_001) {
108108
_x += 1
109109
}
110110
})

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ Rust has two main types of strings: `&str` and `String`. Let’s talk about
1616
`&'static str`:
1717

1818
```rust
19-
let greeting = "Hello there."; // greeting: &'static str
19+
let string = "Hello there."; // string: &'static str
2020
```
2121

2222
This string is statically allocated, meaning that it’s saved inside our
23-
compiled program, and exists for the entire duration it runs. The `greeting`
23+
compiled program, and exists for the entire duration it runs. The `string`
2424
binding is a reference to this statically allocated string. String slices
2525
have a fixed size, and cannot be mutated.
2626

branches/try/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ impl String {
433433
///
434434
/// ```
435435
/// let mut s = String::new();
436-
/// s.reserve_exact(10);
436+
/// s.reserve(10);
437437
/// assert!(s.capacity() >= 10);
438438
/// ```
439439
#[inline]

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -34,7 +34,7 @@ use std::borrow::{Cow, IntoCow};
3434
use std::num::wrapping::OverflowingOps;
3535
use std::cmp::Ordering;
3636
use std::collections::hash_map::Entry::Vacant;
37-
use std::{i8, i16, i32, i64, u8, u16, u32, u64};
37+
use std::{i8, i16, i32, i64};
3838
use std::rc::Rc;
3939

4040
fn lookup_const<'a>(tcx: &'a ty::ctxt, e: &Expr) -> Option<&'a Expr> {
@@ -461,16 +461,6 @@ pub fn const_uint_checked_neg<'a>(
461461
Ok(const_uint((!a).wrapping_add(1)))
462462
}
463463

464-
fn const_uint_not(a: u64, opt_ety: Option<UintTy>) -> const_val {
465-
let mask = match opt_ety {
466-
Some(UintTy::U8) => u8::MAX as u64,
467-
Some(UintTy::U16) => u16::MAX as u64,
468-
Some(UintTy::U32) => u32::MAX as u64,
469-
None | Some(UintTy::U64) => u64::MAX,
470-
};
471-
const_uint(!a & mask)
472-
}
473-
474464
macro_rules! overflow_checking_body {
475465
($a:ident, $b:ident, $ety:ident, $overflowing_op:ident,
476466
lhs: $to_8_lhs:ident $to_16_lhs:ident $to_32_lhs:ident,
@@ -687,7 +677,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
687677
ast::ExprUnary(ast::UnNot, ref inner) => {
688678
match try!(eval_const_expr_partial(tcx, &**inner, ety)) {
689679
const_int(i) => const_int(!i),
690-
const_uint(i) => const_uint_not(i, expr_uint_type),
680+
const_uint(i) => const_uint(!i),
691681
const_bool(b) => const_bool(!b),
692682
const_str(_) => signal!(e, NotOnString),
693683
const_float(_) => signal!(e, NotOnFloat),

branches/try/src/librustc_typeck/check/mod.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,10 +3153,26 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
31533153
Some(&**oprnd), oprnd_t, lvalue_pref) {
31543154
Some(mt) => mt.ty,
31553155
None => {
3156-
fcx.type_error_message(expr.span, |actual| {
3157-
format!("type `{}` cannot be \
3158-
dereferenced", actual)
3159-
}, oprnd_t, None);
3156+
let is_newtype = match oprnd_t.sty {
3157+
ty::ty_struct(did, substs) => {
3158+
let fields = ty::struct_fields(fcx.tcx(), did, substs);
3159+
fields.len() == 1
3160+
&& fields[0].name ==
3161+
token::special_idents::unnamed_field.name
3162+
}
3163+
_ => false
3164+
};
3165+
if is_newtype {
3166+
// This is an obsolete struct deref
3167+
span_err!(tcx.sess, expr.span, E0068,
3168+
"single-field tuple-structs can \
3169+
no longer be dereferenced");
3170+
} else {
3171+
fcx.type_error_message(expr.span, |actual| {
3172+
format!("type `{}` cannot be \
3173+
dereferenced", actual)
3174+
}, oprnd_t, None);
3175+
}
31603176
tcx.types.err
31613177
}
31623178
}

branches/try/src/libstd/collections/hash/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl<K, V, S> HashMap<K, V, S>
539539
{
540540
/// Creates an empty hashmap which will use the given hasher to hash keys.
541541
///
542-
/// The created map has the default initial capacity.
542+
/// The creates map has the default initial capacity.
543543
///
544544
/// # Examples
545545
///

branches/try/src/libstd/ffi/c_str.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ use vec::Vec;
5353
/// fn my_printer(s: *const libc::c_char);
5454
/// }
5555
///
56-
/// let c_to_print = CString::new("Hello, world!").unwrap();
56+
/// let to_print = &b"Hello, world!"[..];
57+
/// let c_to_print = CString::new(to_print).unwrap();
5758
/// unsafe {
5859
/// my_printer(c_to_print.as_ptr());
5960
/// }

branches/try/src/libstd/fs.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,19 +1099,20 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
10991099
/// # Examples
11001100
///
11011101
/// ```
1102+
/// # #![feature(path_ext)]
11021103
/// use std::io;
1103-
/// use std::fs::{self, DirEntry};
1104+
/// use std::fs::{self, PathExt, DirEntry};
11041105
/// use std::path::Path;
11051106
///
11061107
/// // one possible implementation of fs::walk_dir only visiting files
1107-
/// fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> {
1108-
/// if try!(fs::metadata(dir)).is_dir() {
1108+
/// fn visit_dirs(dir: &Path, cb: &mut FnMut(DirEntry)) -> io::Result<()> {
1109+
/// if dir.is_dir() {
11091110
/// for entry in try!(fs::read_dir(dir)) {
11101111
/// let entry = try!(entry);
1111-
/// if try!(fs::metadata(entry.path())).is_dir() {
1112+
/// if entry.path().is_dir() {
11121113
/// try!(visit_dirs(&entry.path(), cb));
11131114
/// } else {
1114-
/// cb(&entry);
1115+
/// cb(entry);
11151116
/// }
11161117
/// }
11171118
/// }

branches/try/src/libstd/net/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use sys_common::net as net_imp;
1919

2020
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
2121
pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};
22-
pub use self::tcp::{TcpStream, TcpListener, Incoming};
22+
pub use self::tcp::{TcpStream, TcpListener};
2323
pub use self::udp::UdpSocket;
2424
pub use self::parser::AddrParseError;
2525

branches/try/src/libstd/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ impl Path {
14851485
iter_after(self.components().rev(), child.as_ref().components().rev()).is_some()
14861486
}
14871487

1488-
/// Extracts the stem (non-extension) portion of `self.file_name()`.
1488+
/// Extracts the stem (non-extension) portion of `self.file()`.
14891489
///
14901490
/// The stem is:
14911491
///
@@ -1508,7 +1508,7 @@ impl Path {
15081508
self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after))
15091509
}
15101510

1511-
/// Extracts the extension of `self.file_name()`, if possible.
1511+
/// Extracts the extension of `self.file()`, if possible.
15121512
///
15131513
/// The extension is:
15141514
///

branches/try/src/libsyntax/ext/deriving/clone.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
3939
args: Vec::new(),
4040
ret_ty: Self_,
4141
attributes: attrs,
42-
is_unsafe: false,
4342
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
4443
cs_clone("Clone", c, s, sub)
4544
})),

branches/try/src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
5959
args: vec!(),
6060
ret_ty: nil_ty(),
6161
attributes: attrs,
62-
is_unsafe: false,
6362
combine_substructure: combine_substructure(Box::new(|a, b, c| {
6463
cs_total_eq_assert(a, b, c)
6564
}))

branches/try/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
4040
args: vec!(borrowed_self()),
4141
ret_ty: Literal(path_std!(cx, core::cmp::Ordering)),
4242
attributes: attrs,
43-
is_unsafe: false,
4443
combine_substructure: combine_substructure(Box::new(|a, b, c| {
4544
cs_cmp(a, b, c)
4645
})),

branches/try/src/libsyntax/ext/deriving/cmp/partial_eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
7171
args: vec!(borrowed_self()),
7272
ret_ty: Literal(path_local!(bool)),
7373
attributes: attrs,
74-
is_unsafe: false,
7574
combine_substructure: combine_substructure(Box::new(|a, b, c| {
7675
$f(a, b, c)
7776
}))

branches/try/src/libsyntax/ext/deriving/cmp/partial_ord.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
3737
args: vec!(borrowed_self()),
3838
ret_ty: Literal(path_local!(bool)),
3939
attributes: attrs,
40-
is_unsafe: false,
4140
combine_substructure: combine_substructure(Box::new(|cx, span, substr| {
4241
cs_op($op, $equal, cx, span, substr)
4342
}))
@@ -61,7 +60,6 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
6160
args: vec![borrowed_self()],
6261
ret_ty: ret_ty,
6362
attributes: attrs,
64-
is_unsafe: false,
6563
combine_substructure: combine_substructure(Box::new(|cx, span, substr| {
6664
cs_partial_cmp(cx, span, substr)
6765
}))

branches/try/src/libsyntax/ext/deriving/decodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
7979
true
8080
)),
8181
attributes: Vec::new(),
82-
is_unsafe: false,
8382
combine_substructure: combine_substructure(Box::new(|a, b, c| {
8483
decodable_substructure(a, b, c, krate)
8584
})),

branches/try/src/libsyntax/ext/deriving/default.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
3939
args: Vec::new(),
4040
ret_ty: Self_,
4141
attributes: attrs,
42-
is_unsafe: false,
4342
combine_substructure: combine_substructure(Box::new(|a, b, c| {
4443
default_substructure(a, b, c)
4544
}))

branches/try/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
155155
true
156156
)),
157157
attributes: Vec::new(),
158-
is_unsafe: false,
159158
combine_substructure: combine_substructure(Box::new(|a, b, c| {
160159
encodable_substructure(a, b, c)
161160
})),

branches/try/src/libsyntax/ext/deriving/generic/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@ pub struct MethodDef<'a> {
253253

254254
pub attributes: Vec<ast::Attribute>,
255255

256-
// Is it an `unsafe fn`?
257-
pub is_unsafe: bool,
258-
259256
pub combine_substructure: RefCell<CombineSubstructureFunc<'a>>,
260257
}
261258

@@ -862,12 +859,6 @@ impl<'a> MethodDef<'a> {
862859
let fn_decl = cx.fn_decl(args, ret_type);
863860
let body_block = cx.block_expr(body);
864861

865-
let unsafety = if self.is_unsafe {
866-
ast::Unsafety::Unsafe
867-
} else {
868-
ast::Unsafety::Normal
869-
};
870-
871862
// Create the method.
872863
P(ast::ImplItem {
873864
id: ast::DUMMY_NODE_ID,
@@ -879,7 +870,7 @@ impl<'a> MethodDef<'a> {
879870
generics: fn_generics,
880871
abi: abi,
881872
explicit_self: explicit_self,
882-
unsafety: unsafety,
873+
unsafety: ast::Unsafety::Normal,
883874
decl: fn_decl
884875
}, body_block)
885876
})

branches/try/src/libsyntax/ext/deriving/hash.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
4444
args: vec!(Ptr(Box::new(Literal(arg)), Borrowed(None, MutMutable))),
4545
ret_ty: nil_ty(),
4646
attributes: vec![],
47-
is_unsafe: false,
4847
combine_substructure: combine_substructure(Box::new(|a, b, c| {
4948
hash_substructure(a, b, c)
5049
}))

branches/try/src/libsyntax/ext/deriving/primitive.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
4444
true)),
4545
// #[inline] liable to cause code-bloat
4646
attributes: attrs.clone(),
47-
is_unsafe: false,
4847
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
4948
cs_from("i64", c, s, sub)
5049
})),
@@ -60,7 +59,6 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
6059
true)),
6160
// #[inline] liable to cause code-bloat
6261
attributes: attrs,
63-
is_unsafe: false,
6462
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
6563
cs_from("u64", c, s, sub)
6664
})),

branches/try/src/libsyntax/ext/deriving/show.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ pub fn expand_deriving_show(cx: &mut ExtCtxt,
4242
args: vec!(fmtr),
4343
ret_ty: Literal(path_std!(cx, core::fmt::Result)),
4444
attributes: Vec::new(),
45-
is_unsafe: false,
4645
combine_substructure: combine_substructure(Box::new(|a, b, c| {
4746
show_substructure(a, b, c)
4847
}))

0 commit comments

Comments
 (0)