Commit Graph

67461 Commits

Author SHA1 Message Date
Alexis Beingessner
4f245073b2 implement unsafe pointer methods 2017-09-10 16:09:18 -04:00
bors
b413f34087 Auto merge of #44079 - gaurikholkar:named_conf, r=nikomatsakis
Extend E0623 for LateBound and EarlyBound Regions

This is a fix for #43882
```
fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
    x.push(y);
}
```
now gives

```
error[E0623]: lifetime mismatch
  --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:12
   |
11 | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) {
   |                           ------      ------ these two types are declared with different lifetimes...
12 |     x.push(y);
   |            ^ ...but data from `y` flows into `x` here
```
cc @nikomatsakis @arielb1

Please ignore the second commit. It will be merged in a separate PR.
2017-09-10 15:32:20 +00:00
bors
d290dec97f Auto merge of #44474 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 13 pull requests

- Successful merges: #44262, #44329, #44332, #44347, #44372, #44384, #44387, #44396, #44449, #44451, #44457, #44464, #44467
- Failed merges:
2017-09-10 12:48:55 +00:00
Guillaume Gomez
8a7d93bf6f Rollup merge of #44467 - toidiu:ak-44382, r=frewsxcv
documentation update to demonstrate mutability

#44467

- demonstrate correct implementation returns `Some`
- demonstrate out of bounds returns `None`
- demonstrate mutability
2017-09-10 14:03:32 +02:00
Guillaume Gomez
dcc1d1463a Rollup merge of #44464 - Dushistov:master, r=alexcrichton
add test for #41229

Closes #41229
2017-09-10 14:03:31 +02:00
Guillaume Gomez
329ed4affe Rollup merge of #44457 - napen123:master, r=frewsxcv
Add doc examples for str::as_bytes_mut

Fixes #44427
2017-09-10 14:03:30 +02:00
Guillaume Gomez
485847dd70 Rollup merge of #44451 - Zoxc:gen-panic, r=eddyb
Fix bitrotted generator panic emission

r? @eddyb
2017-09-10 14:03:29 +02:00
Guillaume Gomez
d3ef39f2af Rollup merge of #44449 - tommyip:doc_string_as_str, r=frewsxcv
Add doc example to String::as_str

Fixes #44428.
2017-09-10 14:03:28 +02:00
Guillaume Gomez
f76f2c76dc Rollup merge of #44396 - joshlf:tls-comment, r=alexcrichton
std:🧵:LocalKey: Document limitation with initializers

Document that if a `LocalKey`'s initializer recursively depends on itself, initialization will result in infinite recursion.
2017-09-10 14:03:27 +02:00
Guillaume Gomez
06f39fa10e Rollup merge of #44387 - est31:update_compiler_builtins, r=Mark-Simulacrum
Update the libcompiler_builins submodule

Pulls in https://github.com/rust-lang-nursery/compiler-builtins/pull/187 for nicer build output :)
2017-09-10 14:03:26 +02:00
Guillaume Gomez
0e2dac7eba Rollup merge of #44384 - alexcrichton:osx-segfault, r=estebank
std: Fix a segfault on OSX with backtraces

Apparently `dladdr` can succeed but still give you NULL pointers!

Closes #44379
2017-09-10 14:03:25 +02:00
Guillaume Gomez
1e4ab871f5 Rollup merge of #44372 - bgermann:master, r=alexcrichton
Use memalign instead of posix_memalign for Solaris

As pointed out in https://github.com/rust-lang/libc/commit/deb61c8,
Solaris 10 does not support posix_memalign.
Use memalign for all Solaris versions instead.
With this change applied I am able to cross-build rustc for Solaris 10.
2017-09-10 14:03:24 +02:00
Guillaume Gomez
65fd1a20b0 Rollup merge of #44347 - GuillaumeGomez:rustdoc-false-positive, r=QuietMisdreavus
Reduce false positives number in rustdoc html diff

cc @rust-lang/dev-tools
r? @nrc

