]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #53638 - flip1995:clippy, r=nrc
bors [Thu, 23 Aug 2018 22:52:29 +0000 (22:52 +0000)]
Auto merge of #53638 - flip1995:clippy, r=nrc

Update clippy

r? @oli-obk @Manishearth

5 years agoUpdate clippy again
flip1995 [Thu, 23 Aug 2018 21:31:55 +0000 (23:31 +0200)]
Update clippy again

5 years agoAuto merge of #53588 - tristanburgess:52985_diagnostics_no_concrete_type_behind_exist...
bors [Thu, 23 Aug 2018 20:34:12 +0000 (20:34 +0000)]
Auto merge of #53588 - tristanburgess:52985_diagnostics_no_concrete_type_behind_existential_type, r=oli-obk

52985 diagnostics no concrete type behind existential type

@oli-obk FYI. See below for new cycle error generated.

```rust
error[E0391]: cycle detected when processing `Foo`
 --> /dev/staging/existential_type_no_concrete_type_nouse_potential.rs:3:1
  |
3 | existential type Foo: Copy;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: ...which requires processing `bar`...
 --> /dev/staging/existential_type_no_concrete_type_nouse_potential.rs:6:23
  |
6 |   fn bar(x: Foo) -> Foo {
  |  _______________________^
7 | |     x
8 | | }
  | |_^
  = note: ...which again requires processing `Foo`, completing the cycle

error: aborting due to previous error

For more information about this error, try `rustc --explain E0391`.
```

5 years agoAuto merge of #53571 - MaloJaffre:vecdeque-emergency, r=RalfJung
bors [Thu, 23 Aug 2018 17:13:44 +0000 (17:13 +0000)]
Auto merge of #53571 - MaloJaffre:vecdeque-emergency, r=RalfJung

Fix unsoundness for VecDeque

 See individual commit for more details.

r? @RalfJung.

Fixes https://github.com/rust-lang/rust/issues/53566, fixes https://github.com/rust-lang/rust/issues/53529

5 years agoAuto merge of #53384 - gootorov:use-servo-smallvec, r=michaelwoerister
bors [Thu, 23 Aug 2018 14:40:22 +0000 (14:40 +0000)]
Auto merge of #53384 - gootorov:use-servo-smallvec, r=michaelwoerister

Use optimized SmallVec implementation

This PR replaces current SmallVec implementation with the one from the Servo project.

Closes https://github.com/rust-lang/rust/issues/51640

r? @Mark-Simulacrum

5 years agoUpdate clippy
flip1995 [Thu, 23 Aug 2018 14:00:04 +0000 (16:00 +0200)]
Update clippy

5 years agoAuto merge of #52602 - scottmcm:tryblock-expr, r=nikomatsakis
bors [Thu, 23 Aug 2018 11:46:24 +0000 (11:46 +0000)]
Auto merge of #52602 - scottmcm:tryblock-expr, r=nikomatsakis

Implement try block expressions

I noticed that `try` wasn't a keyword yet in Rust 2018, so...

~~Fix​es https://github.com/rust-lang/rust/issues/52604~~ That was fixed by PR https://github.com/rust-lang/rust/pull/53135
cc https://github.com/rust-lang/rust/issues/31436 https://github.com/rust-lang/rust/issues/50412

5 years agoAuto merge of #53459 - petrochenkov:stabmore, r=nrc
bors [Thu, 23 Aug 2018 08:38:22 +0000 (08:38 +0000)]
Auto merge of #53459 - petrochenkov:stabmore, r=nrc

Stabilize a few secondary macro features

