Commit Graph

82570 Commits

Author SHA1 Message Date
Jorge Aparicio
ca03f86aad fix tidy 2018-08-23 20:58:55 +02:00
Jorge Aparicio
a774c81f98 add #[panic_handler]; deprecate #[panic_implementation] 2018-08-23 20:58:55 +02:00
bors
e5284b0b57 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
2018-08-23 14:40:22 +00:00
bors
35bf1ae257 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
2018-08-23 11:46:24 +00:00
bors
827e57c2f6 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.
2018-08-23 08:38:22 +00:00
Igor Gutorov
4d81fe9243 Use optimized SmallVec implementation 2018-08-23 10:45:53 +03:00
bors
c648b0bb2b 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.
2018-08-23 06:34:11 +00:00
bors
e73077e106 Auto merge of #53520 - nnethercote:merge-IdxSet-IdxSetBuf, r=nikomatsakis
Merge `IdxSet` and `IdxSetBuf`

Because it simplifies things.

@r? nikomatsakis
2018-08-23 02:54:24 +00:00
Vadim Petrochenkov
b34503e60e Stabilize a few secondary macro features
`tool_attributes`, `proc_macro_path_invoc`, partially `proc_macro_gen`
2018-08-23 01:13:17 +03:00
bors
917945d662 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]`?
2018-08-22 22:08:03 +00:00
bors
f1b506af02 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
2018-08-22 19:59:52 +00:00
bors
b75b0471a8 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
2018-08-22 17:43:44 +00:00
Oliver Schneider
bd6ae6a6d1 Reexpose stability hole in the presence of feature gates 2018-08-22 18:31:53 +02:00
Oliver Schneider
bb78426ca8 Allow panicking with string literal messages inside constants 2018-08-22 18:28:57 +02:00
Guillaume Gomez
f012b4c84e
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 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-22 17:45:43 +02:00
Guillaume Gomez
4f78a2d58f
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.
2018-08-22 17:45:41 +02:00
Guillaume Gomez
ef4b2edbd7
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).
2018-08-22 17:45:39 +02:00
Guillaume Gomez
95bdc6589b
Rollup merge of #53558 - davidtwco:issue-53547, r=estebank
Normalize source line and column numbers.

Fixes #53547.

r? @eddyb
2018-08-22 17:45:38 +02:00
Guillaume Gomez
e53a575ddb
Rollup merge of #53544 - estebank:issue-53534, r=varkor
Point at the trait argument when using unboxed closure

Fix #53534.

r? @varkor
2018-08-22 17:45:37 +02:00
Guillaume Gomez
3d8e760bf8
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 😉)
2018-08-22 17:45:36 +02:00
Guillaume Gomez
4fa4bb5633
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
2018-08-22 17:45:34 +02:00
Guillaume Gomez
55d98236f9
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.
2018-08-22 17:45:32 +02:00
Guillaume Gomez
da86fbdb95
Rollup merge of #53431 - alexreg:move-feature-gate-tests, r=cramertj
Moved some feature gate ui tests to correct location

None
2018-08-22 17:45:31 +02:00
Guillaume Gomez
8255f9e7a9
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
2018-08-22 17:45:29 +02:00
bors
c24f27c045 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
2018-08-22 15:29:07 +00:00
varkor
71722b9cef Fix rebase issues 2018-08-22 16:15:56 +01:00
varkor
d0209c44a6 Replace TyForeign with ForeignTy 2018-08-22 16:08:49 +01:00
varkor
05cfb3f5b5 Rename Def::{Param, Foreign} to Def::{TyParam, TyForeign} 2018-08-22 16:08:49 +01:00
varkor
08f3685a82 Remove unnecessary TyKind::s 2018-08-22 16:08:49 +01:00
varkor
8a5dccde2a Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str} 2018-08-22 16:08:49 +01:00
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
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