Commit Graph

58447 Commits

Author SHA1 Message Date
Alex Crichton
0f6a71e3e0 Rollup merge of #37317 - brson:relnotes, r=brson
Add release notes for 1.12.1

It completely slipped my mind that this is something I'm supposed to do as part of the release process...
2016-11-04 16:49:28 -07:00
Alex Crichton
c0bc35a364 Rollup merge of #37255 - mbrubeck:doc-edit, r=steveklabnik
Fix some mistakes in HRTB docs

The example code for higher-ranked trait bounds on closures had an unnecessary `mut` which was confusing, and the text referred to an mutable reference which does not exist in the code (and isn't needed).  Removed the `mut`s and fixed the text to better describe the actual error for the failing example.

Thanks to csd_ on IRC for pointing out these problems!

r? @steveklabnik
2016-11-04 16:49:28 -07:00
est31
ecd79a125b Add error when proc_macro_derive is used not on functions
Fixes #37590
2016-11-04 23:52:20 +01:00
bors
713a360560 Auto merge of #37356 - cristicbz:wrapsum, r=alexcrichton
Add impls for `&Wrapping`. Also `Sum`, `Product` impls for both `Wrapping` and `&Wrapping`.

There are two changes here (split into two commits):
- Ops for references to `&Wrapping`  (`Add`, `Sub`, `Mul` etc.) similar to the way they are implemented for primitives.
- Impls for `iter::{Sum,Product}` for `Wrapping`.

As far as I know `impl` stability attributes don't really matter so I didn't bother breaking up the macro for two different kinds of stability. Happy to change if it does matter.
2016-11-04 14:14:48 -07:00
Raph Levien
fe953dc16e std: Track change to cprng syscall signature (Fuchsia)
The mx_cprng_draw syscall has changed signature to separate the status
and size return values, rather than multiplexing them into a single
value with errors interpreted as a negative value. This patch tracks
that change.
2016-11-04 13:04:27 -07:00
Oliver Middleton
775d399da8 Remove recursive call from Cow::to_mut
It seems to prevent it from being inlined.
2016-11-04 18:47:32 +00:00
Tim Neumann
a6cf77704f fix #37559: update compiler-rt 2016-11-04 19:08:09 +01:00
leonardo.yvens
3e4bd88438 Change Into<Vec<u8>> for String and Into<OsString> for PathBuf to From impls 2016-11-04 15:54:08 -02:00
bors
81601cd3a3 Auto merge of #37306 - bluss:trusted-len, r=alexcrichton
Add Iterator trait TrustedLen to enable better FromIterator / Extend

This trait attempts to improve FromIterator / Extend code by enabling it to trust the iterator to produce an exact number of elements, which means that reallocation needs to happen only once and is moved out of the loop.

`TrustedLen` differs from `ExactSizeIterator` in that it attempts to include _more_ iterators by allowing for the case that the iterator's len does not fit in `usize`. Consumers must check for this case (for example they could panic, since they can't allocate a collection of that size).

For example, chain can be TrustedLen and all numerical ranges can be TrustedLen. All they need to do is to report an exact size if it fits in `usize`, and `None` as the upper bound otherwise.

The trait describes its contract like this:

```
An iterator that reports an accurate length using size_hint.

The iterator reports a size hint where it is either exact
(lower bound is equal to upper bound), or the upper bound is `None`.
The upper bound must only be `None` if the actual iterator length is
larger than `usize::MAX`.

The iterator must produce exactly the number of elements it reported.

This trait must only be implemented when the contract is upheld.
Consumers of this trait must inspect `.size_hint()`’s upper bound.
```

Fixes #37232
2016-11-04 10:40:30 -07:00
Michael Woerister
94e655eca6 Add -Zhir-stats for collecting statistics on HIR and AST 2016-11-04 11:37:39 -04:00
bors
ccfc38f034 Auto merge of #37167 - nikomatsakis:jroesch-issue-18937, r=pnkfelix
detect extra region requirements in impls

