Skip to content

Rollup of 5 pull requests #25129

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 87 commits into from
May 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
c76d66e
Generalize dropck to ignore item-less traits.
pnkfelix Apr 27, 2015
db88e5a
dropck: Rejectways trait bounds can indirectly access borrowed data.
pnkfelix Apr 28, 2015
f40d9d9
Regression tests for #24805.
pnkfelix Apr 27, 2015
57d8289
Make `UnsafeCell`, `RefCell`, `Mutex`, and `RwLock` accept DSTs
ftxqxd Apr 23, 2015
e32dab7
test: Ignore out-of-stack for MUSL
alexcrichton May 2, 2015
5d8431c
Override Iterator::count method in vec::IntoIter
sinkuu May 2, 2015
3eee2b9
=BG= minor: add link to book source files
bguiz May 2, 2015
d0e5948
Add regression test for #14565
jooert May 2, 2015
846b368
Add regression test for #12511
jooert May 2, 2015
3878f4d
Add regression test for #17170
jooert May 2, 2015
2595b1e
Add regression test for #17959
jooert May 2, 2015
2cf4791
Add regression test for #18943
jooert May 2, 2015
c81d8f9
Add regression test for #19109
jooert May 2, 2015
2193857
Add regression test for #19163
jooert May 2, 2015
42123b7
Add regression test for #19380
jooert May 2, 2015
6b465f5
TRPL: associated constants
steveklabnik Apr 30, 2015
f86da3d
doc: improve IpAddr is_global and is_unicast_global
tshepang May 2, 2015
715605f
librustc_trans: Handle DST structs in trans::_match.
luqmana May 2, 2015
91ea0c4
Add #[inline(always)] to str::from_utf8_unchecked
koute May 3, 2015
75a3e29
=BG= minor: File::open --> File::create in rust book
bguiz May 3, 2015
f4176b5
Restore HashMap performance by allowing some functions to be inlined
dotdash May 3, 2015
35149bf
Clean up HashMap examples
killercup May 3, 2015
6814c2f
HashSet Docs: Split First Paragraph
killercup May 3, 2015
1283044
Clean up HashSet Examples
killercup May 3, 2015
1a60dc4
Auto merge of #24737 - P1start:dst-cell, r=alexcrichton
bors May 3, 2015
3a4a1e5
Implement Debug for std::net::{UdpSocket,TcpStream,TcpListener,Shutdown}
May 3, 2015
6b3d66b
Auto merge of #25060 - luqmana:matching-dst-struct, r=huonw
bors May 3, 2015
5ad6edb
Fix Derive Notice for HashMap
killercup May 3, 2015
2ac380a
Fix Derive Notice for HashSet
killercup May 3, 2015
796be61
Auto merge of #25070 - dotdash:inline_hash, r=alexcrichton
bors May 3, 2015
92d49cf
Remove unused extract_grammar.py
carols10cents May 3, 2015
7826711
Clean up the grammar around the inline attribute
shepmaster May 3, 2015
dd85c42
Unwrap address values in Debug implementations for TcpStream/TcpListe…
May 3, 2015
91f9dd4
Change 'inner' field name to 'fd'/'socket' on Unix/Windows in Debug i…
May 3, 2015
77ce30f
Auto merge of #24990 - steveklabnik:doc_associated_constants, r=alexc…
bors May 3, 2015
ce1150b
Auto merge of #25043 - alexcrichton:musl-out-of-stack, r=nikomatsakis
bors May 4, 2015
987eb28
Add tests for 3 Debug implementations
May 4, 2015
285ab02
Add functions to convert IPv4 to long and back
Apr 21, 2015
45b9a34
Auto merge of #25044 - tshepang:doc-addr, r=alexcrichton
bors May 4, 2015
6517a0e
Auto merge of #25047 - sinkuu:vec_intoiter_override, r=alexcrichton
bors May 4, 2015
51463c3
Improve std::vec module documentation.
May 4, 2015
1ea9e8d
Auto merge of #25067 - koute:master, r=alexcrichton
bors May 4, 2015
c62c908
Correct pretty-printing of `type Foo<T> where T: Bound = ...;`
pnkfelix May 4, 2015
165a8de
Auto merge of #25055 - bguiz:patch-2, r=steveklabnik
bors May 4, 2015
4b46546
Make `BitVec::process` faster (branch free).
huonw May 4, 2015
c4d8102
Add regression test for #22471
jooert Apr 30, 2015
a979efc
Auto merge of #25082 - shepmaster:inline-docs, r=steveklabnik
bors May 4, 2015
86de427
Fix incorrect link in Option documentation.
WI-Lee May 4, 2015
70db766
Auto merge of #25078 - nham:std_net_impl_debug, r=alexcrichton
bors May 4, 2015
464069a
Fix spelling errors in documentation.
jbcrail May 4, 2015
e7d052e
Remove several FIXMEs
jooert May 2, 2015
9b1dd4b
std: Fix {atime,mtime,ctime}_nsec accessors
alexcrichton May 3, 2015
700cff5
std: Join threads in select! doctest
alexcrichton May 4, 2015
9b481f8
Auto merge of #25056 - jooert:sometests, r=alexcrichton
bors May 4, 2015
e6c23bb
rustc_trans: Fix another windows verbatim path
alexcrichton May 4, 2015
2de6515
doc: rustup.sh doesn't require sudo
brson Apr 30, 2015
f49a984
Auto merge of #25103 - alexcrichton:issue-25072, r=brson
bors May 4, 2015
9305558
doc: fix markup
tshepang May 4, 2015
b630cd7
Strings and vectors are not built-in types.
Stebalien May 4, 2015
2c04696
doc: Cargo documentation doesn't have https
alexcrichton May 4, 2015
4356220
Auto merge of #24652 - achanda:ip-long, r=alexcrichton
bors May 4, 2015
0be117e
Auto merge of #25095 - huonw:faster-bitvec, r=alexcrichton
bors May 5, 2015
b8fedad
Rollup merge of #25068 - bguiz:patch-3, r=steveklabnik
Manishearth May 5, 2015
a374b90
Rollup merge of #25074 - killercup:patch-10, r=alexcrichton
Manishearth May 5, 2015
6bb4998
Rollup merge of #25079 - alexcrichton:fix-nsec, r=aturon
Manishearth May 5, 2015
7413052
Rollup merge of #25081 - carols10cents:remove-extract-grammar, r=stev…
Manishearth May 5, 2015
86a858a
Rollup merge of #25087 - nham:improve_vec_docs, r=Gankro
Manishearth May 5, 2015
9f50d62
Rollup merge of #25092 - pnkfelix:fix-pprint-of-type-items-with-where…
Manishearth May 5, 2015
4fb2216
Rollup merge of #25099 - Eljay:master, r=steveklabnik
Manishearth May 5, 2015
266d482
Rollup merge of #25100 - jbcrail:fix-spelling-errors, r=steveklabnik
Manishearth May 5, 2015
aff0782
Rollup merge of #25104 - brson:rustup, r=alexcrichton
Manishearth May 5, 2015
60f01b4
Rollup merge of #25105 - tshepang:doc-addr, r=steveklabnik
Manishearth May 5, 2015
dc15a15
Rollup merge of #25107 - Stebalien:fix-faq, r=steveklabnik
Manishearth May 5, 2015
135502e
Rollup merge of #25109 - alexcrichton:fix-doc-crates-io-link, r=steve…
Manishearth May 5, 2015
0476586
Fix indentation in while-let example
jsyeo May 5, 2015
31e3cb7
Auto merge of #25111 - Manishearth:rollup, r=Manishearth
bors May 5, 2015
c0100ce
Auto merge of #25113 - pnkfelix:dropck-itemless-traits, r=huonw
bors May 5, 2015
68f5c84
Markdown edits for diagnostic errors.
michaelsproul May 5, 2015
58b83e7
Auto merge of #25101 - alexcrichton:fix-flaky-windows-test, r=nikomat…
bors May 5, 2015
6cd7486
Auto merge of #24979 - jooert:test-22471, r=pnkfelix
bors May 5, 2015
ab3cb8c
TRPL: ownership, borrowing, and lifetimes
steveklabnik Apr 24, 2015
2741b94
Indicate code is code-like in diagnostic error message
frewsxcv May 5, 2015
1eae884
Rollup merge of #24782 - steveklabnik:doc_ownership, r=nikomatsakis
steveklabnik May 5, 2015
477cf9c
Rollup merge of #25080 - steveklabnik:guessing_game, r=alexcrichton
steveklabnik May 5, 2015
8aaafea
Rollup merge of #25112 - jsyeo:jsyeo-while-let, r=alexcrichton
steveklabnik May 5, 2015
5b1ddeb
Rollup merge of #25114 - michaelsproul:error-markdown, r=alexcrichton
steveklabnik May 5, 2015
d507c38
Rollup merge of #25127 - frewsxcv:patch-21, r=pnkfelix
steveklabnik May 5, 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 src/doc/complement-lang-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ This does mean that indexed access to a Unicode codepoint inside a `str` value i
* Most "character oriented" operations on text only work under very restricted language assumptions sets such as "ASCII-range codepoints only". Outside ASCII-range, you tend to have to use a complex (non-constant-time) algorithm for determining linguistic-unit (glyph, word, paragraph) boundaries anyways. We recommend using an "honest" linguistically-aware, Unicode-approved algorithm.
* The `char` type is UCS4. If you honestly need to do a codepoint-at-a-time algorithm, it's trivial to write a `type wstr = [char]`, and unpack a `str` into it in a single pass, then work with the `wstr`. In other words: the fact that the language is not "decoding to UCS4 by default" shouldn't stop you from decoding (or re-encoding any other way) if you need to work with that encoding.