Very simple trick but should lighten html diff a bit
2017-09-10 14:03:23 +02:00
Guillaume Gomez
62659ebf66 Rollup merge of #44332 - tirr-c:issue-44021, r=petrochenkov
Expect pipe symbol after closure parameter list

Fixes #44021.

---

Originally, the parser just called `bump` to discard following token after parsing closure parameter list, because it assumes `|` is following. However, the following code breaks the assumption:

```rust
struct MyStruct;
impl MyStruct {
   fn f() {|x, y}
}
```

Here, the parameter list is `x, y` and the following token is `}`. The parser discards `}`, and then we have a curly bracket mismatch.

Indeed, this code has a syntax error. On current nightly, the compiler emits an syntax error, but with incorrect message and span, followed by an ICE.

```
error: expected expression, found `}`
 --> 44021.rs:4:1
  |
4 | }
  | ^

error: internal compiler error: unexpected panic
```

Even worse, on current stable(1.20.0), the compiler falls into an infinite loop.

This pull request fixes this problem. Now the compiler emits correct error message and span, and does not ICE.

```
error: expected one of `:`, `@`, or `|`, found `}`
 --> 44021.rs:3:20
  |
3 |     fn foo() {|x, y}
  |                    ^ expected one of `:`, `@`, or `|` here
```
2017-09-10 14:03:22 +02:00
Guillaume Gomez
078e1c546c Rollup merge of #44329 - nrc:pulldown-warn-fix, r=ollie27
Fixup some nits from #44238

r? @ollie27
2017-09-10 14:03:21 +02:00
Guillaume Gomez
9af7de1cb8 Rollup merge of #44262 - alexcrichton:repr-128-gate, r=nikomatsakis
rustc: Separately feature gate repr(i128)

Brought up during the discussion of #35118, the support for this is still
somewhat buggy and so stabilization likely wants to be considered independently
of the type itself.
2017-09-10 14:03:20 +02:00
bors
23aaeb573b Auto merge of #44312 - eddyb:static-by-any-other-name, r=alexcrichton
Use rvalue promotion to 'static instead of static items.

Fixes #44240. Among other things, in crates that do a lot of formatting, this could reduce the number of items, although I haven't measured the performance benefits. If there's a codegen slowdown, that should IMO be solved by caching the output of miri, *not* by using `static`.

r? @alexcrichton
2017-09-10 10:09:47 +00:00
Niko Matsakis
88e4bf6827 fix "correct" case in diagnostic error message 2017-09-10 06:08:29 -04:00
Eduard-Mihai Burtescu
10f66bd6e4 Use rvalue promotion to 'static instead of static items. 2017-09-10 11:20:27 +03:00
bors
34035d23ff Auto merge of #44418 - alexcrichton:remove-dep-graph, r=michaelwoerister
rustc: Remove `DepGraph` handling from rustc_metadata

This should now be entirely tracked through queries, so no need to have a
`DepGraph` in the `CStore` object any more!

cc #44390
2017-09-10 07:33:46 +00:00
bors
6d445e16b5 Auto merge of #44260 - alexcrichton:hardlink-no-copy, r=Mark-Simulacrum
rustbuild: Switch back to using hard links

The `copy` function historically in rustbuild used hard links to speed up the
copy operations that it does. This logic was backed out, however, in #39518 due
to a bug that only showed up on Windows, described in #39504. The cause
described in #39504 happened because Cargo, on a fresh build, would overwrite
the previous artifacts with new hard links that Cargo itself manages.

This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer
should overwrite files on fresh builds, opportunistically leaving the filesystem
intact and not touching it.

Hopefully this can help speed up local builds by doing fewer copies all over the
place!
2017-09-10 04:36:15 +00:00
Alex Crichton
38bedfabb9 rustbuild: Switch back to using hard links
The `copy` function historically in rustbuild used hard links to speed up the
copy operations that it does. This logic was backed out, however, in #39518 due
to a bug that only showed up on Windows, described in #39504. The cause
described in #39504 happened because Cargo, on a fresh build, would overwrite
the previous artifacts with new hard links that Cargo itself manages.

