Skip to content

Commit 18172d1

Browse files
committedApr 2, 2016
Auto merge of #32666 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests - Successful merges: #32622, #32629, #32640, #32641, #32642, #32645, #32647, #32649, #32652, #32654, #32656 - Failed merges:
2 parents c8b8eb1 + 45c4769 commit 18172d1

File tree

11 files changed

+82
-13
lines changed

11 files changed

+82
-13
lines changed
 

‎README.md

+2-1
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

‎src/doc/book/getting-started.md

+7-5
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

‎src/doc/nomicon/vec.md

+1-1
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

‎src/libcore/cell.rs

+8-2
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

@@ -634,6 +634,9 @@ impl<'b, T: ?Sized> Ref<'b, T> {
634634
}
635635
}
636636

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+
637640
impl<'b, T: ?Sized> RefMut<'b, T> {
638641
/// Make a new `RefMut` for a component of the borrowed data, e.g. an enum
639642
/// variant.
@@ -766,6 +769,9 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
766769
}
767770
}
768771

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+
769775
/// The core primitive for interior mutability in Rust.
770776
///
771777
/// `UnsafeCell<T>` is a type that wraps some `T` and indicates unsafe interior operations on the

‎src/libcore/sync/atomic.rs

+1-1
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

‎src/libcoretest/cell.rs

+20
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+

‎src/librustc/diagnostics.rs

+41
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##"

‎src/librustc_front/hir.rs

-1
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,6 @@ pub struct TypeBinding {
931931
}
932932

933933

934-
// NB PartialEq method appears below.
935934
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
936935
pub struct Ty {
937936
pub id: NodeId,

‎src/librustc_typeck/check/method/suggest.rs

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ use super::probe::Mode;
4141

4242
fn is_fn_ty<'a, 'tcx>(ty: &Ty<'tcx>, fcx: &FnCtxt<'a, 'tcx>, span: Span) -> bool {
4343
let cx = fcx.tcx();
44-
println!("{:?}", ty);
4544
match ty.sty {
4645
// Not all of these (e.g. unsafe fns) implement FnOnce
4746
// so we look for these beforehand

‎src/libstd/sys/unix/ext/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub trait JoinHandleExt {
3030
///
3131
/// This function **transfers ownership** of the underlying pthread_t to
3232
/// the caller. Callers are then the unique owners of the pthread_t and
33-
/// must either detech or join the pthread_t once it's no longer needed.
33+
/// must either detach or join the pthread_t once it's no longer needed.
3434
fn into_pthread_t(self) -> RawPthread;
3535
}
3636

‎src/snapshots.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ S 2016-03-18 235d774
66
winnt-i386 7703869608cc4192b8f1943e51b19ba1a03c0110
77
winnt-x86_64 8512b5ecc0c53a2cd3552e4f5688577de95cd978
88
openbsd-x86_64 c5b6feda38138a12cd5c05574b585dadebbb5e87
9+
freebsd-x86_64 390b9a9f60f3d0d6a52c04d939a0355f572d03b3
910

1011
S 2016-02-17 4d3eebf
1112
linux-i386 5f194aa7628c0703f0fd48adc4ec7f3cc64b98c7

0 commit comments

Comments
 (0)
Please sign in to comment.