Commit Graph

82953 Commits

Author SHA1 Message Date
varkor
04fa5d3adb Remove Ty prefix from Ty{Foreign|Param} 2018-08-22 16:07:55 +01:00
varkor
6f637da50c Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error} 2018-08-22 16:07:44 +01:00
varkor
d37cee3b0e Rename ty::TyVariants to ty::TyKind 2018-08-22 16:05:50 +01:00
varkor
87c7e57020 Rename ty::Slice to ty::List 2018-08-22 16:05:27 +01:00
varkor
3d5fef6f30 Lament the invincibility of the Turbofish 2018-08-22 15:01:03 +01:00
bors
329dde57fd Auto merge of #53524 - alexcrichton:buffer-out, r=eddyb
Buffer LLVM's object output stream

In some profiling on OSX I saw the `write` syscall as quite high up on
the profiling graph, which is definitely not good! It looks like we're
setting the output stream of an object file as directly to a file
descriptor which means that we run the risk of doing lots of little
writes rather than a few large writes.

This commit fixes this issue by adding a buffered stream on the output,
causing the `write` syscall to disappear from the profiles on OSX.
2018-08-22 13:16:32 +00:00
MaloJaffre
f8d5ed47e5 Add a test for issue #53529 2018-08-22 13:15:50 +02:00
MaloJaffre
b85e4cc8fa Fix unsoundness in VecDeque Debug impls
Fixes #53566.
2018-08-22 13:15:50 +02:00
varkor
c9c4f5ef78 Fix a grammatical mistake in "expected generic arguments" errors 2018-08-22 12:15:29 +01:00
bors
674ef668f1 Auto merge of #53424 - RalfJung:miri-refactor, r=oli-obk
CTFE engine refactor

* Value gets renamed to `Operand`, so that now `interpret::{Place, Operand}` are the "dynamic" versions of `mir::{Place, Operand}`.
* `Operand` and `Place` share the data for their "stuff is in memory"-base in a new type, `MemPlace`. This also makes it possible to give some more precise types in other areas. Both `Operand` and `MemPlace` have methods available to project into fields (and other kinds of projections) without causing further allocations.
* The type for "a `Scalar` or a `ScalarPair`" is called `Value`, and again used to give some more precise types.
* All of these have versions with an attached layout, so that we can more often drag the layout along instead of recomputing it. This lets us get rid of `PlaceExtra::Downcast`. `MPlaceTy` and `PlaceTy` can only be constructed in place.rs, making sure the layout is handled properly. (The same should eventually be done for `ValTy` and `OpTy`.)
 This is used to check, when copying an operand to a place, that the sizes match (which caught a bunch of bugs).
* All the high-level functions to write typed memory take a `Place`, and live in `place.rs`. All the high-level typed functions to read typed memory take an `Operand`, and live in `operands.rs`.
* Remove `cur_frame` and handling of signedess from memory (catching a bug in the float casting code).
* [Only functional change] Enable sanity check to recurse below dyn traits and slices.

r? @oli-obk