## Why are strings, vectors etc. built-in types rather than (say) special kinds of trait/impl?
## Why are `str`s, slices, arrays etc. built-in types rather than (say) special kinds of trait/impl?

In each case there is one or more operator, literal constructor, overloaded use or integration with a built-in control structure that makes us think it would be awkward to phrase the type in terms of more-general type constructors. Same as, say, with numbers! But this is partly an aesthetic call, and we'd be willing to look at a worked-out proposal for eliminating or rephrasing these special cases.

Expand Down
12 changes: 6 additions & 6 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2044,21 +2044,21 @@ A complete list of the built-in language items will be added in the future.

### Inline attributes

The inline attribute is used to suggest to the compiler to perform an inline
expansion and place a copy of the function or static in the caller rather than
generating code to call the function or access the static where it is defined.
The inline attribute suggests that the compiler should place a copy of
the function or static in the caller, rather than generating code to
call the function or access the static where it is defined.

The compiler automatically inlines functions based on internal heuristics.
Incorrectly inlining functions can actually making the program slower, so it
Incorrectly inlining functions can actually make the program slower, so it
should be used with care.

Immutable statics are always considered inlineable unless marked with
`#[inline(never)]`. It is undefined whether two different inlineable statics
have the same memory address. In other words, the compiler is free to collapse
duplicate inlineable statics together.

