Skip to content

Commit cae6441

Browse files
committed
---
yaml --- r: 272202 b: refs/heads/auto c: 45c4769 h: refs/heads/master
1 parent 5d295c7 commit cae6441

File tree

35 files changed

+437
-601
lines changed

35 files changed

+437
-601
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 0872cc37bccd3573f0e6118e7e792f943ce2a432
11+
refs/heads/auto: 45c4769920caf7e8099dcf0c9533b071e8dbbda8
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/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/auto/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/auto/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/auto/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/auto/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/auto/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/auto/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/auto/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/auto/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/auto/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)