- `tool_attributes` - closes https://github.com/rust-lang/rust/issues/44690
- `proc_macro_path_invoc` - this feature was created due to issues with tool attributes (https://github.com/rust-lang/rust/issues/51277), those issues are now fixed (https://github.com/rust-lang/rust/pull/52841)
- partially `proc_macro_gen` - this feature was created due to issue https://github.com/rust-lang/rust/issues/50504, the issue is now fixed (https://github.com/rust-lang/rust/pull/51952), so proc macros can generate modules. They still can't generate `macro_rules` items though due to unclear hygiene interactions.

5 years agoUse optimized SmallVec implementation
Igor Gutorov [Mon, 13 Aug 2018 19:15:16 +0000 (22:15 +0300)]
Use optimized SmallVec implementation

5 years agoAuto merge of #53235 - varkor:gat_impl_where, r=estebank
bors [Thu, 23 Aug 2018 06:34:11 +0000 (06:34 +0000)]
Auto merge of #53235 - varkor:gat_impl_where, r=estebank

Feature gate where clauses on associated type impls

Fixes #52913. This doesn't address the core problem, which is tracked by https://github.com/rust-lang/rust/issues/47206. However, it fixes the stable-to-stable regression: you now have to enable `#![feature(generic_associated_types)]` to trigger the weird behaviour.

5 years agoAuto merge of #53520 - nnethercote:merge-IdxSet-IdxSetBuf, r=nikomatsakis
bors [Thu, 23 Aug 2018 02:54:24 +0000 (02:54 +0000)]
Auto merge of #53520 - nnethercote:merge-IdxSet-IdxSetBuf, r=nikomatsakis

Merge `IdxSet` and `IdxSetBuf`

Because it simplifies things.

@r? nikomatsakis

5 years ago52985: formatting PR files
Tristan Burgess [Wed, 22 Aug 2018 04:24:03 +0000 (00:24 -0400)]
52985: formatting PR files

5 years ago52985: better cycle error for existential types
Tristan Burgess [Wed, 22 Aug 2018 04:02:07 +0000 (00:02 -0400)]
52985: better cycle error for existential types
  - Original cycle error diagnostics PR'd against this issue caught
panic-causing error while resolving std::mem::transmute calls
  - Now, catch invalid use case of not providing a concrete sized type
behind existential type in definining use case.
  - Update relevant test to reflect this new error

52985: revert normalize query changes
      - PR 53588 invalidates 53316, causing a correct cycle error to occur
    with a good span.
      - Don't need to revert the whole merge as the test files are
    still fine, just need to revert the normalize query changes.
      - It should now be correct that infinite recursion detected during
    normalize query type folding is a bug, should have been caught earlier
    (when resolving the existential type's defining use cases).

52985: code review impl
  - Only cause cycle error if anonymous type resolves to anonymous type
that has the same def id (is the same type) as the original (parent)
type.
  - Add test case to cover this case for existential types.

52985: remove Ty prefix from TyAnon
  - To align with changes per commit 6f637da50c56a22f745fd056691da8c86824cd9b

5 years agoStabilize a few secondary macro features
Vadim Petrochenkov [Fri, 17 Aug 2018 21:52:34 +0000 (00:52 +0300)]
Stabilize a few secondary macro features

`tool_attributes`, `proc_macro_path_invoc`, partially `proc_macro_gen`

5 years agoAuto merge of #52011 - oli-obk:dont_you_hate_it_too_when_everything_panics_constantly...
bors [Wed, 22 Aug 2018 22:08:03 +0000 (22:08 +0000)]
Auto merge of #52011 - oli-obk:dont_you_hate_it_too_when_everything_panics_constantly, r=eddyb

Allow panicking with string literal messages inside constants

r? @eddyb

cc https://github.com/rust-lang/rust/issues/51999

we can't implement things like `panic!("foo: {}", x)` right now because we can't call trait methods (most notably `Display::fmt`) inside constants. Also most of these impls probably have loops and conditions, so it's messy anyway.

But hey `panic!("foo")` works at least.

cc @japaric got any test ideas for `#![no_std]`?

5 years agoAuto merge of #53607 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Wed, 22 Aug 2018 19:59:52 +0000 (19:59 +0000)]
Auto merge of #53607 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 10 pull requests

Successful merges:

 - #53418 (Mark some suggestions as MachineApplicable)
 - #53431 (Moved some feature gate ui tests to correct location)
 - #53442 (Update version of rls-data used with save-analysis)
 - #53504 (Set applicability for more suggestions.)
 - #53541 (Fix missing impl trait display as ret type)
 - #53544 (Point at the trait argument when using unboxed closure)
 - #53558 (Normalize source line and column numbers.)
 - #53562 (Lament the invincibility of the Turbofish)
 - #53574 (Suggest direct raw-pointer dereference)
 - #53585 (Remove super old comment on function that parses items)

Failed merges:

 - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.)
 - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into())