Cc @eddyb
2018-08-22 11:11:14 +00:00
Ralf Jung
4fec615ebf fix error reporting in validation 2018-08-22 13:08:40 +02:00
Ralf Jung
899bc14cc0 fix validating fat pointers to user-defined unsized types 2018-08-22 13:08:40 +02:00
Ralf Jung
14dc780d89 fix a comment in validity 2018-08-22 13:08:40 +02:00
Ralf Jung
f3e7efc8c1 fix layout sanity check 2018-08-22 13:08:40 +02:00
Ralf Jung
128c634c7f also avoid recomputing the layout for unary and binary ops, where possible 2018-08-22 13:08:40 +02:00
Ralf Jung
54c81ac989 in a Use statement, exploit the fact that type and hence layout are the same for LHS and RHS 2018-08-22 13:08:39 +02:00
Ralf Jung
8ad40479c5 optimize creating a stack frame 2018-08-22 13:08:39 +02:00
Ralf Jung
c3d392f5f5 fix validating fat raw pointers 2018-08-22 13:08:39 +02:00
Ralf Jung
49999e9b1d optimize sanity check path printing
During the sanity check, we keep track of the path we are below in a `Vec`.  We
avoid cloning that `Vec` unless we hit a pointer indirection.  The `String`
representation is only computed when validation actually fails.
2018-08-22 13:08:39 +02:00
Ralf Jung
42a1239a18 avoid some redundant alignment checks 2018-08-22 13:08:39 +02:00
Ralf Jung
e3b4f8e6c7 better error message when using NULL in to_ptr 2018-08-22 13:08:39 +02:00
Ralf Jung
0b8c691f76 fix UI tests 2018-08-22 13:08:39 +02:00
Ralf Jung
956b51f79a optimize validation iterating over the elements of an array
This is still roughly 45ns slower than the old state, because it now works with
an MPlaceTy and uses the appropriate abstractions, instead of working with a
ptr-align pair directly.
2018-08-22 13:08:39 +02:00
Ralf Jung
6f5cf12894 test for detecting bad data inside trait objects / slices 2018-08-22 13:08:39 +02:00
Ralf Jung
ad8deba23a fix formatting nits 2018-08-22 13:08:38 +02:00
Ralf Jung
5099933614 move validation to its own file 2018-08-22 13:08:38 +02:00
bors
71a1ef1816 Auto merge of #53516 - petrochenkov:derregr, r=estebank
resolve: Continue search in outer scopes after applying derive resolution fallback

Fixes https://github.com/rust-lang/rust/issues/53263
2018-08-22 09:03:25 +00:00
MaloJaffre
241b9b45c0 Revert "Auto merge of #52553 - Pazzaz:vecdeque-append, r=SimonSapin"
This partially reverts commit d5b6b95aef,
reversing changes made to 6b1ff19af3.

Fixes #53529.
Cc: #53564.
2018-08-22 10:27:42 +02:00
Aaron Power
f07245c041
Update RELEASES.md 2018-08-22 09:18:34 +01:00
Ralf Jung
f2aeb5b893 fix operator handling when using 128bit intrinsics 2018-08-22 09:06:28 +02:00
Ralf Jung
aa760a5225 finally remove all traces of signs from memory 2018-08-22 09:06:28 +02:00
Ralf Jung
b1df2ae82e fix computing layout when calling virtual fn 2018-08-22 09:06:28 +02:00
Ralf Jung
730098bc8d avoid allocating for ZST 2018-08-22 09:06:28 +02:00
Ralf Jung
ad009ae73b fix using copy_op to transmute 2018-08-22 09:06:28 +02:00
Ralf Jung
23d86b0136 try_read_value_from_ptr -> try_read_value_from_mplace 2018-08-22 09:06:28 +02:00
Ralf Jung
61e7ba15fd fix dynamically determining size and alignment 2018-08-22 09:06:28 +02:00
Ralf Jung
e314a4e75f fix accessing unsized fields 2018-08-22 09:06:28 +02:00
Ralf Jung
1e137a7966 fix drop typing; use same machinery for validating (sanity checking) dyn trait ptrs and slices 2018-08-22 09:06:28 +02:00
Ralf Jung
09b15e9856 fix dropping with vtables 2018-08-22 09:06:28 +02:00
Ralf Jung
e860ab2dab Tweak logging
- The logging in step.rs becomes debug! to make it stand out a bit more
- Dump value of operands (in `eval_operands`)
- Try to log a bit less verbose
2018-08-22 09:06:28 +02:00
Ralf Jung
0807ad19ef fix union field access and DST computations and dumping of places 2018-08-22 09:06:28 +02:00
Ralf Jung
689c71193a remove cur_frame from memory (validation is gone, new validation will not need it) 2018-08-22 09:06:28 +02:00
Ralf Jung
7483ea8176 generalize truncate and sign_extend to take a Size 2018-08-22 09:06:28 +02:00
Ralf Jung
ad2de8b4ee miri/CTFE refactor
* Value gets renamed to Operand, so that now interpret::{Place, Operand} are the
  "dynamic" versions of mir::{Place, Operand}.
