Commit Graph

80138 Commits

Author SHA1 Message Date
Niko Matsakis
78ea95258d improve comments 2018-07-02 11:40:49 -04:00
Niko Matsakis
90ea49b891 introduce predicates_defined_on for traits
This new query returns only the predicates *directly defined* on an
item (in contrast to the more common `predicates_of`, which returns
the predicates that must be proven to reference an item). These two
sets are almost always identical except for traits, where
`predicates_of` includes an artificial `Self: Trait<...>` predicate
(basically saying that you cannot use a trait item without proving
that the trait is implemented for the type parameters).

This new query is only used in chalk lowering, where this artificial
`Self: Trait` predicate is problematic. We encode it in metadata but
only where needed since it is kind of repetitive with existing
information.

Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 11:33:24 -04:00
Niko Matsakis
327093007a add is_trait(DefId) helper to TyCtxt
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:37 -04:00
Niko Matsakis
7bbbed9046 drive-by nits and debug
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:35 -04:00
Niko Matsakis
c9d4f0615f use ty::TraitRef::identity where possible
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:33 -04:00
Niko Matsakis
5c15163cb9 prove defaults meet WF requirements, not that they are WF
If we have

```rust
struct Foo<T: Copy = String> { .. }
```

the old code would have proven that `String: Copy` was WF -- this,
incidentally, also proved that `String: Copy`. The new code just
proves `String: Copy` directly.

Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:30 -04:00
Dror Levin
73166f751b Fill in tracking issue number for read_exact_at/write_all_at 2018-07-02 17:38:15 +03:00
Michael Woerister
79d8d087a3 incr.comp.: Take names of children into account when computing the ICH of a module's HIR. 2018-07-02 16:21:34 +02:00
Alexander Regueiro
ea806e7815 Removed uninitialized_statics field from Memory struct in miri.
Refactored code accordingly.
2018-07-02 15:18:36 +01:00
bors
4faaf7e335 Auto merge of #51122 - oli-obk:clippy, r=Mark-Simulacrum
Did you mean to block nightlies on clippy?

Discussion: https://gitter.im/rust-lang/WG-clippy?at=5b073b6597a0361fb760cdc2

r? @alexcrichton

did I forget anything?

cc @nrc @Manishearth
2018-07-02 14:04:26 +00:00
Josef Reinhard Brandl
4e617291c2 Make drop method for PinMut's UnsafeFutureObj impl empty 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl
dd3b0337ff Improve doc comments for FutureObj 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl
042928f0f5 UnsafeFutureObj impl for PinMut 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl
d8bf222367 Add lifetime to FutureObj 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl
9f70e7fe3c Use From impls for FutureObj<()> 2018-07-02 13:59:39 +02:00
Josef Reinhard Brandl
3d43f828f5 Make custom trait object for Future generic 2018-07-02 13:59:39 +02:00
bors
e75e78256f Auto merge of #51645 - marco-c:error_when_incremental_and_profile, r=michaelwoerister
Raise an error if gcov profiling and incremental compilation are both enabled

Fixes #50203.
2018-07-02 11:58:45 +00:00
Oliver Schneider
78adefd15d Clippy tool also has only a single LICENSE file 2018-07-02 13:57:29 +02:00
est31
563dacd648 Update stdsimd 2018-07-02 12:53:46 +02:00
est31
3779a4cb74 Emit column info in debuginfo for non msvc like targets 2018-07-02 12:16:05 +02:00
Oliver Schneider
75a6fde6a4 Update rustdoc 2018-07-02 10:37:49 +02:00
Oliver Schneider
6d114399f8 Make sure clippy does not duplicate depenencies 2018-07-02 10:36:07 +02:00
bors
a96c88e80f Auto merge of #51893 - nnethercote:BTreeMap-clone-noalloc, r=nnethercote
Make `BTreeMap::clone()` not allocate when cloning an empty tree.

r? @Gankro

CC @porglezomp
2018-07-02 08:28:12 +00:00
Oliver Schneider
6e5b9c1472 Get rid of TyImplTraitExistential 2018-07-02 09:17:38 +02:00
bors
a53bd20fae Auto merge of #51931 - cramertj:rm-libbacktrace, r=alexcrichton
Use in-tree libbacktrace on Fuchsia

cc @abarth

r? @alexcrichton
(welcome back! 😄 )
2018-07-02 06:32:16 +00:00
Zack M. Davis
f23d90a147 add FIXMEs pleading for post-@ edit of commentary on mem_categorization
(The present author fears not being knowledgeable enough to rewrite the
comments unilaterally; merely calling it out is a lazy half-measure, but
at least doesn't actively make things worse the way an ill-informed
rewrite would.)
2018-07-01 22:27:29 -07:00
Zack M. Davis
735d1bd5e6 use HirId in middle::mem_categorization::cmt_, and consequences of that
For the HirIdification initiative #50928.
2018-07-01 22:27:29 -07:00
bors
45935640f0 Auto merge of #51866 - zackmdavis:hir_making_each_day_of_the_year, r=petrochenkov
add modifier keyword spans to hir::Visibility; improve unreachable-pub, private-no-mangle lint suggestions

