Commit Graph

56255 Commits

Author SHA1 Message Date
Jeffrey Seyfried
a9a2979dba Remove needless imports in libcollections. 2016-08-24 22:13:13 +00:00
Jeffrey Seyfried
9a2c8783d9 Use #[prelude_import] in libstd. 2016-08-24 22:12:48 +00:00
Jeffrey Seyfried
e2ad3be178 Use #[prelude_import] in libcore. 2016-08-24 22:12:23 +00:00
bors
e9bc1bac8c Auto merge of #35764 - eddyb:byegone, r=nikomatsakis
Remove the old AST-based backend from rustc_trans.

Starting with Rust 1.13, `--disable-orbit` , `-Z orbit=off` and `#[rustc_no_mir]` have been removed.
Only the new MIR backend is left in the compiler, and only early const_eval uses ASTs from other crates.

Filling drop (previously "zeroing drop"), `#[unsafe_no_drop_flag]` and associated unstable APIs are gone.
Implementing `Drop` doesn't add a flag anymore to the type, all of the dynamic drop is function local.
This is a [breaking-change], please use `Option::None` and/or `mem::forget` if you are unsure about your ability to prevent/control the drop of a value. In the future, `union` will be usable in some such cases.

**NOTE**: DO NOT MERGE before we get the new beta as the stage0, there's some cruft to remove.

All of this will massively simplify any efforts to implement (and as such it blocks) features such as `union`s, safe use of `#[packed]` or new type layout optimizations, not to mention many other experiments.
2016-08-24 14:57:34 -07:00
Ulrik Sverdrup
8295c5056d memrchr: Use a conditional instead of subtracting a complicated min
This makes the critical calculation easier to understand.
2016-08-24 21:41:23 +02:00
Keith Yeung
3d9cf30ddf More robust testing 2016-08-24 11:48:53 -07:00
Keith Yeung
07e6e81e08 Extract error reporting into its own fn 2016-08-24 11:48:48 -07:00
Jonathan Turner
2932db19b5 Rollup merge of #35961 - 0xmohit:pr/error-codes-E0445-E0454, r=GuillaumeGomez
Update E0445 and E0454 to new error format

Fixes #35922.
Fixes #35930.
Part of #35233.

r? @GuillaumeGomez
2016-08-24 10:35:29 -07:00
Jonathan Turner
411a85e271 Rollup merge of #35948 - tshepang:missing-comma, r=steveklabnik
reference: add trailing commas
2016-08-24 10:35:29 -07:00
Jonathan Turner
336841ccf9 Rollup merge of #35920 - GuillaumeGomez:err_codes, r=jonathandturner
Err codes

r? @jonathandturner
2016-08-24 10:35:29 -07:00
Jonathan Turner
95c661aae6 Rollup merge of #35876 - matthew-piziak:sub-examples, r=GuillaumeGomez
more evocative examples for `Sub` and `SubAssign`

These examples are exactly analogous to those in PRs #35709 and #35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in.

Part of #29365.

r? @steveklabnik
2016-08-24 10:35:29 -07:00
bors
03e23c7f9a Auto merge of #35883 - durka:gh35849, r=eddyb
typeck: use NoExpectation to check return type of diverging fn

Fixes #35849.

Thanks @eddyb.
2016-08-24 10:29:12 -07:00
Ulrik Sverdrup
d1ecee96bf memrchr: Correct aligned offset computation
The memrchr fallback did not compute the offset correctly. It was
intentioned to land on usize-aligned addresses but did not.
This was suspected to resulted in a crash on ARMv7 platform!

This bug affected non-linux platforms.

I think like this, if we have a slice with pointer `ptr` and length
`len`, we want to find the last usize-aligned offset in the slice.
The correct computation should be:

For example if ptr = 1 and len = 6, and size_of::<usize>() is 4:

[ x x x x x x ]
  1 2 3 4 5 6
        ^-- last aligned address at offset 3 from the start.

The last aligned address is ptr + len - (ptr + len) % usize_size.

Compute offset from the start as:

offset = len - (ptr + len) % usize_size = 6 - (1 + 6) % 4 = 6 - 3 = 3.

I believe the function's return value was always correct previously, if
the platform supported unaligned addresses.
2016-08-24 19:05:21 +02:00
Mohit Agarwal
11e9b8de7d Update E0445 and E0454 to new error format
Fixes #35922.
Fixes #35930.
Part of #35233.

r? @GuillaumeGomez
2016-08-24 17:43:51 +05:30
Eduard Burtescu
25cf8001b1 Remove AST from metadata except for consts and const fns. 2016-08-24 13:23:38 +03:00
Eduard Burtescu
119508cdb4 Remove drop flags from structs and enums implementing Drop. 2016-08-24 13:23:37 +03:00
Eduard Burtescu
d0654ae5e5 rustc_trans: remove the bulk of old trans and most of its support code. 2016-08-24 13:23:37 +03:00
Eduard Burtescu
cb9b0ed91b Disable old trans access via -Z orbit, #[rustc_no_mir] or --disable-orbit. 2016-08-24 13:23:37 +03:00
Guillaume Gomez
5c5f483b40 Add new error code tests 2016-08-24 11:28:09 +02:00
Guillaume Gomez
f200061bd6 Add error code test checkup 2016-08-24 11:28:09 +02:00
Guillaume Gomez
3ddb468522 Add E0478 error explanation 2016-08-24 11:28:05 +02:00
bors
308824acec Auto merge of #35748 - michaelwoerister:fix-rust-gdb-py-version-check, r=brson
Make version check in gdb_rust_pretty_printing.py more compatible.

Some versions of Python don't support the `major` field on the object returned by `sys.version_info`.

Fixes #35724

r? @brson
2016-08-23 22:52:29 -07:00
Corey Farwell
19aae8e069 Reuse iterator to avoid unnecessary creation. 2016-08-23 21:34:53 -04:00
Corey Farwell
2655c89549 Use idiomatic names for string-related methods names. 2016-08-23 21:28:26 -04:00
bors
a66fa96d18 Auto merge of #35951 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests

- Successful merges: #35910, #35912, #35913, #35936, #35939, #35949
- Failed merges: #35395
2016-08-23 16:28:20 -07: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
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
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
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