Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #32666

Merged
merged 21 commits into from
Apr 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d93fb02
Update Rust version in the Rustonomicon Vec chapter
mbrubeck Mar 30, 2016
0b0af58
Register new FreeBSD snapshot
asomers Mar 30, 2016
5428e6e
Remove accidental `println!`
jseyfried Mar 31, 2016
823f239
Book: in beginner guide change irc channel #rust → #rust-beginners
tyoc213 Mar 30, 2016
90d7440
Misspelled beginners in one place
tyoc213 Mar 30, 2016
c233f2e
Adding #rust-beginners to README and pointing the two channels on get…
tyoc213 Mar 31, 2016
9094935
Using only one Mibbit link for access the two channels
tyoc213 Mar 31, 2016
10caca2
Improve E0277 error message in a generic context
tbu- Mar 31, 2016
e72c8fb
Fix formatting in the documentation for AtomicIsize::compare_exchange…
Amanieu Mar 31, 2016
33db2d6
added missing refcell ref/refmut coercions to unsized
VFLashM Mar 31, 2016
28e45bb
Fix a typo in the doc comment of `std::os::unix::thread::JoinHandleExt`
tbu- Mar 31, 2016
0872cc3
Remove incorrect comment about `PartialEq` implementation
tbu- Mar 31, 2016
d7429f1
Rollup merge of #32622 - tyoc213:rust-beginners, r=alexcrichton
Manishearth Apr 1, 2016
70ae2a1
Rollup merge of #32629 - mbrubeck:nomicon-version, r=steveklabnik
Manishearth Apr 1, 2016
d611cc0
Rollup merge of #32640 - jseyfried:remove_println, r=Manishearth
Manishearth Apr 1, 2016
a72568e
Rollup merge of #32641 - tbu-:pr_e0277, r=pnkfelix
Manishearth Apr 1, 2016
c2fe137
Rollup merge of #32642 - Amanieu:doc_fixes, r=apasel422
Manishearth Apr 1, 2016
e004ce1
Rollup merge of #32645 - asomers:master, r=alexcrichton
Manishearth Apr 1, 2016
cf0a01a
Rollup merge of #32652 - VFLashM:refcell_ref_coercion, r=alexcrichton
Manishearth Apr 1, 2016
55dbffe
Rollup merge of #32654 - tbu-:pr_doc_joinhandleext, r=sfackler
Manishearth Apr 1, 2016
45c4769
Rollup merge of #32656 - tbu-:pr_ty_outdated_comment, r=alexcrichton
Manishearth Apr 1, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
Rust has an [IRC] culture and most real-time collaboration happens in a
variety of channels on Mozilla's IRC network, irc.mozilla.org. The
most popular channel is [#rust], a venue for general discussion about
Rust, and a good place to ask for help.
Rust. And a good place to ask for help would be [#rust-beginners].

[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
[#rust]: irc://irc.mozilla.org/rust
[#rust-beginners]: irc://irc.mozilla.org/rust-beginners

## License

Expand Down
12 changes: 7 additions & 5 deletions src/doc/book/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,15 @@ installed. Doing so will depend on your specific system, consult its
documentation for more details.

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/doc/nomicon/vec.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

Expand Down
10 changes: 8 additions & 2 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@
use clone::Clone;
use cmp::{PartialEq, Eq};
use default::Default;
use marker::{Copy, Send, Sync, Sized};
use ops::{Deref, DerefMut, Drop, FnOnce};
use marker::{Copy, Send, Sync, Sized, Unsize};
use ops::{Deref, DerefMut, Drop, FnOnce, CoerceUnsized};
use option::Option;
use option::Option::{None, Some};

Expand Down Expand Up @@ -634,6 +634,9 @@ impl<'b, T: ?Sized> Ref<'b, T> {
}
}

#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {}

impl<'b, T: ?Sized> RefMut<'b, T> {
/// Make a new `RefMut` for a component of the borrowed data, e.g. an enum
/// variant.
Expand Down Expand Up @@ -766,6 +769,9 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
}
}

#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {}

/// The core primitive for interior mutability in Rust.
///
/// `UnsafeCell<T>` is a type that wraps some `T` and indicates unsafe interior operations on the
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ impl AtomicIsize {
unsafe { atomic_compare_exchange(self.v.get(), current, new, success, failure) }
}

/// Stores a value into the `isize if the current value is the same as the `current` value.
/// Stores a value into the `isize` if the current value is the same as the `current` value.
///
/// Unlike `compare_exchange`, this function is allowed to spuriously fail even when the
/// comparison succeeds, which can result in more efficient code on some platforms. The
Expand Down
20 changes: 20 additions & 0 deletions src/libcoretest/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,23 @@ fn refcell_unsized() {
let comp: &mut [i32] = &mut [4, 2, 5];
assert_eq!(&*cell.borrow(), comp);
}

#[test]
fn refcell_ref_coercion() {
let cell: RefCell<[i32; 3]> = RefCell::new([1, 2, 3]);
{
let mut cellref: RefMut<[i32; 3]> = cell.borrow_mut();
cellref[0] = 4;
let mut coerced: RefMut<[i32]> = cellref;
coerced[2] = 5;
}
{
let comp: &mut [i32] = &mut [4, 2, 5];
let cellref: Ref<[i32; 3]> = cell.borrow();
assert_eq!(&*cellref, comp);
let coerced: Ref<[i32]> = cellref;
assert_eq!(&*coerced, comp);
}
}


41 changes: 41 additions & 0 deletions src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,47 @@ fn main() {
some_func(5i32); // ok!
}
```

Or in a generic context, an erroneous code example would look like:
```compile_fail
fn some_func<T>(foo: T) {
println!("{:?}", foo); // error: the trait `core::fmt::Debug` is not
// implemented for the type `T`
}

fn main() {
// We now call the method with the i32 type,
// which *does* implement the Debug trait.
some_func(5i32);
}
```

Note that the error here is in the definition of the generic function: Although
we only call it with a parameter that does implement `Debug`, the compiler
still rejects the function: It must work with all possible input types. In
order to make this example compile, we need to restrict the generic type we're
accepting:
```
use std::fmt;

// Restrict the input type to types that implement Debug.
fn some_func<T: fmt::Debug>(foo: T) {
println!("{:?}", foo);
}

fn main() {
// Calling the method is still fine, as i32 implements Debug.
some_func(5i32);

// This would fail to compile now:
// struct WithoutDebug;
// some_func(WithoutDebug);
}

Rust only looks at the signature of the called function, as such it must
already specify all requirements that will be used for every type parameter.
```

"##,

E0281: r##"
Expand Down
1 change: 0 additions & 1 deletion src/librustc_front/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,6 @@ pub struct TypeBinding {
}


// NB PartialEq method appears below.
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
pub struct Ty {
pub id: NodeId,
Expand Down
1 change: 0 additions & 1 deletion src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ use super::probe::Mode;

fn is_fn_ty<'a, 'tcx>(ty: &Ty<'tcx>, fcx: &FnCtxt<'a, 'tcx>, span: Span) -> bool {
let cx = fcx.tcx();
println!("{:?}", ty);
match ty.sty {
// Not all of these (e.g. unsafe fns) implement FnOnce
// so we look for these beforehand
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/unix/ext/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub trait JoinHandleExt {
///
/// This function **transfers ownership** of the underlying pthread_t to
/// the caller. Callers are then the unique owners of the pthread_t and
/// must either detech or join the pthread_t once it's no longer needed.
/// must either detach or join the pthread_t once it's no longer needed.
fn into_pthread_t(self) -> RawPthread;
}

Expand Down
1 change: 1 addition & 0 deletions src/snapshots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ S 2016-03-18 235d774
winnt-i386 7703869608cc4192b8f1943e51b19ba1a03c0110
winnt-x86_64 8512b5ecc0c53a2cd3552e4f5688577de95cd978
openbsd-x86_64 c5b6feda38138a12cd5c05574b585dadebbb5e87
freebsd-x86_64 390b9a9f60f3d0d6a52c04d939a0355f572d03b3

S 2016-02-17 4d3eebf
linux-i386 5f194aa7628c0703f0fd48adc4ec7f3cc64b98c7
Expand Down