r? @ghost

5 years agoAuto merge of #53581 - varkor:tyvariants-rename, r=eddyb
bors [Wed, 22 Aug 2018 17:43:44 +0000 (17:43 +0000)]
Auto merge of #53581 - varkor:tyvariants-rename, r=eddyb

Rename TyVariants and variants

- Rename `TypeVariants` to `TyKind`.
- Remove the `Ty` prefix from each one of its variants (plus the identically-named variants of `PrimTy`).
- Rename `ty::Slice` to `ty::List`.

The new names look cleaner.

r? @eddyb

5 years agoReexpose stability hole in the presence of feature gates
Oliver Schneider [Mon, 13 Aug 2018 12:27:29 +0000 (14:27 +0200)]
Reexpose stability hole in the presence of feature gates

5 years agoAllow panicking with string literal messages inside constants
Oliver Schneider [Mon, 13 Aug 2018 11:48:47 +0000 (13:48 +0200)]
Allow panicking with string literal messages inside constants

5 years agoRollup merge of #53585 - dtolnay:comment, r=Mark-Simulacrum
Guillaume Gomez [Wed, 22 Aug 2018 15:45:43 +0000 (17:45 +0200)]
Rollup merge of #53585 - dtolnay:comment, r=Mark-Simulacrum

Remove super old comment on function that parses items

This comment was added more than 5 years ago in ab03c1e4221. As far as anyone reading this comment today needs to know, the function has never parsed items from inside an extern crate.

5 years agoRollup merge of #53574 - vorner:ptr_as_ref_unchecked, r=Mark-Simulacrum
Guillaume Gomez [Wed, 22 Aug 2018 15:45:41 +0000 (17:45 +0200)]
Rollup merge of #53574 - vorner:ptr_as_ref_unchecked, r=Mark-Simulacrum

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.

5 years agoRollup merge of #53562 - varkor:bastion-of-the-turbofish, r=nagisa
Guillaume Gomez [Wed, 22 Aug 2018 15:45:39 +0000 (17:45 +0200)]
Rollup merge of #53562 - varkor:bastion-of-the-turbofish, r=nagisa

Lament the invincibility of the Turbofish

