Commit Graph

80503 Commits

Author SHA1 Message Date
Oliver Schneider
f1e3a5a24b Only display difference of features, not all features 2018-07-05 19:02:43 +02:00
Josh Stone
e578976560 Store scalar pair bools as i8 in memory
We represent `bool` as `i1` in a `ScalarPair`, unlike other aggregates,
to optimize IR for checked operators and the like.  With this patch, we
still do so when the pair is an immediate value, but we use the `i8`
memory type when the value is loaded or stored as an LLVM aggregate.

So `(bool, bool)` looks like an `{ i1, i1 }` immediate, but `{ i8, i8 }`
in memory.  When a pair is a direct function argument, `PassMode::Pair`,
it is still passed using the immediate `i1` type, but as a return value
it will use the `i8` memory type.  Also, `bool`-like` enum tags will now
use scalar pairs when possible, where they were previously excluded due
to optimization issues.
2018-07-05 09:59:52 -07:00
Oliver Schneider
82a1328740 Vertical list of tools to check 2018-07-05 18:48:56 +02:00
Alex Crichton
d825115978 Update Cargo.lock dependencies
Run `cargo update` and let's see how far we can get!
2018-07-05 09:30:27 -07:00
Val Markovic
dc425e2e64
Clarifying how the alignment of the struct works
The docs were not specifying how to compute the alignment of the struct, so I had to spend some time trying to figure out how that works. Found the answer [on this page](http://camlorn.net/posts/April%202017/rust-struct-field-reordering.html):

> The total size of this struct is 5, but the most-aligned field is b with alignment 2, so we round up to 6 and give the struct an alignment of 2 bytes.
2018-07-05 09:24:03 -07:00
Guillaume Gomez
1ff7f04120 Fix rustdoc run failures by shutting down definitely some lints 2018-07-05 17:18:45 +02:00
bors
94eb176055 Auto merge of #52012 - oli-obk:clippy, r=kennytm
Update the clippy submodule
2018-07-05 11:44:08 +00:00
Oliver Schneider
d5dbeda9ef Update the clippy submodule 2018-07-05 13:42:12 +02:00
csmoe
ff83ef0c24 merge wellformed(wc)s 2018-07-05 18:49:02 +08:00
csmoe
dabd3f6935 split IntoWellFormedGoal 2018-07-05 18:47:00 +08:00
csmoe
329d03ac1f update test 2018-07-05 18:47:00 +08:00
csmoe
e2f3577131 wellformed wc 2018-07-05 18:46:43 +08:00
Mikhail Modin
f247a3e490 fix for issue #8636 2018-07-05 11:34:10 +01:00
Konrad Borowski
0ce01776ba Add a punch card to weird expressions test 2018-07-05 12:31:09 +02:00
bors
69b9e1e8f9 Auto merge of #51967 - varkor:const-body-break-continue, r=estebank
Fix various issues with control-flow statements inside anonymous constants

Fixes #51761.
Fixes #51963 (and the host of other reported issues there).
(Might be easiest to review per commit, as they should be standalone.)

r? @estebank
2018-07-05 09:40:08 +00:00
csmoe
e7e8c72fdd update test 2018-07-05 17:38:44 +08:00
bors
6fc21e5576 Auto merge of #51936 - japaric:rust-lld, r=alexcrichton
rename rustc's lld to rust-lld

to not shadow the system installed LLD when linking with LLD.

Before:

- `-C linker=lld -Z linker-flavor=ld.lld` uses rustc's LLD
- It's not possible to use a system installed LLD that's named `lld`

With this commit:

- `-C linker=rust-lld -Z linker-flavor=ld.lld` uses rustc's LLD
- `-C linker=lld -Z linker-flavor=ld.lld` uses the system installed LLD

we don't offer guarantees about the availability of LLD in the rustc sysroot so we can rename the tool as long as we don't break the wasm32-unknown-unknown target which depends on it.

r? @alexcrichton we discussed this before
2018-07-05 06:44:16 +00:00
Jorge Aparicio
31ed5c7a01 in the second copy lld is already named rust-lld 2018-07-04 23:10:10 -05:00
bors
c865d3934c Auto merge of #51938 - zackmdavis:and_the_case_of_the_leaking_desugar, r=estebank
in which we plug the crack where `?`-desugaring leaked into errors

Most of the time, it's not a problem that the types of the arm bodies in
a desugared-from-`?` match are different (that is, specifically: in `x?`
where x is a `Result<A, B>`, the `Ok` arm body is an `A`, whereas the
`Err` arm diverges to return a `Result<A, B>`), because they're being
assigned to different places. But in tail position, the types do need to
match, and our error message was explicitly referring to "match arms",
which is confusing when there's no `match` in the sweetly sugared
source.

It is not without some misgivings that we pollute the clarity-of-purpose
of `note_error_origin` with the suggestion to wrap with `Ok` (the other
branches are pointing out the odd-arm-out in the HIR that is the origin
of the error; the new branch that issues the `Ok` suggestion is serving
a different purpose), but it's the natural place to do it given that
we're already matching on `ObligationCauseCode::MatchExpressionArm {
arm_span, source }` there.

Resolves #51632.
2018-07-05 02:35:25 +00:00
Santiago Pastorino
0e31e2fa9b
Remove rustc_mir_borrowck attribute and use rustc_mir instead 2018-07-04 23:10:28 -03:00
csmoe
37228fe632 reverse_postorder 2018-07-05 09:46:10 +08:00
Benjamin Peterson
70a6aeac0d Remove obsolete documentation from FufillmentContext::select comment.
The `only_new_obligations` parameter has not existed since 43756934d2.
2018-07-04 18:25:04 -07:00
bors
b51ca20ce5 Auto merge of #51964 - matthewjasper:unused-mut-mir-generation, r=nikomatsakis
[NLL] Fix various unused mut errors

Closes #51801
Closes #50897
Closes #51830
Closes #51904
cc #51918 - keeping this one open in case there are any more issues

This PR contains multiple changes. List of changes with examples of what they fix:

* Change mir generation so that the parameter variable doesn't get a name when a `ref` pattern is used as an argument
```rust
fn f(ref y: i32) {} // doesn't trigger lint
```
* Change mir generation so that by-move closure captures don't get first moved into a temporary.
```rust
let mut x = 0; // doesn't trigger lint
move || {
    x = 1;
};
```
* Treat generator upvars the same as closure upvars
```rust
let mut x = 0; // This mut is now necessary and is not linted against.
move || {
    x = 1;
    yield;
};
```

r? @nikomatsakis
2018-07-05 00:22:14 +00:00
mark
6556c84e3f Add a link to the rustc docs 2018-07-04 17:24:43 -05:00
Dylan MacKenzie
cf5eaa75bb Move Eq + Hash + Clone bounds to Machine 2018-07-04 14:36:07 -07:00
Dylan MacKenzie
c395044a50 Shorten error message and add link to test
Implements @bjorn3's suggestions.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
0d0e021b1c Derive Eq and Hash for types used in Miri's evaluator 2018-07-04 14:36:07 -07:00
Dylan MacKenzie
b3b04b8cc6 Avoid overflow in step counter
This removes the `usize` argument to `inc_step_counter`. Now, the step
counter increments by exactly one for every terminator evaluated. After
`STEPS_UNTIL_DETECTOR_ENABLED` steps elapse, the detector is run every
`DETECTOR_SNAPSHOT_PERIOD` steps. The step counter is only kept modulo
this period.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
647ba29b90 Explain reason behind error span
We can't expand the span of the error reliably according to @oli-obk, so
just mention why it points to this particular expression.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
d36302da53 Add a UI test for #50637
This test relies on the fact that restrictions on expressions in `const
fn` do not apply when computing array lengths. It is more difficult to
statically analyze than the simple `loop{}` mentioned in #50637.

This test should be updated to ignore the warning after #49980 is resolved.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
10f217159b Rename bloom to hashes 2018-07-04 14:36:07 -07:00
Dylan MacKenzie
c6aea935cf Enable loop detector in step loop
The detector runs every `DETECTOR_SNAPSHOT_PERIOD` steps. Since the
number of steps can increase by more than 1 (I'd like to remove this),
the detector may fail if the step counter is incremented past the
scheduled detection point during the loop.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
f7e9d2ac3e Add an InfiniteLoop variant to EvalErrorKind 2018-07-04 14:36:07 -07:00
Dylan MacKenzie
0f1c61cb7f Improve correctness of Frame and Memory equality
Incorporate a subset of the suggestions from @oli-obk. More to come.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
788c5f3c8b Revert "Refactor EvalContext stack and heap into inner struct"
This reverts commit 59d21c526c036d7097d05edd6dffdad9c5b1cb62, and uses
tuple to store the mutable parts of an EvalContext (which now includes
`Machine`). This requires that `Machine` be `Clone`.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
7f9b01a0fc Add miri infinite loop detection
Use the approach suggested by @oli-obk, a table holding `EvalState`
hashes and a table holding full `EvalState` objects. When a hash
collision is observed, the state is cloned and put into the full
table. If the collision was not spurious, it will be detected during the
next iteration of the infinite loop.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
6c0f502fe6 Implement Clone, Eq and Hash for the heap and stack
I use a pattern binding in each custom impl, so that adding fields to
`Memory` or `Frame` will cause a compiler error instead of causing e.g.
`PartialEq` to become invalid. This may be too cute.

This adds several requirements to `Machine::MemoryData`. These can be
removed if we don't want this associated type to be part of the equality
of `Memory`.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie
db025c14ec Refactor EvalContext stack and heap into inner struct
Change surrounding code to use accessor methods to refer to these fields.
Similar changes have not yet been made in tools/miri
2018-07-04 14:36:07 -07:00
David Wood
f90eada1c9
Improve comments. 2018-07-04 21:48:25 +01:00
David Wood
aeb1682894
Ensure that borrows wind up unactivated. 2018-07-04 21:35:38 +01:00
bors
afaa406465 Auto merge of #51803 - lucasem:rustdoc-code-hash-escape, r=GuillaumeGomez
rustdoc codeblock hash escape

So that docstring text such as the following (in a code block) can be created ergonomically:

```rust
let s = "
    foo
    # bar
    baz