The current "compare method" check fails to check for the "region obligations" that accrue in the fulfillment context. This branch switches that code to create a `FnCtxt` so that it can invoke the regionck code. Previous crater runs (I haven't done one with the latest tip) have found some small number of affected crates, so I went ahead and introduced a warning cycle. I will kick off a crater run with this branch shortly.

This is a [breaking-change] because previously unsound code was accepted. The crater runs also revealed some cases where legitimate code was no longer type-checking, so the branch contains one additional (but orthogonal) change. It improves the elaborator so that we elaborate region requirements more thoroughly. In particular, if we know that `&'a T: 'b`, we now deduce that `T: 'b` and `'a: 'b`.

I invested a certain amount of effort in getting a good error message. The error message looks like this:

```
error[E0276]: impl has stricter requirements than trait
  --> traits-elaborate-projection-region.rs:33:5
   |
21 |     fn foo() where T: 'a;
   |     --------------------- definition of `foo` from trait
...
33 |     fn foo() where U: 'a { }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #18937 <https://github.com/rust-lang/rust/issues/18937>
note: lint level defined here
  --> traits-elaborate-projection-region.rs:12:9
   |
12 | #![deny(extra_requirement_in_impl)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
```

Obviously the warning only prints if this is a _new_ error (that resulted from the bugfix). But all existing errors that fit this description are updated to follow the general template. In order to get the lint to preserve the span-labels and the error code, I separate out the core `Diagnostic` type (which encapsulates the error code, message, span, and children) from the `DiagnosticBuilder` (which layers on a `Handler` that can be used to report errors). I also extended `add_lint` with an alternative `add_lint_diagnostic` that takes in a full diagnostic (cc @jonathandturner for those changes). This doesn't feel ideal but feels like it's moving in the right direction =).

r? @pnkfelix
cc @arielb1

Fixes #18937
2016-11-04 07:20:44 -07:00
bors
d2bc30b03f Auto merge of #37037 - Mark-Simulacrum:stack-error, r=alexcrichton
Add conversions from `io:ErrorKind` to `io::Error`

Filing to help with discussion around the possibility of doing this.

Current changes are clearly backwards incompatible, but I think adding a new function (with a bikeshed on naming) like `Error::new_str` should be possible (or some other way of specializing the string error message case) to fix #36658.
2016-11-04 03:38:18 -07:00
Liigo Zhuang
a5f6aa1c14 reference full path DefaultHasher 2016-11-04 17:07:28 +08:00
Jeffrey Seyfried
51104e5ca6 Fix fallout in tests. 2016-11-04 09:07:00 +00:00
bors
49c36bf16f Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddyb
A way to remove otherwise unused locals from MIR

There is a certain amount of desire for a pass which cleans up the provably unused variables (no assignments or reads). There has been an implementation of such pass by @scottcarr, and another (two!) implementations by me in my own dataflow efforts.

PR like https://github.com/rust-lang/rust/pull/35916 proves that this pass is useful even on its own, which is why I cherry-picked it out from my dataflow effort.

@nikomatsakis previously expressed concerns over this pass not seeming to be very cheap to run and therefore unsuitable for regular cleanup duties. Turns out, regular cleanup of local declarations is not at all necessary, at least now, because majority of passes simply do not (or should not) care about them. That’s why it is viable to only run this pass once (perhaps a few more times in the future?) per function, right before translation.