This behavior in Cargo was fixed in rust-lang/cargo#4390 where it no longer
should overwrite files on fresh builds, opportunistically leaving the filesystem
intact and not touching it.

Hopefully this can help speed up local builds by doing fewer copies all over the
place!
2017-09-09 21:14:44 -07:00
Alex Crichton
d724d03389 rustc: Remove DepGraph handling from rustc_metadata
This should now be entirely tracked through queries, so no need to have a
`DepGraph` in the `CStore` object any more!
2017-09-09 21:11:25 -07:00
bors
f982ff05db Auto merge of #44274 - Mark-Simulacrum:rustdoc-tests, r=alexcrichton
Test rustdoc.

Also fixes the broken tests.

r? @alexcrichton
2017-09-10 01:24:14 +00:00
toidiu
c430fa8084 documentation update to demonstrate mutability 2017-09-09 16:56:12 -04:00
Evgeniy A. Dushistov
4928d25457 add test for #41229
Closes #41229
2017-09-09 23:12:41 +03:00
bors
ddd123ed9a Auto merge of #44251 - kennytm:osx-backtrace, r=alexcrichton
Add libbacktrace support for Apple platforms (resubmitted)

Resubmitting #43422 rebased on the current master (cc @JohnColanduoni).

I have added an additional commit to fallback to `dladdr`-based `resolve_symbol` if `libbacktrace` returns `None`, otherwise the stack trace will be full of `<unknown>` when you forget to pass the `-g` flag (actually it seems — at least on macOS — the `dladdr` symbol is more accurate than the `libbacktrace` one).
2017-09-09 17:32:13 +00:00
Ethan Dagner
6c8993532c Add doc examples for str::as_bytes_mut
Fixes #44427
2017-09-09 10:27:47 -06:00
bors
18366f4e8a Auto merge of #44212 - eddyb:drop-const, r=nikomatsakis
Allow Drop types in const's too, with #![feature(drop_types_in_const)].

Implements the remaining amendment, see #33156. cc @SergioBenitez

r? @nikomatsakis
2017-09-09 11:48:57 +00:00
bors
929b878262 Auto merge of #44438 - Xaeroxe:clamp, r=Mark-Simulacrum
Revert clamp

Revert clamp per https://github.com/rust-lang/rust/issues/44095#issuecomment-328218316 while we take time to assess the potential backwards compatibility damage done by it.
2017-09-09 09:13:03 +00:00
John Kåre Alsaker
967c4e6347 Fix bitrotted generator panic emission 2017-09-09 11:11:13 +02:00
Tommy Ip
3e8fadc2ac Add doc example to String::as_str
Fixes #44428.
2017-09-09 09:05:54 +01:00
bors
a9fa8cc0b6 Auto merge of #44335 - arielb1:node-hashing, r=alexcrichton
Avoid hashing when creating a DepNode from a HirId

Instead, combine the already-present DefPathHash with the 32-bit
ItemLocalIndex.

Should fix #44323.

r? @alexcrichton
2017-09-09 05:58:13 +00:00
gaurikholkar
cfc7cf3961 adding E0623 for LateBound regions 2017-09-09 11:12:27 +05:30
bors
dee6d0f62e Auto merge of #44269 - nikomatsakis:issue-43613-limit-cache-obligations, r=arielb1
limit and clear cache obligations opportunistically

Keeping **all** the obligations for every projection is wasteful of
memory and compilation time. We only really care about those
subobligations that may inform the result of the projection (i.e., may
help to resolve any inference variables that appear within).
Therefore, we can clear the subobligations from the cache that don't
potentially affect the result of the projection. On every cache hit,
we also take the opportunity to check if the type variables have been
resolved *yet* and, if so, clear out the pending obligations.

Fixes #43613.

r? @arielb1