";
```

Such code in a docstring hide the <code>&nbsp;&nbsp;&nbsp;&nbsp;# bar</code> line.

Previously, using two consecutive hashes <code>&nbsp;&nbsp;&nbsp;&nbsp;## bar</code> would turn the line into _shown_ `# bar`, losing the leading whitespace. A line of code like <code>&nbsp;&nbsp;&nbsp;&nbsp;# bar</code> (such as in the example above) **could not be represented** in the docstring text.

This commit makes the two consecutive hashes not also trim the leading whitespace — the two hashes simply **escape** into a single hash and do not hide the line, leaving the rest of that line unaffected. The new docstring text to achieve the above code block is:

```rust
/// ```
/// let s = "
///     foo
///     ## bar
///     baz
/// ";
/// ```
```
2018-07-04 20:21:01 +00:00
Kerollmops
6035534586
Implement Option::replace in the core library 2018-07-04 21:54:45 +02:00
David Wood
7eba13f451
Correctly handle an activation from dead code. 2018-07-04 20:08:15 +01:00
bors
4af9132a02 Auto merge of #51611 - QuietMisdreavus:slippery-macros, r=ollie27
rustdoc: import cross-crate macros alongside everything else

The thrilling conclusion of the cross-crate macro saga in rustdoc! After https://github.com/rust-lang/rust/pull/51425 made sure we saw all the namespaces of an import (and prevented us from losing the `vec!` macro in std's documentation), here is the PR to handle cross-crate macro re-exports at the same time as everything else. This way, attributes like `#[doc(hidden)]` and `#[doc(no_inline)]` can be used to control how the documentation for these macros is seen, rather than rustdoc inlining every macro every time.