* Operand and Place share the data for their "stuff is in memory"-base in a new
  type, MemPlace.  This also makes it possible to give some more precise types
  in other areas.  Both Operand and MemPlace have methods available to project
  into fields (and other kinds of projections) without causing further
  allocations.
* The type for "a Scalar or a ScalarPair" is called Value, and again used to
  give some more precise types.
* All of these have versions with an attached layout, so that we can more often
  drag the layout along instead of recomputing it.  This lets us get rid of
  `PlaceExtra::Downcast`.  MPlaceTy and PlaceTy can only be constructed
  in place.rs, making sure the layout is handled properly.
  (The same should eventually be done for ValTy and OpTy.)
* All the high-level functions to write typed memory take a Place, and live in
  place.rs.  All the high-level typed functions to read typed memory take an
  Operand, and live in operands.rs.
2018-08-22 09:06:28 +02:00
bors
24bc544db4 Auto merge of #53509 - petrochenkov:wildregr, r=alexcrichton
resolve: Reject some inaccessible candidates sooner during import resolution

This allows import resolution to progress in cases like #53140

Fixes #53140
2018-08-22 06:54:22 +00:00
Ralf Jung
7d4f5f7974 Move some value-and-memory related things out of eval_context 2018-08-22 08:50:46 +02:00
Matthias Krüger
11f3918ca2 docs: std::string::String.repeat(): slightly rephrase to be more in-line with other descriptions.
add ticks around a few keywords in other descriptions.
2018-08-22 08:35:34 +02:00
bors
786ccc336d Auto merge of #53477 - ftilde:exec-rust-gdb-lldb, r=michaelwoerister
Exec gdb/lldb in rust-{gdb/lldb} wrapper scripts

This way, the process we get by executing `rust-gdb` or `rust-lldb` (eventually) is an actual `gdb` or `lldb` process and behaves accordingly. Previously (and at least to me unexpectedly) it was just a script waiting for the debugger to exit. Sending a signal (e.g. SIGINT) to the spawned process did therefore not affect the debugger process (which was just a child of the wrapper script).

In order to work around that we `exec` (according to [this](http://pubs.opengroup.org/onlinepubs/009695399/utilities/exec.html) part of the posix shell) and replace the script process with the debugger in the last line of the script. The lldb script had to be modified to not pass the configuration commands via a script file (which in my opinion is cleaner anyway).
2018-08-22 03:01:14 +00:00
David Tolnay
cf1b6d6fe8
Remove super old comment on function that parses items
This comment was added more than 5 years ago in ab03c1e422. As far as
anyone reading this comment today needs to know, the function has never
parsed items from inside an extern crate.
2018-08-21 21:50:34 -04:00
bors
a79cffb8b8 Auto merge of #50912 - varkor:exhaustive-integer-matching, r=arielb1
Exhaustive integer matching

This adds a new feature flag `exhaustive_integer_patterns` that enables exhaustive matching of integer types by their values. For example, the following is now accepted:
```rust
#![feature(exhaustive_integer_patterns)]
#![feature(exclusive_range_pattern)]

fn matcher(x: u8) {
  match x { // ok
    0 .. 32 => { /* foo */ }
    32 => { /* bar */ }
    33 ..= 255 => { /* baz */ }
  }
}
```
This matching is permitted on all integer (signed/unsigned and char) types. Sensible error messages are also provided. For example:
```rust
fn matcher(x: u8) {
  match x { //~ ERROR
    0 .. 32 => { /* foo */ }
  }
}
```
results in:
```
error[E0004]: non-exhaustive patterns: `32u8...255u8` not covered
 --> matches.rs:3:9
  |
6 |   match x {
  |         ^ pattern `32u8...255u8` not covered
```

This implements https://github.com/rust-lang/rfcs/issues/1550 for https://github.com/rust-lang/rust/issues/50907. While there hasn't been a full RFC for this feature, it was suggested that this might be a feature that obviously complements the existing exhaustiveness checks (e.g. for `bool`) and so a feature gate would be sufficient for now.
2018-08-22 00:57:00 +00:00