`#[inline]` and `#[inline(always)]` always causes the function to be serialized
into crate metadata to allow cross-crate inlining.
`#[inline]` and `#[inline(always)]` always cause the function to be serialized
into the crate metadata to allow cross-crate inlining.

There are three different types of inline attributes:

Expand Down
5 changes: 5 additions & 0 deletions src/doc/trpl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ want to dive in with a project, or ‘Syntax and Semantics’ if you prefer to
start small, and learn a single concept thoroughly before moving onto the next.
Copious cross-linking connects these parts together.

### Contributing

The source files from which this book is generated can be found on Github:
[github.com/rust-lang/rust/tree/master/src/doc/trpl](https://github.com/rust-lang/rust/tree/master/src/doc/trpl)

## A brief introduction to Rust

Is Rust a language you might be interested in? Let’s examine a few small code
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* [References and Borrowing](references-and-borrowing.md)
* [Lifetimes](lifetimes.md)
* [Mutability](mutability.md)
* [Move semantics](move-semantics.md)
* [Enums](enums.md)
* [Match](match.md)
* [Structs](structs.md)
Expand Down Expand Up @@ -65,5 +64,6 @@
* [Benchmark Tests](benchmark-tests.md)
* [Box Syntax and Patterns](box-syntax-and-patterns.md)
* [Slice Patterns](slice-patterns.md)
* [Associated Constants](associated-constants.md)
* [Glossary](glossary.md)
* [Academic Research](academic-research.md)
79 changes: 79 additions & 0 deletions src/doc/trpl/associated-constants.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
% Associated Constants

With the `associated_consts` feature, you can define constants like this:

```rust
#![feature(associated_consts)]

trait Foo {
const ID: i32;
}

impl Foo for i32 {
const ID: i32 = 1;
}

fn main() {
assert_eq!(1, i32::ID);
}
```

Any implementor of `Foo` will have to define `ID`. Without the definition:

```rust,ignore
#![feature(associated_consts)]

trait Foo {
const ID: i32;
}

impl Foo for i32 {
}
```

gives

```text
error: not all trait items implemented, missing: `ID` [E0046]
impl Foo for i32 {
}
```

A default value can be implemented as well:

```rust
#![feature(associated_consts)]

trait Foo {
const ID: i32 = 1;
}

impl Foo for i32 {
}

impl Foo for i64 {
const ID: i32 = 5;
}

fn main() {
assert_eq!(1, i32::ID);
assert_eq!(5, i64::ID);
}
```

As you can see, when implementing `Foo`, you can leave it unimplemented, as
with `i32`. It will then use the default value. But, as in `i64`, we can also
add our own definition.

Associated constants don’t have to be associated with a trait. An `impl` block
for a `struct` works fine too:

```rust
#![feature(associated_consts)]

struct Foo;

impl Foo {
pub const FOO: u32 = 3;
}
```
4 changes: 2 additions & 2 deletions src/doc/trpl/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct Info {
}

fn write_info(info: &Info) -> io::Result<()> {
let mut file = File::open("my_best_friends.txt").unwrap();
let mut file = File::create("my_best_friends.txt").unwrap();

if let Err(e) = writeln!(&mut file, "name: {}", info.name) {
return Err(e)
Expand Down Expand Up @@ -282,7 +282,7 @@ struct Info {
}

fn write_info(info: &Info) -> io::Result<()> {
let mut file = try!(File::open("my_best_friends.txt"));
let mut file = try!(File::create("my_best_friends.txt"));

try!(writeln!(&mut file, "name: {}", info.name));
try!(writeln!(&mut file, "age: {}", info.age));
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/hello-cargo.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ projects. Cargo is currently in a pre-1.0 state, and so it is still a work in
progress. However, it is already good enough to use for many Rust projects, and
so it is assumed that Rust projects will use Cargo from the beginning.

[cratesio]: https://doc.crates.io
[cratesio]: http://doc.crates.io

Cargo manages three things: building your code, downloading the dependencies
your code needs, and building those dependencies. At first, your
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/if-let.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ loop as long as a value matches a certain pattern. It turns code like this:
loop {
match option {
Some(x) => println!("{}", x),
_ => break,
_ => break,
}
}
```
Expand Down
12 changes: 5 additions & 7 deletions src/doc/trpl/installing-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ or a Mac, all you need to do is this (note that you don't need to type in the
`$`s, they just indicate the start of each command):

```bash
$ curl -sf -L https://static.rust-lang.org/rustup.sh | sudo sh
$ curl -sf -L https://static.rust-lang.org/rustup.sh | sh
```

If you're concerned about the [potential insecurity][insecurity] of using `curl
| sudo sh`, please keep reading and see our disclaimer below. And feel free to
| sh`, please keep reading and see our disclaimer below. And feel free to
use a two-step version of the installation and examine our installation script:

```bash
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
$ sudo sh rustup.sh
$ sh rustup.sh
```

[insecurity]: http://curlpipesh.tumblr.com
Expand All @@ -40,13 +40,11 @@ If you used the Windows installer, just re-run the `.msi` and it will give you
an uninstall option.

Some people, and somewhat rightfully so, get very upset when we tell you to
`curl | sudo sh`. Basically, when you do this, you are trusting that the good
`curl | sh`. Basically, when you do this, you are trusting that the good
people who maintain Rust aren't going to hack your computer and do bad things.
That's a good instinct! If you're one of those people, please check out the
documentation on [building Rust from Source][from source], or [the official
binary downloads][install page]. And we promise that this method will not be
the way to install Rust forever: it's just the easiest way to keep people
updated while Rust is in its alpha state.
binary downloads][install page].

[from source]: https://github.com/rust-lang/rust#building-from-source
[install page]: http://www.rust-lang.org/install.html
Expand Down
Loading