Here a test case is added to ensure that any others attempting to drive the Turbofish to extinction have second thoughts. Previously the [entire test suite would succeed](https://github.com/rust-lang/rust/pull/53511) if generic arguments were accepted without disambiguation, making for [confusing and heartbreaking circumstances](https://github.com/rust-lang/rfcs/pull/2527).

5 years agoRollup merge of #53558 - davidtwco:issue-53547, r=estebank
Guillaume Gomez [Wed, 22 Aug 2018 15:45:38 +0000 (17:45 +0200)]
Rollup merge of #53558 - davidtwco:issue-53547, r=estebank

Normalize source line and column numbers.

Fixes #53547.

r? @eddyb

5 years agoRollup merge of #53544 - estebank:issue-53534, r=varkor
Guillaume Gomez [Wed, 22 Aug 2018 15:45:37 +0000 (17:45 +0200)]
Rollup merge of #53544 - estebank:issue-53534, r=varkor

Point at the trait argument when using unboxed closure

Fix #53534.

r? @varkor

5 years agoRollup merge of #53541 - GuillaumeGomez:fix-impl-trait-ret-type, r=oli-obk
Guillaume Gomez [Wed, 22 Aug 2018 15:45:36 +0000 (17:45 +0200)]
Rollup merge of #53541 - GuillaumeGomez:fix-impl-trait-ret-type, r=oli-obk

Fix missing impl trait display as ret type

I need to convert a `TraitPredicate` into a `TraitBound` to get the returned impl trait. So far, didn't find how or even if it was the good way to do it.

cc @eddyb @oli-obk (since you're the one behind the change apparently πŸ˜‰)

5 years agoRollup merge of #53504 - ekse:suggestions-applicability-2, r=estebank
Guillaume Gomez [Wed, 22 Aug 2018 15:45:34 +0000 (17:45 +0200)]
Rollup merge of #53504 - ekse:suggestions-applicability-2, r=estebank

Set applicability for more suggestions.

Converts a couple more calls to `span_suggestion_with_applicability`  (#50723). To be on the safe side, I marked suggestions that depend on the intent of the user or that are potentially lossy conversions as MaybeIncorrect.

r? @estebank

5 years agoRollup merge of #53442 - staktrace:rlsbump, r=nrc
Guillaume Gomez [Wed, 22 Aug 2018 15:45:32 +0000 (17:45 +0200)]
Rollup merge of #53442 - staktrace:rlsbump, r=nrc

Update version of rls-data used with save-analysis

This part 1/3 for fixing rust-lang/rust#53440.

5 years agoRollup merge of #53431 - alexreg:move-feature-gate-tests, r=cramertj
Guillaume Gomez [Wed, 22 Aug 2018 15:45:31 +0000 (17:45 +0200)]
Rollup merge of #53431 - alexreg:move-feature-gate-tests, r=cramertj

Moved some feature gate ui tests to correct location

None

5 years agoRollup merge of #53418 - ekse:suggestions-applicability, r=estebank
Guillaume Gomez [Wed, 22 Aug 2018 15:45:29 +0000 (17:45 +0200)]
Rollup merge of #53418 - ekse:suggestions-applicability, r=estebank

Mark some suggestions as MachineApplicable

I think the following suggestions should be safe to mark as `MachineApplicable`.

r? @estebank

5 years agoAuto merge of #53536 - RalfJung:array-drop, r=eddyb
bors [Wed, 22 Aug 2018 15:29:07 +0000 (15:29 +0000)]
Auto merge of #53536 - RalfJung:array-drop, r=eddyb

fix array drop glue: properly turn raw ptr into reference

Discovered while working on https://github.com/rust-lang/rust/pull/53424: The generated drop glue uses an assignment `ptr = cur` where `ptr` is a reference and `cur` a raw pointer. This is not well-formed MIR.

Do we have MIR sanity checks that run on the drop glue and should have caught this?

r? @eddyb

5 years agoFix rebase issues
varkor [Wed, 22 Aug 2018 10:54:46 +0000 (11:54 +0100)]
Fix rebase issues

5 years agoReplace TyForeign with ForeignTy
varkor [Wed, 22 Aug 2018 10:47:31 +0000 (11:47 +0100)]
Replace TyForeign with ForeignTy

5 years agoRename Def::{Param, Foreign} to Def::{TyParam, TyForeign}
varkor [Wed, 22 Aug 2018 01:13:31 +0000 (02:13 +0100)]
Rename Def::{Param, Foreign} to Def::{TyParam, TyForeign}

5 years agoRemove unnecessary TyKind::s
varkor [Wed, 22 Aug 2018 01:08:01 +0000 (02:08 +0100)]
Remove unnecessary TyKind::s

5 years agoRemove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str}
varkor [Wed, 22 Aug 2018 00:35:55 +0000 (01:35 +0100)]
Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str}

5 years agoRemove Ty prefix from Ty{Foreign|Param}
varkor [Wed, 22 Aug 2018 00:35:29 +0000 (01:35 +0100)]
Remove Ty prefix from Ty{Foreign|Param}

5 years agoRemove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Gener...
varkor [Wed, 22 Aug 2018 00:35:02 +0000 (01:35 +0100)]
Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}

5 years agoRename ty::TyVariants to ty::TyKind
varkor [Wed, 22 Aug 2018 00:34:12 +0000 (01:34 +0100)]
Rename ty::TyVariants to ty::TyKind

5 years agoRename ty::Slice to ty::List
varkor [Tue, 21 Aug 2018 23:35:01 +0000 (00:35 +0100)]
Rename ty::Slice to ty::List

5 years agoLament the invincibility of the Turbofish
varkor [Tue, 21 Aug 2018 13:44:36 +0000 (14:44 +0100)]
Lament the invincibility of the Turbofish

5 years agoAuto merge of #53524 - alexcrichton:buffer-out, r=eddyb
bors [Wed, 22 Aug 2018 13:16:32 +0000 (13:16 +0000)]
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.

5 years agoAdd a test for issue #53529
MaloJaffre [Wed, 22 Aug 2018 08:22:21 +0000 (10:22 +0200)]
Add a test for issue #53529