NB -- not sure how to test for this. Probably we should add the #43613 test case to perf.
2017-09-08 23:47:16 +00:00
Jacob Kiesel
db5b5f9706 Revert "Add clamp functions"
This reverts commit c589f867f8.
2017-09-08 16:07:21 -06:00
Jacob Kiesel
63f4dab0f5 Revert "Add NAN examples"
This reverts commit f74c5d2e18.
2017-09-08 16:07:19 -06:00
Jacob Kiesel
eafdad511f Revert "Fix f32 examples."
This reverts commit 61f20f8df0.
2017-09-08 16:07:17 -06:00
Jacob Kiesel
15d3eeaf65 Revert "Fix f64 examples"
This reverts commit 576426a05a.
2017-09-08 16:07:15 -06:00
Jacob Kiesel
8b96167004 Revert "Fix documentation and formatting."
This reverts commit 2e34ff7671.
2017-09-08 16:07:13 -06:00
Jacob Kiesel
67283fa8e6 Revert "Add panic unit tests"
This reverts commit b762283e57.
2017-09-08 16:07:09 -06:00
bors
dead08cb33 Auto merge of #44142 - alexcrichton:dllimport-query, r=nikomatsakis
Migrate a slew of metadata methods to queries

This PR intends to make more progress on #41417, knocking off some low-hanging fruit.

Closes #44190
cc #44137
2017-09-08 09:47:58 +00:00
bors
d6ad402a64 Auto merge of #43742 - epdtry:pprust-expr-fix, r=petrochenkov
pprust: fix parenthesization of exprs

The pretty printer in `syntax::print::pprust` currently relies on the presence of `ExprKind::Paren` hints in order to correctly parenthesize expressions in its output.  If `Paren` nodes are missing, it sometimes produces wrong output, such as printing `1 - (2 - 3)` as `1 - 2 - 3`.  This PR fixes `pprust` to correctly print expressions regardless of the presence or absence of `Paren` nodes.  This should make `pprust` easier to use with programmatically constructed ASTs.

A few notes:

 * I added a function for assigning precedence values to exprs in `syntax::util::parser`, since there is already code there for assigning precedence values to binops.  Let me know if I should move this somewhere more `pprust`-specific.

 * I also moved the `contains_exterior_struct_lit` function from `rustc_lint::unused::UnusedParens` into `syntax::util::parser`, since it's needed for determining the correct parenthesization of `if`/`while` conditional expressions.

 * I couldn't find a good way to compare two exprs for equivalence while ignoring semantically-irrelevant details like spans.  So the test for the new behavior relies on a slight hack: it adds `Paren` nodes everywhere, so that the pretty-printed version exactly reflects the structure of the AST, and then compares the printed strings.  This works, but let me know if there's a better way.
2017-09-08 06:56:09 +00:00
bors
e1ef1882a0 Auto merge of #44399 - alexcrichton:tmp-travis-downgrade, r=alexcrichton
travis: Downgrade to previous images temporarily

Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.

[update]: https://blog.travis-ci.com/2017-08-29-trusty-image-updates
2017-09-07 22:45:48 +00:00
Alex Crichton
7ed298609c travis: Downgrade to previous images temporarily
Travis is in the process of [rolling out an update][update] but looks like our
tests are breaking, let's temporarily roll back to get the queue moving again.

[update]: https://blog.travis-ci.com/2017-08-29-trusty-image-updates
2017-09-07 13:48:35 -07:00
Joshua Liebow-Feeser
ddb072b8d7 std:🧵:LocalKey: Document limitation with initializers 2017-09-07 12:57:08 -07:00
Niko Matsakis
c1dddcec06 update comment 2017-09-07 12:38:33 -04:00
Alex Crichton
fd0aa647f3 rustc: Remove CrateStore::crates as a method
This commit moves the `crates` method to a query and then migrates all callers
to use a query instead of the now-renamed `crates_untracked` method where
possible.

Closes #41417
2017-09-07 08:13:41 -07:00
Alex Crichton
2ee7493b2a Add some more with_ignore to get tests passing 2017-09-07 08:13:17 -07:00
Stuart Pernsteiner
3454d99cb6 pprust: increase precedence of block-like exprs 2017-09-07 10:28:31 -04:00