r? @eddyb or @nikomatsakis
2016-11-03 22:58:55 -07:00
Nicholas Nethercote
43452a36ef Shrink Expr_::ExprStruct.
On 64-bit platforms this reduces the size of `Expr_` from  64 bytes to
56 bytes, and reduces the size of `Expr` from 88 bytes to 80 bytes.
2016-11-04 16:11:41 +11:00
Nicholas Nethercote
9366ba3166 Reorder hir::Expr fields.
On 64-bit platforms this reduces the size of `Expr` from 96 bytes to 88
bytes.
2016-11-04 15:00:28 +11:00
Jeffrey Seyfried
b7eed53b55 Remove field TtReader::next_tok. 2016-11-04 02:39:20 +00:00
Jeffrey Seyfried
23ad6fdb66 Improve tt-heavy expansion performance. 2016-11-04 02:38:54 +00:00
Oliver Middleton
1e40c80cf5 Fix issues with the Add/AddAssign impls for Cow<str>
* Correct the stability attributes.
* Make Add and AddAssign actually behave the same.
* Use String::with_capacity when allocating a new string.
* Fix the tests.
2016-11-04 01:07:00 +00:00
Ulrik Sverdrup
f0e6b90790 Link the tracking issue for TrustedLen 2016-11-04 01:00:55 +01:00
Jeffrey Seyfried
7ae083383d Move doc comment desugaring into the parser. 2016-11-03 23:48:24 +00:00
Jeffrey Seyfried
e2b3fec778 Avoid recontructing the Parser in macro_parser.rs. 2016-11-03 23:48:24 +00:00
Jeffrey Seyfried
b60bcba9e4 Make ast::ExprKind smaller. 2016-11-03 23:48:24 +00:00
Jeffrey Seyfried
6e9bf12c6f Reimplement "macros: Improve tt fragments" with better performance. 2016-11-03 23:48:24 +00:00
Jeffrey Seyfried
3b71646a60 Revert "macros: Improve tt fragments"
This reverts commit 41745f30f7.
2016-11-03 23:48:24 +00:00
Jeffrey Seyfried
eb3ac29a10 Reduce the size of Token and make it cheaper to clone by refactoring
`Token::Interpolated(Nonterminal)` -> `Token::Interpolated(Rc<Nonterminal>)`.
2016-11-03 23:48:24 +00:00
Jeffrey Seyfried
5f280a5c60 Clean up parser.parse_token_tree(). 2016-11-03 23:48:24 +00:00
Ulrik Sverdrup
67626e0cc3 core::ptr: Specify issue for ptr_wrapping_offset feature 2016-11-04 00:16:04 +01:00
Brian Anderson
6a34feb034 Set RUSTC_BOOTSTRAP to some value.
Environment variables on windows can't be empty.
2016-11-03 22:15:43 +00:00
Mark-Simulacrum
d5f72d21af Fix ICE when querying DefId on Def::Err. 2016-11-03 15:27:29 -06:00
Martin Glagla
ed0230ee56 Peekable::peek(): Use Option::as_ref() 2016-11-03 22:22:27 +01:00
Tim Neumann
dc138b3156 use DefId's in const eval for cross-crate const fn's 2016-11-03 12:05:45 +01:00
Dominik Inführ
7d06bdd4a1 set frame pointer elimination attribute for main
The rustc-generated function `main` should respect the same config for
frame pointer elimination as the rest of code.
2016-11-03 10:59:32 +01:00
bors
ac919fcd9d Auto merge of #37541 - nikomatsakis:issue-37291, r=brson
Use impl obligations as initial environment for specialization

This corrects a small regression in specialization that crept in, I think as part of the refactoring to introduce arenas. I also made an experiment (in the last commit) to cleanup the code to be more aggressive about normalization. As the commit log notes, I am not 100% sure that this is correct, but it feels safer, and I think that at worst it yields *more* ICEs (as opposed to admitting faulty code). I'll schedule a crater run to check beyond the testbase.

Fixes #37291.

r? @aturon
2016-11-02 22:58:01 -07:00
Simonas Kazlauskas
475236770f A way to remove otherwise unused locals from MIR
Replaces the hack where a similar thing is done within trans.
2016-11-03 06:17:01 +02:00
Alex Crichton
a270b8014c rustbuild: Rewrite user-facing interface
This commit is a rewrite of the user-facing interface to the rustbuild build
system. The intention here is to make it much easier to compile/test the project
without having to remember weird rule names and such. An overall view of the new
interface is:

    # build everything
    ./x.py build

    # document everyting
    ./x.py doc

    # test everything
    ./x.py test

    # test libstd
    ./x.py test src/libstd

    # build libcore stage0
    ./x.py build src/libcore --stage 0

    # run stage1 run-pass tests
    ./x.py test src/test/run-pass --stage 1

The `src/bootstrap/bootstrap.py` script is now aliased as a top-level `x.py`
script. This `x` was chosen to be both short and easily tab-completable (no
collisions in that namespace!). The build system now accepts a "subcommand" of
what to do next, the main ones being build/doc/test.

Each subcommand then receives an optional list of arguments. These arguments are
paths in the source repo of what to work with. That is, if you want to test a
directory, you just pass that directory as an argument.

The purpose of this rewrite is to do away with all of the arcane renames like
"rpass" is the "run-pass" suite, "cfail" is the "compile-fail" suite, etc. By
simply working with directories and files it's much more intuitive of how to run
a test (just pass it as an argument).

The rustbuild step/dependency management was also rewritten along the way to
make this easy to work with and define, but that's largely just a refactoring of
what was there before.

The *intention* is that this support is extended for arbitrary files (e.g.
`src/test/run-pass/my-test-case.rs`), but that isn't quite implemented just yet.
Instead directories work for now but we can follow up with stricter path
filtering logic to plumb through all the arguments.
2016-11-02 17:57:28 -07:00
bors
f9f45c6dac Auto merge of #36993 - nnethercote:obligation, r=nikomatsakis
Optimize ObligationForest's NodeState handling.

This commit does the following.
- Changes `NodeState` from an enum to a `bitflags`. This makes it
  possible to check against multiple possible values in a single bitwise
  operation.