5 years agoFix unsoundness in VecDeque Debug impls
MaloJaffre [Tue, 21 Aug 2018 17:50:05 +0000 (19:50 +0200)]
Fix unsoundness in VecDeque Debug impls

Fixes #53566.

5 years agoAuto merge of #53424 - RalfJung:miri-refactor, r=oli-obk
bors [Wed, 22 Aug 2018 11:11:14 +0000 (11:11 +0000)]
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

5 years agofix error reporting in validation
Ralf Jung [Wed, 22 Aug 2018 10:02:09 +0000 (12:02 +0200)]
fix error reporting in validation

5 years agofix validating fat pointers to user-defined unsized types
Ralf Jung [Wed, 22 Aug 2018 09:27:38 +0000 (11:27 +0200)]
fix validating fat pointers to user-defined unsized types

5 years agofix a comment in validity
Ralf Jung [Mon, 20 Aug 2018 20:39:08 +0000 (22:39 +0200)]
fix a comment in validity

5 years agofix layout sanity check
Ralf Jung [Mon, 20 Aug 2018 18:08:37 +0000 (20:08 +0200)]
fix layout sanity check

5 years agoalso avoid recomputing the layout for unary and binary ops, where possible
Ralf Jung [Mon, 20 Aug 2018 18:08:24 +0000 (20:08 +0200)]
also avoid recomputing the layout for unary and binary ops, where possible

5 years agoin a Use statement, exploit the fact that type and hence layout are the same for...
Ralf Jung [Mon, 20 Aug 2018 13:21:04 +0000 (15:21 +0200)]
in a Use statement, exploit the fact that type and hence layout are the same for LHS and RHS

5 years agooptimize creating a stack frame
Ralf Jung [Sun, 19 Aug 2018 15:01:31 +0000 (17:01 +0200)]
optimize creating a stack frame

5 years agofix validating fat raw pointers
Ralf Jung [Sun, 19 Aug 2018 10:03:58 +0000 (12:03 +0200)]
fix validating fat raw pointers

5 years agooptimize sanity check path printing
Ralf Jung [Sat, 18 Aug 2018 11:46:52 +0000 (13:46 +0200)]
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.

5 years agoavoid some redundant alignment checks
Ralf Jung [Sat, 18 Aug 2018 09:53:15 +0000 (11:53 +0200)]
avoid some redundant alignment checks

5 years agobetter error message when using NULL in to_ptr
Ralf Jung [Sat, 18 Aug 2018 09:11:40 +0000 (11:11 +0200)]
better error message when using NULL in to_ptr

5 years agofix UI tests
Ralf Jung [Fri, 17 Aug 2018 19:25:59 +0000 (21:25 +0200)]
fix UI tests

5 years agooptimize validation iterating over the elements of an array
Ralf Jung [Fri, 17 Aug 2018 15:47:37 +0000 (17:47 +0200)]
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.

5 years agotest for detecting bad data inside trait objects / slices
Ralf Jung [Fri, 17 Aug 2018 10:39:36 +0000 (12:39 +0200)]
test for detecting bad data inside trait objects / slices

5 years agofix formatting nits
Ralf Jung [Fri, 17 Aug 2018 10:31:50 +0000 (12:31 +0200)]
fix formatting nits

5 years agomove validation to its own file
Ralf Jung [Fri, 17 Aug 2018 10:18:02 +0000 (12:18 +0200)]
move validation to its own file

5 years agoAuto merge of #53516 - petrochenkov:derregr, r=estebank
bors [Wed, 22 Aug 2018 09:03:25 +0000 (09:03 +0000)]
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

5 years agoRevert "Auto merge of #52553 - Pazzaz:vecdeque-append, r=SimonSapin"
MaloJaffre [Wed, 22 Aug 2018 07:06:24 +0000 (09:06 +0200)]
Revert "Auto merge of #52553 - Pazzaz:vecdeque-append, r=SimonSapin"

This partially reverts commit d5b6b95aef94169b5dbe4dbb1357d4bab1fc9800,
reversing changes made to 6b1ff19af36f7bbf1974579ec1b9bf2c8ccd595e.

