Commit Graph

56604 Commits

Author SHA1 Message Date
Matthew Piziak
ff3a761f79 add more-evocative examples for Shl and Shr
r? @steveklabnik

add examples that lift `<<` and `>>` to a trivial struct

replace `Scalar` structs with struct tuples

add `fn main` wrappers to enable Rust Playground "Run" button
2016-08-23 17:32:42 -04:00
Guillaume Gomez
16d459f292 Rollup merge of #35949 - tshepang:excess, r=GuillaumeGomez
doc: one line too many
2016-08-23 22:48:03 +02:00
Guillaume Gomez
142dc491e5 Rollup merge of #35939 - creativcoder:e0195, r=jonathandturner
Update E0195 to new error format

Fixes #35511
Part of #35233

r? @jonathandturner
2016-08-23 22:48:03 +02:00
Guillaume Gomez
ed4c0fd01d Rollup merge of #35936 - matthew-piziak:div-rational-example, r=GuillaumeGomez
replace `Div` example with something more evocative of division

Analogous to PR #35860.

r? @GuillaumeGomez
2016-08-23 22:48:03 +02:00
Guillaume Gomez
e3e439019f Rollup merge of #35913 - frewsxcv:panic, r=steveklabnik
Mark panicking tests as `should_panic` instead of `no_run`.

None
2016-08-23 22:48:02 +02:00
Guillaume Gomez
21d4ec9120 Rollup merge of #35912 - brson:rust-installer, r=alexcrichton
Update rust-installer. Fixes #35840

