Commit Graph

82570 Commits

Author SHA1 Message Date
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
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
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
varkor
6971c5d55d Add some extra edge case tests 2018-08-21 23:55:57 +01:00
bors
1cbf339626 Auto merge of #53439 - GuillaumeGomez:generate-blanket-impls-for-reexported-items, r=QuietMisdreavus
Generate blanket implementations for reexported items as well

Fixes #53374.

r? @QuietMisdreavus
2018-08-21 22:48:21 +00:00
varkor
dec55631d9 Use a boundary method instead of an endpoint method for split_grouped_constructors 2018-08-21 23:27:45 +01:00
Guillaume Gomez
e67bba8ebe Fix missing impl trait display as ret type 2018-08-21 22:40:55 +02:00
bors
d0d81b7fc1 Auto merge of #53471 - petrochenkov:biattr2, r=oli-obk
resolve: Some macro resolution refactoring

Work towards completing https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393

The last commit also fixes https://github.com/rust-lang/rust/issues/53269 by not using `def_id()` on `Def::Err` and also fixes https://github.com/rust-lang/rust/issues/53512.
2018-08-21 20:33:31 +00:00
varkor
6a957e172a Add a test case for u128::MAX - 1 2018-08-21 21:04:19 +01:00
bors
2d6d3acf4f Auto merge of #53444 - varkor:lib_features-conditional, r=michaelwoerister
Only fetch lib_features when there are unknown feature attributes

An attempt to win back some of the performance lost in https://github.com/rust-lang/rust/pull/52644#issuecomment-413761127.

cc @nnethercote
2018-08-21 18:16:43 +00:00
Michal 'vorner' Vaner
18f41e54d9
Suggest direct raw-pointer dereference
People often come looking for some kind of `as_ref_unchecked` method on
raw pointers that would give them `&T` and not `Option<&T>` when they
are sure the pointer is not NULL.

There's no such method, but taking a reference of the dereferenced
pointer accomplishes the same thing. Therefore, suggest using that, at
the `as_ref` site ‒ it's a place people are likely going to look into.
2018-08-21 20:03:54 +02:00
bors
9f9f2c0095 Auto merge of #53530 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests

Successful merges:

 - #53030 (Updated RELEASES.md for 1.29.0)
 - #53104 (expand the documentation on the `Unpin` trait)
 - #53213 (Stabilize IP associated constants)
 - #53296 (When closure with no arguments was expected, suggest wrapping)
 - #53329 (Replace usages of ptr::offset with ptr::{add,sub}.)
 - #53363 (add individual docs to `core::num::NonZero*`)
 - #53370 (Stabilize macro_vis_matcher)
 - #53393 (Mark libserialize functions as inline)
 - #53405 (restore the page title after escaping out of a search)
 - #53452 (Change target triple used to check for lldb in build-manifest)
 - #53462 (Document Box::into_raw returns non-null ptr)
 - #53465 (Remove LinkMeta struct)
 - #53492 (update lld submodule to include RISCV patch)
 - #53496 (Fix typos found by codespell.)
 - #53521 (syntax: Optimize some literal parsing)
 - #53540 (Moved issue-53157.rs into src/test/ui/consts/const-eval/)
 - #53551 (Avoid some Place clones.)

Failed merges:

r? @ghost
2018-08-21 16:04:11 +00:00
kennytm
e3887e6c8a
Rollup merge of #53551 - nnethercote:access_place_error_reported, r=varkor
Avoid some Place clones.

This is a 0.5% speedup on ripgrep.
2018-08-21 22:09:35 +08:00
kennytm
0dd88c9797
Rollup merge of #53329 - frewsxcv:frewsxcv-ptr-add-sub, r=RalfJung
Replace usages of ptr::offset with ptr::{add,sub}.

Rust provides these helper methods – so let's use them!
2018-08-21 22:05:30 +08:00
bors
a9d496796f Auto merge of #53236 - alexreg:stabilise-raw-idents, r=cramertj
Stabilise raw_identifiers feature