Fixes #53529.
Cc: #53564.
5 years agofix operator handling when using 128bit intrinsics
Ralf Jung [Thu, 16 Aug 2018 15:41:19 +0000 (17:41 +0200)]
fix operator handling when using 128bit intrinsics

5 years agofinally remove all traces of signs from memory
Ralf Jung [Thu, 16 Aug 2018 09:38:16 +0000 (11:38 +0200)]
finally remove all traces of signs from memory

5 years agofix computing layout when calling virtual fn
Ralf Jung [Thu, 16 Aug 2018 08:30:56 +0000 (10:30 +0200)]
fix computing layout when calling virtual fn

5 years agoavoid allocating for ZST
Ralf Jung [Thu, 16 Aug 2018 07:36:53 +0000 (09:36 +0200)]
avoid allocating for ZST

5 years agofix using copy_op to transmute
Ralf Jung [Thu, 16 Aug 2018 07:36:44 +0000 (09:36 +0200)]
fix using copy_op to transmute

5 years agotry_read_value_from_ptr -> try_read_value_from_mplace
Ralf Jung [Thu, 16 Aug 2018 07:36:25 +0000 (09:36 +0200)]
try_read_value_from_ptr -> try_read_value_from_mplace

5 years agofix dynamically determining size and alignment
Ralf Jung [Thu, 16 Aug 2018 07:05:01 +0000 (09:05 +0200)]
fix dynamically determining size and alignment

5 years agofix accessing unsized fields
Ralf Jung [Wed, 15 Aug 2018 22:41:26 +0000 (00:41 +0200)]
fix accessing unsized fields

5 years agofix drop typing; use same machinery for validating (sanity checking) dyn trait ptrs...
Ralf Jung [Wed, 15 Aug 2018 22:18:09 +0000 (00:18 +0200)]
fix drop typing; use same machinery for validating (sanity checking) dyn trait ptrs and slices

5 years agofix dropping with vtables
Ralf Jung [Wed, 15 Aug 2018 20:39:39 +0000 (22:39 +0200)]
fix dropping with vtables

5 years agoTweak logging
Ralf Jung [Wed, 15 Aug 2018 18:18:40 +0000 (20:18 +0200)]
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

5 years agofix union field access and DST computations and dumping of places
Ralf Jung [Wed, 15 Aug 2018 18:22:28 +0000 (20:22 +0200)]
fix union field access and DST computations and dumping of places

5 years agoremove cur_frame from memory (validation is gone, new validation will not need it)
Ralf Jung [Wed, 15 Aug 2018 18:21:59 +0000 (20:21 +0200)]
remove cur_frame from memory (validation is gone, new validation will not need it)

5 years agogeneralize truncate and sign_extend to take a Size
Ralf Jung [Tue, 14 Aug 2018 18:38:30 +0000 (20:38 +0200)]
generalize truncate and sign_extend to take a Size

5 years agomiri/CTFE refactor
Ralf Jung [Mon, 13 Aug 2018 14:14:22 +0000 (16:14 +0200)]
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.

5 years agoAuto merge of #53509 - petrochenkov:wildregr, r=alexcrichton
bors [Wed, 22 Aug 2018 06:54:22 +0000 (06:54 +0000)]
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

5 years agoMove some value-and-memory related things out of eval_context
Ralf Jung [Thu, 9 Aug 2018 13:04:53 +0000 (15:04 +0200)]
Move some value-and-memory related things out of eval_context

5 years agoAuto merge of #53477 - ftilde:exec-rust-gdb-lldb, r=michaelwoerister
bors [Wed, 22 Aug 2018 03:01:14 +0000 (03:01 +0000)]
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).

5 years agoRemove super old comment on function that parses items
David Tolnay [Wed, 22 Aug 2018 01:46:56 +0000 (21:46 -0400)]
Remove super old comment on function that parses items

This comment was added more than 5 years ago in ab03c1e4221. As far as
anyone reading this comment today needs to know, the function has never
parsed items from inside an extern crate.

5 years agoAuto merge of #50912 - varkor:exhaustive-integer-matching, r=arielb1
bors [Wed, 22 Aug 2018 00:57:00 +0000 (00:57 +0000)]
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.