cc @Diggsey
2016-08-23 22:48:02 +02:00
Guillaume Gomez
bc940193c8 Rollup merge of #35910 - tbu-:pr_weird_linebreak, r=alexcrichton
Change a weird line break in `core::str`
2016-08-23 22:48:02 +02:00
Tshepang Lekhonkhobe
59723c3c20 doc: one line too many 2016-08-23 22:31:44 +02:00
Tshepang Lekhonkhobe
ab4c492d68 reference: add trailing commas 2016-08-23 22:25:40 +02:00
Simon Sapin
46226a7a6e Yield Err in char::decode_utf8 per Unicode, like String::from_utf8_lossy 2016-08-23 22:09:59 +02:00
Simon Sapin
892bf3d41d Use a macro in test_decode_utf8 to preserve line numbers in panic messages. 2016-08-23 22:07:48 +02:00
Andre Bogus
e0eb1ba0db fixed and extended tests, however...
...there is still one confusing thing – see the _BAZ functions, which
appear to be elided in the `compile-fail` test and defaulted in the
´run-pass` test (if you uncomment line 73).
2016-08-23 21:38:57 +02:00
bors
012f45eaf7 Auto merge of #35854 - nikomatsakis:incr-comp-cache-hash-35549, r=mw
compute and cache HIR hashes at beginning

This avoids the compile-time overhead of computing them twice.  It also fixes
an issue where the hash computed after typeck is differen than the hash before,
because typeck mutates the def-map in place.

Fixes #35549.
Fixes #35593.

Some performance measurements suggest this `HashesMap` is very small in memory (unobservable via `-Z time-passes`) and very cheap to construct. I do see some (very minor) performance wins in the incremental case after the first run -- the first run costs more because loading the dep-graph didn't have any hashing to do in that case. Example timings from two runs  of `libsyntex-syntax` -- the (1) indicates first run, (2) indicates second run, and (*) indicates both together:

| Phase | Master | Branch |
| ---- | ---- | ---- |
| compute_hashes_map (1) | N/A | 0.343 |
| load_dep_graph (1) | 0 | 0 |
| serialize dep graph (1) | 4.190 | 3.920 |
| total (1) | 4.190 | 4.260 |
| compute_hashes_map (2) | N/A | 0.344 |
| load_dep_graph (2) | 0.592 | 0.252 |
| serialize dep graph (2) | 4.119 | 3.779 |
| total (2) | 4.71 | 4.375 |
| total (*) | 8.9 | 8.635 |

r? @michaelwoerister
2016-08-23 11:53:17 -07:00
Niko Matsakis
1cc7c9010c fix stray comment 2016-08-23 13:29:28 -04:00
Niko Matsakis
c21fa64dbb pacify the mercilous tidy 2016-08-23 13:28:55 -04:00
Alex Burka
702ea7169c typeck: use NoExpectation to check return type of diverging fn
This fixes #35849, a regression introduced by the typeck refactoring
around TyNever/!.
2016-08-23 16:58:49 +00:00
Rahul Sharma
5ec6f39a65 Update E0195 to new error format 2016-08-23 22:07:27 +05:30
Matthew Piziak
2cad78d5eb replace Div example with something more evocative of division
Analogous to PR #35860.

r? @GuillaumeGomez
2016-08-23 12:09:06 -04:00
Niko Matsakis
ea2d90e903 consider DepNode::Krate to be an input
This seems not only more correct but allows us to write tests that check
whether the krate hash as a whole is clean/dirty
2016-08-23 11:57:27 -04:00
Matthew Piziak
67b9cd3fe1 improve documentation for Fn* traits
I can think of a few things we may want to accomplish with the documentation of the `Fn`, `FnMut`, and `FnOnce` traits:
- the relationship between these traits and the closures that implement them
- examples of non-closure implementations
- the relationship between these traits and Rust's ownership semantics

add module-level documentation for `Fn*` traits

Describe how `Fn*` traits, closure types, and ownership semantics are
linked, and provide examples of higher-level functions that take `Fn*`s.

more examples for `Fn*` traits

create correct (though not yet elegant) examples for `FnMut` and `FnOnce`

add trait links to module-level documentation

third time's a charm!

argument -> capture for trait documentation

This wording will need to be supported with better examples for
capturing eventually.

correct `FnOnce` example

I also fixed some of the trait wording here to make the concept of
capturing clearer; though that still needs more work.

replace `x + x` with `x * 2` for `fn double`
2016-08-23 11:05:24 -04:00
Steven Allen
c7d5f7e5e6 Rust has type aliases, not typedefs.
They're the same thing but it's better to keep the terminology consistent.
2016-08-23 10:49:11 -04:00
bors
0bd99f9d5c Auto merge of #35656 - Stebalien:fused, r=alexcrichton
Implement 1581 (FusedIterator)

* [ ] Implement on patterns. See https://github.com/rust-lang/rust/issues/27721#issuecomment-239638642.
* [ ] Handle OS Iterators. A bunch of iterators (`Args`, `Env`, etc.) in libstd wrap platform specific iterators. The current ones all appear to be well-behaved but can we assume that future ones will be?
* [ ] Does someone want to audit this? On first glance, all of the iterators on which I implemented `FusedIterator` appear to be well-behaved but there are a *lot* of them so a second pair of eyes would be nice.
* I haven't touched rustc internal iterators (or the internal rand) because rustc doesn't actually call `fuse()`.
* `FusedIterator` can't be implemented on `std::io::{Bytes, Chars}`.

Closes: #35602 (Tracking Issue)
Implements: rust-lang/rfcs#1581
2016-08-23 07:46:52 -07:00
Niko Matsakis
c42e0a3451 make svh independent of item ordering 2016-08-23 10:42:46 -04:00
Niko Matsakis
f923083308 cache def-path hashes across all items
This seems like approx a 2x win on syntex_syntax.
2016-08-23 10:33:56 -04:00
Niko Matsakis
484da37845 rename HashesMap to IncrementalHashesMap 2016-08-23 07:47:14 -04:00
Niko Matsakis
226e1e5ded add regression test for #35593
Fixes #35593
2016-08-23 07:40:53 -04:00
bors
43204fff5d Auto merge of #35627 - apasel422:coerce-cell, r=alexcrichton
Implement `CoerceUnsized` for `{Cell, RefCell, UnsafeCell}`

These impls are analogous to the one for `NonZero`. It's occasionally useful to be able to coerce the cell types when they're being used inside another abstraction. See Manishearth/rust-gc#17 for an example.

r? @eddyb
2016-08-23 04:16:28 -07:00
Andre Bogus
a6b9fea5cd fixed compile-fail test 2016-08-23 12:38:09 +02:00
Andre Bogus
8bdb3e10ca fix run-pass test 2016-08-23 12:34:28 +02:00
James Miller
72d629caa5 Improve error message when failing to parse a block
We want to catch this error:

```
if (foo)
    bar;