#50455 pointed out that the unreachable-pub suggestion for brace-grouped `use`s was bogus; #50476 partially ameliorated this by marking the suggestion as `Applicability::MaybeIncorrect`, but this is the actual fix.

Meanwhile, another application of having spans available in `hir::Visibility` is found in the private-no-mangle lints, where we can now issue a suggestion to use `pub` if the item has a more restricted visibility marker (this seems much less likely to come up in practice than not having any visibility keyword at all, but thoroughness is a virtue). While we're there, we can also add a helpful note if the item does have a `pub` (but triggered the lint presumably because enclosing modules were private).

![hir_vis](https://user-images.githubusercontent.com/1076988/42018064-ca830290-7a65-11e8-9c4c-48bc846f861f.png)

r? @nrc
cc @Manishearth
2018-07-02 03:18:49 +00:00
Esteban Küber
e89db3030d Do not suggest changes to str literal if it isn't one 2018-07-01 20:03:35 -07:00
Nicholas Nethercote
f46f05bae8 Make BTreeMap::clone() not allocate when cloning an empty tree. 2018-07-02 13:03:31 +10:00
bors
5df43114bc Auto merge of #51864 - est31:libc_update, r=alexcrichton
Update liblibc

This updates the libc submodule
2018-07-02 01:16:13 +00:00
Santiago Pastorino
71f25b408d
Run rustfmt 2018-07-01 20:46:07 -03:00
Santiago Pastorino
0957ede502
Make causal tracking lazy 2018-07-01 20:46:07 -03:00
Santiago Pastorino
24f91e8782
Move find_use stuff to it's own file 2018-07-01 20:46:07 -03:00
Santiago Pastorino
b2d16f3b96
let add_element return by itself 2018-07-01 20:46:07 -03:00
bors
c697a56d01 Auto merge of #51110 - alexreg:new-static-eval-rules, r=eddyb
Loosened rules involving statics mentioning other statics

Before this PR, trying to mention a static in any way other than taking a reference to it caused a compile-time error. So, while

```rust
static A: u32 = 42;
static B: &u32 = &A;
```

compiles successfully,

```rust
static A: u32 = 42;
static B: u32 = A; // error
```

and

```rust
static A: u32 = 42;
static B: u32 = *&A; // error
```

are not possible to express in Rust. On the other hand, introducing an intermediate `const fn` can presently allow one to do just that:

```rust
static A: u32 = 42;
static B: u32 = foo(&A); // success!

const fn foo(a: &u32) -> u32 {
    *a
}
```

Preventing `const fn` from allowing to work around the ban on reading from statics would cripple `const fn` almost into uselessness.
Additionally, the limitation for reading from statics comes from the old const evaluator(s) and is not shared by `miri`.

This PR loosens the rules around use of statics to allow statics to evaluate other statics by value, allowing all of the above examples to compile and run successfully.
Reads from extern (foreign) statics are however still disallowed by miri, because there is no compile-time value to be read.

```rust
extern static A: u32;

static B: u32 = A; // error
```

This opens up a new avenue of potential issues, as a static can now not just refer to other statics or read from other statics, but even contain references that point into itself.
While it might seem like this could cause subtle bugs like allowing a static to be initialized by its own value, this is inherently impossible in miri.
Reading from a static causes the `const_eval` query for that static to be invoked. Calling the `const_eval` query for a static while already inside the `const_eval` query of said static will cause cycle errors.
It is not possible to accidentally create a bug in miri that would enable initializing a static with itself, because the memory of the static *does not exist* while being initialized.
The memory is not uninitialized, it is not there. Thus any change that would accidentally allow reading from a not yet initialized static would cause ICEs.

Tests have been modified according to the new rules, and new tests have been added for writing to `static mut`s within definitions of statics (which needs to fail), and incremental compilation with complex/interlinking static definitions.
Note that incremental compilation did not need to be adjusted, because all of this was already possible before with workarounds (like intermediate `const fn`s) and the encoding/decoding already supports all the possible cases.

r? @eddyb
2018-07-01 23:00:27 +00:00
bors
a7a60dc7f8 Auto merge of #51969 - pietroalbini:rollup, r=pietroalbini
Rollup of 7 pull requests

Successful merges:

 - #51511 (Stabilize Iterator::flatten in 1.29, fixes #48213.)
 - #51853 (Fix some doc links)
 - #51890 (Fix inconsequential typo in GlobalAlloc doc example)
 - #51920 (use literal span for concrete type suggestion)
 - #51921 (improve the error message when `#[panic_implementation]` is missing)
 - #51922 (rename the llvm-tools component to llvm-tools-preview and tweak its image)
 - #51961 (Fix typo in /src/librustc_resolve/lib.rs)

Failed merges:

r? @ghost
2018-07-01 20:48:57 +00:00
Pietro Albini
3e95491be7
Rollup merge of #51961 - 11Takanori:fix-typo, r=petrochenkov
Fix typo in /src/librustc_resolve/lib.rs

absoluate -> absolute
2018-07-01 21:18:51 +02:00
Pietro Albini
c78bfa33dd
Rollup merge of #51922 - japaric:llvm-tools-preview, r=alexcrichton
rename the llvm-tools component to llvm-tools-preview and tweak its image

as per https://github.com/rust-lang/rust/issues/49584#issuecomment-401217483

r? @alexcrichton or @Mark-Simulacrum
2018-07-01 21:18:50 +02:00
Pietro Albini
87b714b619
Rollup merge of #51921 - japaric:panic-impl-error, r=nagisa
improve the error message when `#[panic_implementation]` is missing

closes #51341

r? @nagisa
cc @phil-opp
2018-07-01 21:18:49 +02:00
Pietro Albini
3f5d2fd850
Rollup merge of #51920 - euclio:concrete-type-suggestion, r=estebank
use literal span for concrete type suggestion

Fixes #51874.

r? @estebank
2018-07-01 21:18:47 +02:00
Pietro Albini
255c26b4f7
Rollup merge of #51890 - Ixrec:patch-3, r=alexcrichton
Fix inconsequential typo in GlobalAlloc doc example
2018-07-01 21:18:46 +02:00
Pietro Albini
1e50629772
Rollup merge of #51853 - MajorBreakfast:fix-doc-links, r=cramertj
Fix some doc links

The futures crate CI always fails because of these intra doc links. I hope that this will fix this issue.

r? @steveklabnik
@cramertj

Edit: I added @steveklabnik as reviewer because this PR also adjusts a link in `src/libstd/error.rs`
2018-07-01 21:18:45 +02:00
Pietro Albini
0f8343830b
Rollup merge of #51511 - Centril:feature/stabilize_iterator_flatten, r=SimonSapin
Stabilize Iterator::flatten in 1.29, fixes #48213.

This PR stabilizes [`Iterator::flatten`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.flatten) in *version 1.29* (1.28 goes to beta in 10 days, I don't think there's enough time to land it in that time, but let's see...).

Tracking issue is:  #48213.

cc @bluss re. itertools.
r? @SimonSapin
ping @pietroalbini -- let's do a crater run when this passes CI :)
2018-07-01 21:18:43 +02:00
bors
a2be769fd5 Auto merge of #51833 - wesleywiser:faster_large_constant_arrays, r=oli-obk
Speed up compilation of large constant arrays

This is a different approach to #51672 as suggested by @oli-obk. Rather
than write each repeated value one-by-one, we write the first one and
then copy its value directly into the remaining memory.

With this change, the [toy program](c2f4744d2d/src/test/run-pass/mir_heavy_promoted.rs) goes from 63 seconds to 19 seconds on my machine.

Edit: Inlining `Size::bytes()` saves an additional 6 seconds dropping the total time to 13 seconds on my machine.

Edit2: Now down to 2.8 seconds.

r? @oli-obk

cc @nnethercote @eddyb
2018-07-01 18:43:41 +00:00
est31
e8e8bb62d9 Update liblibc 2018-07-01 20:23:41 +02:00
Zack M. Davis
43a0a65fa2 call it hir::VisibilityKind instead of hir::Visibility_:*
It was pointed out in review that the glob-exported
underscore-suffixed convention for `Spanned` HIR nodes is no longer
preferred: see February 2016's #31487 for AST's migration away from
this style towards properly namespaced NodeKind enums.

This concerns #51968.
2018-07-01 11:05:10 -07:00
bors
6af9f91a17 Auto merge of #51536 - davidtwco:nll-dyn-trait-underscore-error-improvements, r=nikomatsakis
NLL: bad error message when converting anonymous lifetime to `'static`

Contributes to #46983. This PR doesn't introduce fantastic errors, but it should hopefully lay some groundwork for diagnostic improvements.
r? @nikomatsakis
2018-07-01 15:49:48 +00:00
David Wood
c0c4741ef7
Updated affected tests after rebase. 2018-07-01 16:14:26 +01:00
David Wood
15aad83560
Fix infinite loops when regions are self-referential. 2018-07-01 16:14:26 +01:00