5 years agoAdd some extra edge case tests
varkor [Tue, 21 Aug 2018 22:55:57 +0000 (23:55 +0100)]
Add some extra edge case tests

5 years agoAuto merge of #53439 - GuillaumeGomez:generate-blanket-impls-for-reexported-items...
bors [Tue, 21 Aug 2018 22:48:21 +0000 (22:48 +0000)]
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

5 years agoUse a boundary method instead of an endpoint method for split_grouped_constructors
varkor [Tue, 21 Aug 2018 22:27:45 +0000 (23:27 +0100)]
Use a boundary method instead of an endpoint method for split_grouped_constructors

5 years agoFix missing impl trait display as ret type
Guillaume Gomez [Mon, 20 Aug 2018 22:43:02 +0000 (00:43 +0200)]
Fix missing impl trait display as ret type

5 years agoAuto merge of #53471 - petrochenkov:biattr2, r=oli-obk
bors [Tue, 21 Aug 2018 20:33:31 +0000 (20:33 +0000)]
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.

5 years agoAdd a test case for u128::MAX - 1
varkor [Tue, 21 Aug 2018 20:04:19 +0000 (21:04 +0100)]
Add a test case for u128::MAX - 1

5 years agoAuto merge of #53444 - varkor:lib_features-conditional, r=michaelwoerister
bors [Tue, 21 Aug 2018 18:16:43 +0000 (18:16 +0000)]
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

5 years agoSuggest direct raw-pointer dereference
Michal 'vorner' Vaner [Tue, 21 Aug 2018 17:57:59 +0000 (19:57 +0200)]
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.

5 years agoAuto merge of #53530 - kennytm:rollup, r=kennytm
bors [Tue, 21 Aug 2018 16:04:11 +0000 (16:04 +0000)]
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

5 years agoRollup merge of #53551 - nnethercote:access_place_error_reported, r=varkor
kennytm [Tue, 21 Aug 2018 14:09:35 +0000 (22:09 +0800)]
Rollup merge of #53551 - nnethercote:access_place_error_reported, r=varkor

Avoid some Place clones.

This is a 0.5% speedup on ripgrep.

5 years agoRollup merge of #53329 - frewsxcv:frewsxcv-ptr-add-sub, r=RalfJung
kennytm [Tue, 21 Aug 2018 14:05:30 +0000 (22:05 +0800)]
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!

5 years agoAuto merge of #53236 - alexreg:stabilise-raw-idents, r=cramertj
bors [Tue, 21 Aug 2018 13:52:11 +0000 (13:52 +0000)]
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

5 years agoNormalize source line and column numbers.
David Wood [Tue, 21 Aug 2018 10:57:11 +0000 (12:57 +0200)]
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.

5 years agoRollup merge of #53540 - TheDarkula:move-test, r=oli-obk
kennytm [Tue, 21 Aug 2018 09:48:45 +0000 (17:48 +0800)]
Rollup merge of #53540 - TheDarkula:move-test, r=oli-obk

Moved issue-53157.rs into src/test/ui/consts/const-eval/

5 years agoRollup merge of #53104 - nivkner:unpin_doc, r=RalfJung
kennytm [Tue, 21 Aug 2018 09:47:29 +0000 (17:47 +0800)]
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

5 years agoRollup merge of #53462 - estk:doc-Box_into_raw, r=steveklabnik
kennytm [Tue, 21 Aug 2018 03:09:03 +0000 (11:09 +0800)]
Rollup merge of #53462 - estk:doc-Box_into_raw, r=steveklabnik

Document Box::into_raw returns non-null ptr

Closes  #52806.

5 years agoRollup merge of #53363 - llogiq:num-individual-nonzero-docs, r=steveklabnik
kennytm [Tue, 21 Aug 2018 03:08:28 +0000 (11:08 +0800)]
Rollup merge of #53363 - llogiq:num-individual-nonzero-docs, r=steveklabnik

add individual docs to `core::num::NonZero*`

5 years agoRollup merge of #53521 - alexcrichton:optimize-lit-token, r=michaelwoerister
kennytm [Tue, 21 Aug 2018 03:07:45 +0000 (11:07 +0800)]
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).