* [Reference PR](https://github.com/rust-lang-nursery/reference/pull/395)
* [Book PR](https://github.com/rust-lang/book/pull/1480)
* [Rust by Example PR](https://github.com/rust-lang/rust-by-example/pull/1095)

Closes #48589.

r? @cramertj
CC @cuviper @centril
2018-08-21 13:52:11 +00:00
David Wood
6e24868384
Normalize source line and column numbers.
This commit adds a normalization for line and column numbers in stderr
files where the line/col is from the source directory rather than
the test itself - thereby removing the need to update tests as
compiler source changes.
2018-08-21 12:59:42 +02:00
kennytm
9bbab65ebe
Rollup merge of #53540 - TheDarkula:move-test, r=oli-obk
Moved issue-53157.rs into src/test/ui/consts/const-eval/
2018-08-21 17:52:06 +08:00
kennytm
dc8e9fb2b1
Rollup merge of #53104 - nivkner:unpin_doc, r=RalfJung
expand the documentation on the `Unpin` trait

provides an overview of the Pin API which the trait is for,
and show how it can be used in making self referencial structs

part of #49150
2018-08-21 17:52:01 +08:00
kennytm
fed4298aed
Rollup merge of #53462 - estk:doc-Box_into_raw, r=steveklabnik
Document Box::into_raw returns non-null ptr

Closes  #52806.
2018-08-21 17:51:59 +08:00
kennytm
7896ac3e08
Rollup merge of #53363 - llogiq:num-individual-nonzero-docs, r=steveklabnik
add individual docs to `core::num::NonZero*`
2018-08-21 17:51:54 +08:00
kennytm
445718084f
Rollup merge of #53521 - alexcrichton:optimize-lit-token, r=michaelwoerister
syntax: Optimize some literal parsing

Currently in the `wasm-bindgen` project we have a very very large crate that's
procedurally generated, `web-sys`. To generate this crate we parse all of a
browser's WebIDL and we then generate bindings for all of the APIs contained
within.

The resulting Rust file is 18MB large (wow!) and currently takes a very long
time to compile in debug mode. On the nightly compiler a *debug* build takes 90s
for the crate to finish. I was curious what was taking so long and upon
investigating a *massive* portion of the time was spent in the `lit_token`
method of the compiler, primarily formatting strings via `format!`.

Upon some more investigation it looks like the `byte_str_lit` was allocating an
error message once per byte, causing a very large number of allocations to
happen for large literals, of which wasm-bindgen generates quite a few (some are
MB large).

This commit fixes the issue by lazily allocating the error message, only doing
so if the error message is actually needed (which should be never). As a result,
the debug mode compilation time for our `web-sys` crate decreased from 90s to
20s, a very nice improvement! (although we've still got some work to do).
2018-08-21 17:51:52 +08:00
kennytm
b5519db323
Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkor
Fix typos found by codespell.
2018-08-21 17:51:49 +08:00
kennytm
0834a1aea7
Rollup merge of #53492 - danc86:lld-riscv, r=alexcrichton
update lld submodule to include RISCV patch

This pulls in one new commit, to add support for linking static RISCV
binaries, suitable for the new riscv32imac-unknown-none-elf target.
See: https://github.com/rust-lang/lld/pull/1
2018-08-21 17:51:48 +08:00
kennytm
5d4a25da05
Rollup merge of #53465 - bjorn3:remove_link_meta_struct, r=varkor
Remove LinkMeta struct

Fixes #53291
2018-08-21 17:51:46 +08:00
kennytm
c980ba75fc
Rollup merge of #53452 - tromey:lldb-manifest-fix, r=alexcrichton
Change target triple used to check for lldb in build-manifest

The wrong target triple was used for lldb in build-manifest.  lldb is
only built for macOS, so update the triple to reflect that.

This is an attempt to fix bug#48168.
2018-08-21 17:51:44 +08:00
kennytm
2a0d72075e
Rollup merge of #53405 - oconnor663:search_esc, r=GuillaumeGomez
restore the page title after escaping out of a search

Currently if I start a search in the docs, but then hit ESC, the "Results for..." title is still there in my browser tab. This is a simple attempt to fix that. I see that there's a separate `var previousTitle = document.title` thing happening in `startSearch()`, but as far as I can tell that's only related to the back stack? I'd also appreciate feedback on the right place to declare the `titleBeforeSearch` variable.

Testing-wise, I've confirmed by hand that the tab title restores correctly after building with `./x.py doc --stage 1 src/libstd`, but nothing more involved than that. What else should I test?
2018-08-21 17:51:42 +08:00
kennytm
b21e956f27
Rollup merge of #53393 - BurntPizza:serialize-inlines, r=alexcrichton
Mark libserialize functions as inline

Got to thinking: "what if that big pile of tiny functions isn't inlining as it should?"
So a few `replace-regex` later the local perf run says this:
<details>

![](https://i.imgur.com/gvdJEgG.png)
</details>
Not huge, but still a win, which is interesting. Want to verify with the real perf run, but I understand there's a backlog.

I didn't notice any increase in compile time or binary sizes for rustc/libs.
2018-08-21 17:51:40 +08:00
kennytm
f9e3af7439
Rollup merge of #53370 - jkozlowski:stabilize-macro_vis_matcher, r=cramertj
Stabilize macro_vis_matcher

This PR should stabilize [macro_vis_matcher](https://github.com/rust-lang/rust/issues/41022) feature.

- [ ] "reference" book changes: https://github.com/rust-lang-nursery/reference/pull/400
- [ ] "Rust by example" book changes: https://github.com/rust-lang/rust-by-example/pull/1096
- [ ] "clippy" changes: https://github.com/rust-lang-nursery/rust-clippy/pull/3055

r? @cramertj
2018-08-21 17:51:38 +08:00
Nicholas Nethercote
c0636ab087 Avoid some Place clones.
This is a 0.5% speedup on ripgrep.
2018-08-21 18:06:55 +10:00