- Replaces all the hot `match`es involving `NodeState` with `if`/`else`
  chains that ensure that cases are handled in the order of frequency.
- Partially inlines two functions, `find_cycles_from_node` and
  `mark_as_waiting_from`, at two call sites in order to avoid function
  unnecessary function calls on hot paths.
- Fully inlines and removes `is_popped`.

These changes speeds up rustc-benchmarks/inflate-0.1.0 by about 7% when
doing debug builds with a stage1 compiler.

r? @arielb1
2016-11-02 17:46:44 -07:00
Vadim Petrochenkov
50ecee2410 Add feature gate for Self and associated types in struct expressions and patterns 2016-11-03 03:32:28 +03:00
Niko Matsakis
b4f910d900 just use full-normalization when for the impl trait ref
This seems better because I want to avoid the situation where unresolved
inference variables make it into the environment.  On the other hand, I
am not 100% sure that this is correct. My assumption was that the WF
check should ensure that this normalization can succeed. But it occurs
to me that the WF checks may need to make use of the `specializes`
predicate themselves, and hence we may have a kind of cycle here (this
is a bigger problem with spec in any case that we need to resolve).

On the other hand, this should just cause extra errors I think, so it
seems like a safe thing to attempt. Certainly all tests pass.
2016-11-02 18:18:24 -04:00
Niko Matsakis
d9bc86032d normalize trait-ref in context of impl
The `specializes()` function was trying to normalize the impl trait in
an empty environment. This could lead to inexplicable failures.
2016-11-02 18:18:24 -04:00
Niko Matsakis
797e0420e3 add #32791 test case 2016-11-02 18:18:24 -04:00
Nicholas Nethercote
d73c68ceef leb128-encode integers before hashing them in IchHasher.
This significantly reduces the number of bytes hashed by IchHasher.
2016-11-03 09:05:56 +11:00
bors
5665bdf3e3 Auto merge of #37540 - jonathandturner:rollup, r=jonathandturner
Rollup of 10 pull requests

- Successful merges: #37351, #37405, #37473, #37482, #37488, #37498, #37502, #37513, #37517, #37523
- Failed merges: #37521
2016-11-02 14:29:31 -07:00
Jonathan Turner
0befab2343 Rollup merge of #37523 - d-unseductable:deref_mut_lifetimes, r=bluss
Elide lifetimes in DerefMut documentation

 - Elide lifetimes to increase the readability of `DerefMut` examples
2016-11-02 15:09:43 -04:00
Jonathan Turner
805aecc36a Rollup merge of #37517 - Mark-Simulacrum:add-unwrap-default-tracking-issue, r=alexcrichton
Add tracking issue number to Result::unwrap_or_default unstable annotation.

Implemented in https://github.com/rust-lang/rust/pull/37299.

Tracking issue: https://github.com/rust-lang/rust/issues/37516.
2016-11-02 15:09:42 -04:00
Jonathan Turner
27f41b7001 Rollup merge of #37513 - michaelwoerister:hash-panic-spans, r=nikomatsakis
ICH: Hash expression spans if their source location is captured for panics.

Since the location of some expressions is captured in error message constants, it has an influence on machine code and consequently we need to take them into account by the incr. comp. hash. This PR makes this happen for `+, -, *, /, %` and for array indexing -- let me know if I forgot anything.

In the future we might want to change the codegen strategy for those error messages, so that they are stored in a separate object file with a stable symbol name, so that only this object file has to be regenerated when source locations change. This strategy would also eliminate unnecessary duplications due  to monomorphization, as @arielb1 has pointed out on IRC. I opened https://github.com/rust-lang/rust/issues/37512, so we don't forget about this.

r? @nikomatsakis
2016-11-02 15:09:42 -04:00
Jonathan Turner
62e026be5a Rollup merge of #37502 - CryZe:patch-4, r=sfackler
Add missing space in mutable_transmutes lint
2016-11-02 15:09:42 -04:00
Jonathan Turner
b333860611 Rollup merge of #37498 - sanxiyn:unused-type-alias, r=eddyb
Remove unused type aliases

Found by extending the dead code lint. The lint itself is work in progress because of false positives.

cc #37455.
2016-11-02 15:09:42 -04:00
Jonathan Turner
d2f4a9d7be Rollup merge of #37488 - frewsxcv:quiet-travis, r=alexcrichton
Use quieter test output when running tests on Travis CI.

Fixes https://github.com/rust-lang/rust/issues/36788.
2016-11-02 15:09:41 -04:00