Skip to content

Rollup of leftover PRs in the queue #22548

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

Merged
merged 56 commits into from
Feb 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5ce1b33
Reintroduce box syntax where needed
steveklabnik Feb 13, 2015
cec404a
Add documentation for `else if` to trpl
adamhjk Feb 19, 2015
a6b47c0
Fixes "Code of Conduct" Link
zeroem Feb 19, 2015
e0067f9
docs: correct guessing game to mention old_io module instead of io
stevencrockett Feb 19, 2015
07c0faa
Fix an ICE when translating `if loop {} {}`
dotdash Feb 19, 2015
6172986
typo: fucntion -> function
Ryman Feb 19, 2015
be0dc49
Unsafe lint will also check for other unsafe code
ipetkov Feb 19, 2015
72316c3
fix markup of "just one effect, unsafe"
dckc Feb 20, 2015
082bf7f
unbreak openbsd build after 1860ee52
semarie Feb 20, 2015
42e155e
make span on obsolete syntax very precise
nikomatsakis Feb 20, 2015
888dac9
Fix style fallout from 204e2bd442
nagisa Feb 20, 2015
d99af37
Escape some rustdoc strings
nagisa Feb 20, 2015
46b2c9a
iOS: CStr fallout
vhbit Feb 20, 2015
68e5bb3
Remove remaining uses of `[]`. This time I tried to use deref coercio…
nikomatsakis Feb 20, 2015
fd2fdbd
fix a few 'variable does not need to be mutable' warnings
tshepang Feb 18, 2015
355f355
Add examples for iter::range_step
steveklabnik Feb 20, 2015
838595a
suggestions no longer include private fields for structs outside loca…
Feb 19, 2015
85069e0
added 'suggest-private-fields' cfail test
Feb 19, 2015
3419d51
added local crate struct with priv field to test
Feb 19, 2015
9b67d07
added license header to test
Feb 19, 2015
97aa340
try to reduce bajillion warnings
Gankra Feb 19, 2015
ac7d964
make int/uint modules just re-exports
Gankra Feb 20, 2015
712a687
In the rustc driver, we pass the expanded, not the pre-expansion, AST…
nrc Feb 21, 2015
60dee4b
Fix typo in deprecation msg
caspark Feb 21, 2015
6686f7a
Register new snapshots
alexcrichton Feb 20, 2015
0d218fd
Add test for #22356
edwardw Feb 21, 2015
1b20767
Minor grammar/spelling fixes to the "Static and Dynamic Dispatch" doc
inrustwetrust Feb 21, 2015
a3aaaca
Fix frow_raw/from_raw typo
denisdefreyne Feb 21, 2015
7e533a9
Remove mention of non-existing AtomicOption in docs
wesleywiser Feb 21, 2015
11c70a3
Rollup merge of #22267 - steveklabnik:fix_lie, r=Gankro
Manishearth Feb 21, 2015
2bb8b95
Rollup merge of #22509 - tshepang:not-needed-mut, r=steveklabnik
Manishearth Feb 21, 2015
9d650ae
Rollup merge of #22515 - adamhjk:add-else-if-to-docs, r=steveklabnik
Manishearth Feb 21, 2015
2e0609a
Rollup merge of #22522 - zeroem:patch-1, r=pnkfelix
Manishearth Feb 21, 2015
b7ac60a
Rollup merge of #22524 - stevencrockett:master, r=steveklabnik
Manishearth Feb 21, 2015
f308550
Rollup merge of #22527 - dotdash:if-loop, r=huonw
Manishearth Feb 21, 2015
b7487db
Rollup merge of #22545 - Ryman:fucntion, r=dotdash
Manishearth Feb 21, 2015
2b8160b
Rollup merge of #22562 - dckc:patch-4, r=Aatch
Manishearth Feb 21, 2015
e1c2f77
Rollup merge of #22571 - nagisa:style-fallout, r=alexcrichton
Manishearth Feb 21, 2015
9fd4551
Rollup merge of #22578 - nagisa:deprecated-fallout, r=alexcrichton
Manishearth Feb 21, 2015
c90e854
Rollup merge of #22614 - nick29581:fix-cc-crate, r=alexcrichton
Manishearth Feb 21, 2015
ffe3485
Rollup merge of #22616 - caspark:fix-typo-in-deprecation-msg, r=alexc…
Manishearth Feb 21, 2015
e15d016
Rollup merge of #22620 - edwardw:issue-22356, r=brson
Manishearth Feb 21, 2015
a9570e5
Rollup merge of #22625 - inrustwetrust:dispatch-doc-grammar, r=huonw
Manishearth Feb 21, 2015
b53e510
Rollup merge of #22627 - ddfreyne:patch-1, r=dotdash
Manishearth Feb 21, 2015
dcbf226
Rollup merge of #22633 - wesleywiser:fix_22586, r=sfackler
Manishearth Feb 21, 2015
9fe2d21
Rollup merge of #22634 - shepmaster:std-io-typo, r=Manishearth
Manishearth Feb 21, 2015
98ec45e
Rollup merge of #22542 - ipetkov:unsafe-lint, r=huonw
Manishearth Feb 21, 2015
3e794de
Rollup merge of #22592 - nikomatsakis:deprecate-bracket-bracket, r=at…
Manishearth Feb 21, 2015
a95d7f5
Rollup merge of #22602 - steveklabnik:doc_range_step, r=alexcrichton
Manishearth Feb 21, 2015
494dbe9
Rollup merge of #22516 - leejunseok:nonpub_field_sugg, r=jakub-
Manishearth Feb 21, 2015
59ab2da
Rollup merge of #22567 - Gankro:unstable, r=alexcrichton
Manishearth Feb 21, 2015
d316a34
Fix lint-unsafe-code test from #22542
Manishearth Feb 21, 2015
47e749e
Fix errors from #22592
Manishearth Feb 21, 2015
ba568a0
Rollup merge of #22583 - vhbit:ios-cstr, r=alexcrichton
Manishearth Feb 21, 2015
5d7b216
Rollup merge of #22568 - semarie:openbsd-rfc592, r=huonw
Manishearth Feb 21, 2015
686648d
Rollup merge of #22584 - alexcrichton:snapshots, r=Gankro
Manishearth Feb 21, 2015
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ links to the major sections:
If you have questions, please make a post on [internals.rust-lang.org][internals] or
hop on [#rust-internals][pound-rust-internals].

As a reminder, all contributors are expected to follow our [Code of Conduct](coc).
As a reminder, all contributors are expected to follow our [Code of Conduct][coc].

[pound-rust-internals]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
[internals]: http://internals.rust-lang.org
Expand Down
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Version 1.0.0-alpha.2 (February 2015)
* Abstract [OS-specific string types][osstr], `std::ff::{OsString,
OsStr}`, provide strings in platform-specific encodings for easier
interop with system APIs. [RFC][osstr-rfc].
* The `boxed::into_raw` and `Box::frow_raw` functions [convert
* The `boxed::into_raw` and `Box::from_raw` functions [convert
between `Box<T>` and `*mut T`][boxraw], a common pattern for
creating raw pointers.

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/guessing-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn main() {
```

You've seen this code before, when we talked about standard input. We
import the `std::io` module with `use`, and then our `main` function contains
import the `std::old_io` module with `use`, and then our `main` function contains
our program's logic. We print a little message announcing the game, ask the
user to input a guess, get their input, and then print it out.

Expand Down
14 changes: 14 additions & 0 deletions src/doc/trpl/if.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ if x == 5 {
}
```

If there is more than one case, use an `else if`:

```rust
let x = 5;

if x == 5 {
println!("x is five!");
} else if x == 6 {
println!("x is six!");
} else {
println!("x is not five or six :(");
}
```

This is all pretty standard. However, you can also do this:


Expand Down
9 changes: 7 additions & 2 deletions src/doc/trpl/pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,9 @@ than the hundred `int`s that make up the `BigStruct`.

This is an antipattern in Rust. Instead, write this:

```{rust}
```rust
#![feature(box_syntax)]

struct BigStruct {
one: i32,
two: i32,
Expand All @@ -706,10 +708,13 @@ fn main() {
one_hundred: 100,
});

let y = Box::new(foo(x));
let y = box foo(x);
}
```

Note that this uses the `box_syntax` feature gate, so this syntax may change in
the future.

This gives you flexibility without sacrificing performance.

You may think that this gives us terrible performance: return a value and then
Expand Down
18 changes: 9 additions & 9 deletions src/doc/trpl/static-and-dynamic-dispatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ inlining and hence usually higher performance. It also has some downsides:
causing code bloat due to many copies of the same function existing in the
binary, one for each type.

Furthermore, compilers aren’t perfect and may “optimise” code to become slower.
Furthermore, compilers aren’t perfect and may “optimize” code to become slower.
For example, functions inlined too eagerly will bloat the instruction cache
(cache rules everything around us). This is part of the reason that `#[inline]`
and `#[inline(always)]` should be used carefully, and one reason why using a
Expand All @@ -104,15 +104,15 @@ objects, like `&Foo` or `Box<Foo>`, are normal values that store a value of
known at runtime. The methods of the trait can be called on a trait object via
a special record of function pointers (created and managed by the compiler).

A function that takes a trait object is not specialised to each of the types
A function that takes a trait object is not specialized to each of the types
that implements `Foo`: only one copy is generated, often (but not always)
resulting in less code bloat. However, this comes at the cost of requiring
slower virtual function calls, and effectively inhibiting any chance of
inlining and related optimisations from occurring.

Trait objects are both simple and complicated: their core representation and
layout is quite straight-forward, but there are some curly error messages and
surprising behaviours to discover.
surprising behaviors to discover.

### Obtaining a trait object

Expand Down Expand Up @@ -140,13 +140,13 @@ and casts are identical.

This operation can be seen as "erasing" the compiler's knowledge about the
specific type of the pointer, and hence trait objects are sometimes referred to
"type erasure".
as "type erasure".

### Representation

Let's start simple, with the runtime representation of a trait object. The
`std::raw` module contains structs with layouts that are the same as the
complicated build-in types, [including trait objects][stdraw]:
complicated built-in types, [including trait objects][stdraw]:

```rust
# mod foo {
Expand Down Expand Up @@ -223,14 +223,14 @@ static Foo_for_String_vtable: FooVtable = FooVtable {
The `destructor` field in each vtable points to a function that will clean up
any resources of the vtable's type, for `u8` it is trivial, but for `String` it
will free the memory. This is necessary for owning trait objects like
`Box<Foo>`, which need to clean-up both the `Box` allocation and as well as the
`Box<Foo>`, which need to clean-up both the `Box` allocation as well as the
internal type when they go out of scope. The `size` and `align` fields store
the size of the erased type, and its alignment requirements; these are
essentially unused at the moment since the information is embedded in the
destructor, but will be used in future, as trait objects are progressively made
more flexible.
destructor, but will be used in the future, as trait objects are progressively
made more flexible.

Suppose we've got some values that implement `Foo`, the explicit form of
Suppose we've got some values that implement `Foo`, then the explicit form of
construction and use of `Foo` trait objects might look a bit like (ignoring the
type mismatches: they're all just pointers anyway):

Expand Down
7 changes: 0 additions & 7 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,6 @@ impl<T: Default + Sync + Send> Default for Arc<T> {
fn default() -> Arc<T> { Arc::new(Default::default()) }
}

#[cfg(stage0)]
impl<H: Hasher, T: Hash<H>> Hash<H> for Arc<T> {
fn hash(&self, state: &mut H) {
(**self).hash(state)
}
}
#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Hash> Hash for Arc<T> {
fn hash<H: Hasher>(&self, state: &mut H) {
Expand Down
8 changes: 0 additions & 8 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,6 @@ impl<T: ?Sized + Ord> Ord for Box<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + Eq> Eq for Box<T> {}

#[cfg(stage0)]
impl<S: hash::Hasher, T: ?Sized + Hash<S>> Hash<S> for Box<T> {
#[inline]
fn hash(&self, state: &mut S) {
(**self).hash(state);
}
}
#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + Hash> Hash for Box<T> {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
Expand Down
1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#![feature(unboxed_closures)]
#![feature(unsafe_no_drop_flag)]
#![feature(core)]
#![cfg_attr(test, feature(test, alloc, rustc_private))]
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
feature(libc))]

Expand Down
8 changes: 0 additions & 8 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,6 @@ impl<T: Ord> Ord for Rc<T> {
}

// FIXME (#18248) Make `T` `Sized?`
#[cfg(stage0)]
impl<S: Hasher, T: Hash<S>> Hash<S> for Rc<T> {
#[inline]
fn hash(&self, state: &mut S) {
(**self).hash(state);
}
}
#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Hash> Hash for Rc<T> {
fn hash<H: Hasher>(&self, state: &mut H) {
Expand Down
20 changes: 0 additions & 20 deletions src/libcollections/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,17 +985,6 @@ impl fmt::Debug for BitVec {
}

#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(stage0)]
impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for BitVec {
fn hash(&self, state: &mut S) {
self.nbits.hash(state);
for elem in self.blocks() {
elem.hash(state);
}
}
}
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(stage0))]
impl hash::Hash for BitVec {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.nbits.hash(state);
Expand Down Expand Up @@ -1776,16 +1765,7 @@ impl fmt::Debug for BitSet {
}
}

#[cfg(stage0)]
impl<S: hash::Writer + hash::Hasher> hash::Hash<S> for BitSet {
fn hash(&self, state: &mut S) {
for pos in self {
pos.hash(state);
}
}
}
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(stage0))]
impl hash::Hash for BitSet {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
for pos in self {
Expand Down
10 changes: 0 additions & 10 deletions src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,6 @@ impl<'a, B: ?Sized> fmt::Display for Cow<'a, B> where
}

#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(stage0)]
impl<'a, B: ?Sized, S: Hasher> Hash<S> for Cow<'a, B> where B: Hash<S> + ToOwned
{
#[inline]
fn hash(&self, state: &mut S) {
Hash::hash(&**self, state)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(stage0))]
impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned
{
#[inline]
Expand Down
Loading