Skip to content

Commit 6dd7985

Browse files
committed
---
yaml --- r: 273827 b: refs/heads/beta c: 55dbffe h: refs/heads/master i: 273825: f28cda0 273823: 099f943
1 parent 30ba46f commit 6dd7985

File tree

34 files changed

+436
-600
lines changed

34 files changed

+436
-600
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 28e45bb96a2d6e956cc2e8cd1a8686a3de97eb25
26+
refs/heads/beta: 55dbffe6dfe344caab85ee5a0fb9718c72755f07
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
177177
Rust has an [IRC] culture and most real-time collaboration happens in a
178178
variety of channels on Mozilla's IRC network, irc.mozilla.org. The
179179
most popular channel is [#rust], a venue for general discussion about
180-
Rust, and a good place to ask for help.
180+
Rust. And a good place to ask for help would be [#rust-beginners].
181181
182182
[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
183183
[#rust]: irc://irc.mozilla.org/rust
184+
[#rust-beginners]: irc://irc.mozilla.org/rust-beginners
184185
185186
## License
186187

branches/beta/src/doc/book/getting-started.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,15 @@ installed. Doing so will depend on your specific system, consult its
164164
documentation for more details.
165165

166166
If not, there are a number of places where we can get help. The easiest is
167-
[the #rust IRC channel on irc.mozilla.org][irc], which we can access through
168-
[Mibbit][mibbit]. Click that link, and we'll be chatting with other Rustaceans
169-
(a silly nickname we call ourselves) who can help us out. Other great resources
170-
include [the user’s forum][users], and [Stack Overflow][stackoverflow].
167+
[the #rust-beginners IRC channel on irc.mozilla.org][irc-beginners] and for
168+
general discussion [the #rust IRC channel on irc.mozilla.org][irc], which we
169+
can access through [Mibbit][mibbit]. Then we'll be chatting with other
170+
Rustaceans (a silly nickname we call ourselves) who can help us out. Other great
171+
resources include [the user’s forum][users] and [Stack Overflow][stackoverflow].
171172

173+
[irc-beginners]: irc://irc.mozilla.org/#rust-beginners
172174
[irc]: irc://irc.mozilla.org/#rust
173-
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
175+
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-beginners,%23rust
174176
[users]: https://users.rust-lang.org/
175177
[stackoverflow]: http://stackoverflow.com/questions/tagged/rust
176178

branches/beta/src/doc/nomicon/vec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
To bring everything together, we're going to write `std::Vec` from scratch.
44
Because all the best tools for writing unsafe code are unstable, this
5-
project will only work on nightly (as of Rust 1.2.0). With the exception of the
5+
project will only work on nightly (as of Rust 1.9.0). With the exception of the
66
allocator API, much of the unstable code we'll use is expected to be stabilized
77
in a similar form as it is today.
88

branches/beta/src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#![feature(placement_new_protocol)]
4949
#![feature(shared)]
5050
#![feature(slice_patterns)]
51+
#![feature(specialization)]
5152
#![feature(staged_api)]
5253
#![feature(step_by)]
5354
#![feature(str_char)]

branches/beta/src/libcollections/string.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ pub trait ToString {
17551755
#[stable(feature = "rust1", since = "1.0.0")]
17561756
impl<T: fmt::Display + ?Sized> ToString for T {
17571757
#[inline]
1758-
fn to_string(&self) -> String {
1758+
default fn to_string(&self) -> String {
17591759
use core::fmt::Write;
17601760
let mut buf = String::new();
17611761
let _ = buf.write_fmt(format_args!("{}", self));
@@ -1764,6 +1764,14 @@ impl<T: fmt::Display + ?Sized> ToString for T {
17641764
}
17651765
}
17661766

1767+
#[stable(feature = "str_to_string_specialization", since = "1.9.0")]
1768+
impl ToString for str {
1769+
#[inline]
1770+
fn to_string(&self) -> String {
1771+
String::from(self)
1772+
}
1773+
}
1774+
17671775
#[stable(feature = "rust1", since = "1.0.0")]
17681776
impl AsRef<str> for String {
17691777
#[inline]

branches/beta/src/libcore/cell.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@
147147
use clone::Clone;
148148
use cmp::{PartialEq, Eq};
149149
use default::Default;
150-
use marker::{Copy, Send, Sync, Sized};
151-
use ops::{Deref, DerefMut, Drop, FnOnce};
150+
use marker::{Copy, Send, Sync, Sized, Unsize};
151+
use ops::{Deref, DerefMut, Drop, FnOnce, CoerceUnsized};
152152
use option::Option;
153153
use option::Option::{None, Some};
154154

@@ -216,10 +216,6 @@ impl<T:Copy> Cell<T> {
216216

217217
/// Returns a reference to the underlying `UnsafeCell`.
218218
///
219-
/// # Safety
220-
///
221-
/// This function is `unsafe` because `UnsafeCell`'s field is public.
222-
///
223219
/// # Examples
224220
///
225221
/// ```
@@ -229,11 +225,11 @@ impl<T:Copy> Cell<T> {
229225
///
230226
/// let c = Cell::new(5);
231227
///
232-
/// let uc = unsafe { c.as_unsafe_cell() };
228+
/// let uc = c.as_unsafe_cell();
233229
/// ```
234230
#[inline]
235231
#[unstable(feature = "as_unsafe_cell", issue = "27708")]
236-
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
232+
pub fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
237233
&self.value
238234
}
239235
}
@@ -638,6 +634,9 @@ impl<'b, T: ?Sized> Ref<'b, T> {
638634
}
639635
}
640636

637+
#[unstable(feature = "coerce_unsized", issue = "27732")]
638+
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {}
639+
641640
impl<'b, T: ?Sized> RefMut<'b, T> {
642641
/// Make a new `RefMut` for a component of the borrowed data, e.g. an enum
643642
/// variant.
@@ -770,6 +769,9 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
770769
}
771770
}
772771

772+
#[unstable(feature = "coerce_unsized", issue = "27732")]
773+
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {}
774+
773775
/// The core primitive for interior mutability in Rust.
774776
///
775777
/// `UnsafeCell<T>` is a type that wraps some `T` and indicates unsafe interior operations on the

branches/beta/src/libcore/sync/atomic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ impl AtomicIsize {
695695
unsafe { atomic_compare_exchange(self.v.get(), current, new, success, failure) }
696696
}
697697

698-
/// Stores a value into the `isize if the current value is the same as the `current` value.
698+
/// Stores a value into the `isize` if the current value is the same as the `current` value.
699699
///
700700
/// Unlike `compare_exchange`, this function is allowed to spuriously fail even when the
701701
/// comparison succeeds, which can result in more efficient code on some platforms. The

branches/beta/src/libcoretest/cell.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,23 @@ fn refcell_unsized() {
261261
let comp: &mut [i32] = &mut [4, 2, 5];
262262
assert_eq!(&*cell.borrow(), comp);
263263
}
264+
265+
#[test]
266+
fn refcell_ref_coercion() {
267+
let cell: RefCell<[i32; 3]> = RefCell::new([1, 2, 3]);
268+
{
269+
let mut cellref: RefMut<[i32; 3]> = cell.borrow_mut();
270+
cellref[0] = 4;
271+
let mut coerced: RefMut<[i32]> = cellref;
272+
coerced[2] = 5;
273+
}
274+
{
275+
let comp: &mut [i32] = &mut [4, 2, 5];
276+
let cellref: Ref<[i32; 3]> = cell.borrow();
277+
assert_eq!(&*cellref, comp);
278+
let coerced: Ref<[i32]> = cellref;
279+
assert_eq!(&*coerced, comp);
280+
}
281+
}
282+
283+

branches/beta/src/librustc/diagnostics.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,47 @@ fn main() {
10331033
some_func(5i32); // ok!
10341034
}
10351035
```
1036+
1037+
Or in a generic context, an erroneous code example would look like:
1038+
```compile_fail
1039+
fn some_func<T>(foo: T) {
1040+
println!("{:?}", foo); // error: the trait `core::fmt::Debug` is not
1041+
// implemented for the type `T`
1042+
}
1043+
1044+
fn main() {
1045+
// We now call the method with the i32 type,
1046+
// which *does* implement the Debug trait.
1047+
some_func(5i32);
1048+
}
1049+
```
1050+
1051+
Note that the error here is in the definition of the generic function: Although
1052+
we only call it with a parameter that does implement `Debug`, the compiler
1053+
still rejects the function: It must work with all possible input types. In
1054+
order to make this example compile, we need to restrict the generic type we're
1055+
accepting:
1056+
```
1057+
use std::fmt;
1058+
1059+
// Restrict the input type to types that implement Debug.
1060+
fn some_func<T: fmt::Debug>(foo: T) {
1061+
println!("{:?}", foo);
1062+
}
1063+
1064+
fn main() {
1065+
// Calling the method is still fine, as i32 implements Debug.
1066+
some_func(5i32);
1067+
1068+
// This would fail to compile now:
1069+
// struct WithoutDebug;
1070+
// some_func(WithoutDebug);
1071+
}
1072+
1073+
Rust only looks at the signature of the called function, as such it must
1074+
already specify all requirements that will be used for every type parameter.
1075+
```
1076+
10361077
"##,
10371078

10381079
E0281: r##"

branches/beta/src/librustc/front/map/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,6 @@ impl<'ast> Map<'ast> {
581581
}
582582
}
583583

584-
pub fn get_foreign_vis(&self, id: NodeId) -> Visibility {
585-
let vis = self.expect_foreign_item(id).vis; // read recorded by `expect_foreign_item`
586-
match self.find(self.get_parent(id)) { // read recorded by `find`
587-
Some(NodeItem(i)) => vis.inherit_from(i.vis),
588-
_ => vis
589-
}
590-
}
591-
592584
pub fn expect_item(&self, id: NodeId) -> &'ast Item {
593585
match self.find(id) { // read recorded by `find`
594586
Some(NodeItem(item)) => item,

0 commit comments

Comments
 (0)