Fixes https://github.com/rust-lang/rust/issues/50647
2018-07-04 18:15:14 +00:00
Lucas Morales
ff2ff2b2b8
rustdoc book on codeblock hash escaping 2018-07-04 12:41:45 -04:00
bors
0ad8f9e5b1 Auto merge of #51395 - SimonSapin:repr-transparent, r=SimonSapin
Add #[repr(transparent)] to some libcore types

* `UnsafeCell`
* `Cell`
* `NonZero*`
* `NonNull`
* `Unique`

CC https://github.com/rust-lang/rust/issues/43036
2018-07-04 16:21:42 +00:00
CrLF0710
30063ae2a5
Shorten the line
Shorten the line to make tidy happy.
2018-07-04 23:36:51 +08:00
Aaron Power
dab257f193
Update RELEASES.md 2018-07-04 15:56:18 +01:00
CrLF0710
1dae60ea4c
Include VS 2017 in error message.
Update error prompt message to indicate that VS 2017 is supported (for a while now).
2018-07-04 22:49:35 +08:00
bors
eded1aa14c Auto merge of #51870 - nnethercote:reuse-DefsUsesVisitor, r=nikomatsakis
Reuse the `DefsUsesVisitor` in `simulate_block()`.

This avoids a bunch of allocations for the bitsets within it,
speeding up a number of NLL benchmarks, the best by 1%.

r? @nikomatsakis
2018-07-04 14:12:14 +00:00