```

as it's valid syntax in other languages, and say how to fix it.
Unfortunately it didn't care if the suggestion made sense and just
highlighted the unexpected token.

Now it attempts to parse a statement, and if it succeeds, it shows the
help message.

Fixes #35907
2016-08-23 18:23:31 +12:00
Eduard Burtescu
6b95606a13 rustc_trans: do not generate allocas for unused locals. 2016-08-23 09:07:23 +03:00
Andre Bogus
cfce351ad3 first attempt at implementing RFC 1623. This fixes #35897.
This is a work in progress. In particular, I want to add more tests,
especially the compile-fail test is very bare-bones.
2016-08-23 07:50:13 +02:00
bors
599f1b96b1 Auto merge of #35766 - brson:bump, r=alexcrichton
Upgrade bootstrap compiler to 1.12

r? @alexcrichton
2016-08-22 20:51:54 -07:00
Corey Farwell
66a2578064 Mark panicking tests as should_panic instead of no_run. 2016-08-22 20:39:20 -04:00
Brian Anderson
f863ea3d16 Update rust-installer. Fixes #35840 2016-08-23 00:38:26 +00:00
Tobias Bucher
5e22e3025c Implement more traits for std::io::ErrorKind
This makes it possible to use it as key in various maps.
2016-08-23 02:10:22 +02:00
Ahmed Charles
f39700514d Update E0389 to the new format. #35630 2016-08-22 17:08:21 -07:00
Tobias Bucher
0f9cb1b97c Change a weird line break in core::str 2016-08-23 02:05:53 +02:00
Brian Anderson
144cc7285f Update cargo bootstrap rev and add fix for cargo#3005 2016-08-23 00:05:33 +00:00
bors
d0da7f6af9 Auto merge of #35908 - jonathandturner:rollup, r=jonathandturner
Rollup of 20 pull requests

- Successful merges: #35360, #35526, #35809, #35817, #35820, #35824, #35835, #35841, #35842, #35858, #35860, #35861, #35864, #35878, #35879, #35881, #35882, #35889, #35891, #35901
- Failed merges: #35395
2016-08-22 16:59:28 -07:00
Ahmed Charles
6961d26729 Fix compiletest so it respects warnings for run-pass. 2016-08-22 16:51:37 -07:00
Jonathan Turner
8ea2936659 Rollup merge of #35901 - terrynsun:configs, r=steveklabnik
Add sublime-rust to CONFIGS.md.

Just noticed it was missing!

r? @steveklabnik
2016-08-22 15:34:23 -07:00
Jonathan Turner
d5deb118f9 Rollup merge of #35891 - munyari:book, r=steveklabnik
Add reference to `Self` in traits chapter (book)

Addresses #31891

"r? @steveklabnik
2016-08-22 15:34:22 -07:00
Jonathan Turner
766b04ec5e Rollup merge of #35889 - alevy:patch-1, r=GuillaumeGomez
Minor type in CONTRIBUTING.md

A single missing article
2016-08-22 15:34:22 -07:00
Jonathan Turner
252f3c5a1a Rollup merge of #35882 - petrochenkov:patch-2, r=eddyb
rustc: Fix outdated comment

cc https://github.com/rust-lang/rust/issues/35870#issuecomment-241282692

r? @eddyb
2016-08-22 15:34:22 -07:00
Jonathan Turner
375695c956 Rollup merge of #35881 - matthew-piziak:rc-would-unwrap-example, r=GuillaumeGomez
add example for `Rc::would_unwrap`

Part of #29372

r? @steveklabnik
2016-08-22 15:34:22 -07:00
Jonathan Turner
b560f5a7bc Rollup merge of #35879 - CryZe:patch-2, r=apasel422
Fix "Furthermore" Typo in String Docs

It used to say "Furtheremore" instead of "Furthermore".
2016-08-22 15:34:22 -07:00
Jonathan Turner
19f30d3f86 Rollup merge of #35878 - matthew-piziak:ptr-assertions, r=GuillaumeGomez
replace `println!` statements with `assert!`ions in `std::ptr` examples

r? @steveklabnik
2016-08-22 15:34:21 -07:00
Jonathan Turner
36b8322a8c Rollup merge of #35864 - matthew-piziak:index-example, r=GuillaumeGomez
replace `Index` example with something more evocative of indexing

r? @steveklabnik
2016-08-22 15:34:21 -07:00
Jonathan Turner
61f62ec595 Rollup merge of #35861 - matthew-piziak:rem-example, r=GuillaumeGomez
replace `Rem` example with something more evocative

r? @steveklabnik
2016-08-22 15:34:21 -07:00