100173 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
f2904674e8 syntax: cleanup method parsing. 2019-09-30 03:31:09 +02:00
Alexander Regueiro
33ed03fea0 Cleaned up a few doc comments in libfmt_macros. 2019-09-30 01:15:48 +01:00
Alexander Regueiro
49c6c86faf Fixed stylistic convention for one diagnostic and blessed tests. 2019-09-30 01:15:25 +01:00
Alexander Regueiro
13b61b50d9 Fixed grammar in one diagnostic and blessed tests. 2019-09-30 01:15:25 +01:00
Alexander Regueiro
8a4af2f699 Fixed weird non-sequential indices for serialisation of SourceFile type. 2019-09-30 01:15:24 +01:00
Alexander Regueiro
fdd1a62a45 Added backticks for one diagnostic message. 2019-09-30 01:15:24 +01:00
Alexander Regueiro
d938a8079f Fixed grammar for some time fn calls and a diagnostic. 2019-09-30 01:15:24 +01:00
Nicholas Nethercote
5ca99b750e Avoid chain() in find_constraint_paths_between_regions().
This iterator can be hot, and chained iterators are slow. The second
half of the chain is almost always empty, so this commit changes the
code to avoid the chained iteration.

This change reduces instruction counts for the `wg-grammar` benchmark by
up to 1.5%.
2019-09-30 09:05:36 +10:00
bors
d16ee891c6 Auto merge of #64673 - Mark-Simulacrum:opt-match-ck, r=oli-obk
Optimize try_eval_bits to avoid layout queries

This specifically targets match checking, but is possibly more widely
useful as well. In code with large, single-value match statements, we
were previously spending a lot of time running layout_of for the
primitive types (integers, chars) -- which is essentially useless. This
optimizes the code to avoid those query calls by directly obtaining the
size for these types, when possible.

It may be worth considering adding a `size_of` query in the future which
might be far faster, especially if specialized for "const" cases --
match arms being the most obvious example. It's possibly such a function
would benefit from *not* being a query as well, since it's trivially
evaluatable from the sty for many cases whereas a query needs to hash
the input and such.
2019-09-29 22:21:43 +00:00
Mark Rousskov
06c6e75aae Optimize try_eval_bits to avoid layout queries
This specifically targets match checking, but is possibly more widely
useful as well. In code with large, single-value match statements, we
were previously spending a lot of time running layout_of for the
primitive types (integers, chars) -- which is essentially useless. This
optimizes the code to avoid those query calls by directly obtaining the
size for these types, when possible.

It may be worth considering adding a `size_of` query in the future which
might be far faster, especially if specialized for "const" cases --
match arms being the most obvious example. It's possibly such a function
would benefit from *not* being a query as well, since it's trivially
evaluatable from the sty for many cases whereas a query needs to hash
the input and such.
2019-09-29 17:52:20 -04:00
Oliver Middleton
dc295318fc rustdoc: Fix default logo filename 2019-09-29 22:17:03 +01:00
Tyler Mandry
2185710748 Use https for curl when building for linux 2019-09-29 13:33:12 -07:00
Nicholas Nethercote
a820672f6c Avoid the popping loop at the end of compress().
By collecting the done obligations (when necessary) in the main loop.
This makes the code cleaner.

The commit also changes the order in which successful obligations are
returned -- they are now returned in the registered order, rather than
reversed. Because this order doesn't actually matter, being only used by
tests, the commit uses `sort()` to make the test agnostic w.r.t. the
order.
2019-09-30 05:25:25 +10:00
Nicholas Nethercote
2883c258f1 Remove an out-of-date sentence in a comment. 2019-09-30 05:23:07 +10:00
Nicholas Nethercote
8a62bb1a1d Rename nodes_len and use it in a few more places. 2019-09-30 05:23:07 +10:00
Nicholas Nethercote
9e67f19eee Convert some match expressions to ifs.
These make the code more concise.
2019-09-30 05:23:07 +10:00
Nicholas Nethercote
6fb1f37888 Introduce some intermediate variables that aid readability. 2019-09-30 05:23:07 +10:00
Nicholas Nethercote
22943ee27c Remove unnecessary uses of ObligationForest::scratch.
They don't help performance at all, and just complicate things.
2019-09-30 05:23:07 +10:00
Nicholas Nethercote
ea726501e1 Use filter and map in to_errors. 2019-09-30 05:23:07 +10:00
Nicholas Nethercote
7130e6c073 Tweak the control flow in process_obligations(). 2019-09-30 05:23:07 +10:00
Nicholas Nethercote
85a56cbd88 Inline mark_as_waiting_from.
It has a single call site, and the code is easier to read this way.
2019-09-30 05:23:07 +10:00
Nicholas Nethercote
4a7fb8b13a Rename node_index as index.
For consistency with other variables in this file.
2019-09-30 05:23:07 +10:00
Nicholas Nethercote
3b506d9694 Remove NodeState::OnDfsStack.
It's not necessary; cycles (which are rare) can be detected by looking
at the node stack.

This change speeds things up slightly, as well as simplifying the code a
little.
2019-09-30 05:23:07 +10:00
bors
8431f261dd Auto merge of #64902 - Centril:rollup-1i431vs, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #64691 (Point at definition when misusing ADT)
 - #64735 (Add long error explanation for E0533)
 - #64825 (Point at enclosing match when expecting `()` in arm)
 - #64858 (Add support for relating slices in `super_relate_consts`)
 - #64894 (syntax: fix dropping of attribute on first param of non-method assocated fn)
 - #64898 (fixed typo)

Failed merges:

r? @ghost
2019-09-29 18:35:04 +00:00
Mazdak Farrokhzad
50940ae952
Rollup merge of #64898 - jakevossen5:master, r=jonas-schievink
fixed typo

Accidentally had a typo in https://github.com/rust-lang/rust/pull/64884, sorry!
2019-09-29 20:34:19 +02:00
Mazdak Farrokhzad
64afa26253
Rollup merge of #64894 - Centril:fix-64682, r=petrochenkov
syntax: fix dropping of attribute on first param of non-method assocated fn

Fixes #64682.

The general idea is that we bake parsing of `self` into `parse_param_general` and then we just use standard list parsing. Overall, this simplifies the parsing and makes it more consistent.

r? @petrochenkov cc @c410-f3r
2019-09-29 20:34:18 +02:00
Mazdak Farrokhzad
4ada68e325
Rollup merge of #64858 - skinny121:str-const-generics, r=varkor
Add support for relating slices in `super_relate_consts`

This allows passing strings as generic arguments.

Fixes #63773
Fixes #60813

r? @varkor
2019-09-29 20:34:16 +02:00
Mazdak Farrokhzad
8109332a4c
Rollup merge of #64825 - estebank:match-unit, r=Centril
Point at enclosing match when expecting `()` in arm

When encountering code like the following:

```rust
fn main() {
    match 3 {
        4 => 1,
        3 => {
            println!("Yep it maches.");
            2
        }
        _ => 2
    }
    println!("Bye!")
}
```

point at the enclosing `match` expression and suggest ignoring the
returned value:

```
error[E0308]: mismatched types
  --> $DIR/match-needing-semi.rs:8:13
   |
LL | /     match 3 {
LL | |         4 => 1,
LL | |         3 => {
LL | |             2
   | |             ^ expected (), found integer
LL | |         }
LL | |         _ => 2
LL | |     }
   | |     -- help: consider using a semicolon here
   | |_____|
   |       expected this to be `()`
   |
   = note: expected type `()`
              found type `{integer}
```

Fix #40799.
2019-09-29 20:34:15 +02:00
Mazdak Farrokhzad
f34e2b1e7c
Rollup merge of #64735 - GuillaumeGomez:long-err-explanation-E0533, r=Centril
Add long error explanation for E0533

Part of https://github.com/rust-lang/rust/issues/61137
2019-09-29 20:34:14 +02:00
Mazdak Farrokhzad
0a2ddcc346
Rollup merge of #64691 - estebank:unexpected-variant, r=Centril
Point at definition when misusing ADT

When given `struct Foo(usize)` and using it as `Foo {}` or `Foo`, point at `Foo`'s definition in the error.
2019-09-29 20:34:12 +02:00
Ralf Jung
17fa7fe77e bump Miri 2019-09-29 13:57:26 -04:00
csmoe
64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
csmoe
1f8e1d8aea remove ClosureSubsts with SubstsRef 2019-09-29 16:17:46 +00:00
csmoe
eab060f4da clean ClosureSubsts in rustc::ty 2019-09-29 16:17:46 +00:00
csmoe
8ab82c147a introduce from_ref helper for replacement 2019-09-29 16:17:46 +00:00
csmoe
d20183dbbf remove bit_set re-export from rustc_data_structures 2019-09-29 16:11:30 +00:00
csmoe
17990637b3 move bit_set into rustc_index 2019-09-29 16:11:30 +00:00
csmoe
1cff2e6557 move index_vec into rustc_index 2019-09-29 16:11:30 +00:00
csmoe
be32185810 init librustc_index crate 2019-09-29 16:11:29 +00:00
=
d695e2417a
fixed typo 2019-09-29 09:58:29 -06:00
bors
06c68947ad Auto merge of #64158 - tmandry:libtest-panic-abort, r=alexcrichton
panic=abort support in libtest

Add experimental support for tests compiled with panic=abort. Enabled with `-Z panic_abort_tests`.

r? @alexcrichton
cc @cramertj
2019-09-29 13:53:08 +00:00
Mazdak Farrokhzad
8fd03b1e47 syntax: fix #64682.
Fuse parsing of `self` into `parse_param_general`.
2019-09-29 12:55:45 +02:00
bors
d046ffddc4 Auto merge of #64546 - weiznich:bugfix/rfc-2451-rerebalance-tests, r=nikomatsakis
Bugfix/rfc 2451 rerebalance tests

r? @nikomatsakis

Fixes #64412
Depends/Contains on #64414

cc #55437 and #63599
2019-09-29 09:52:58 +00:00
Simon Sapin
6c01c0e9b5 Zero-initialize vec![None; n] for Option<&T>, Option<&mut T> and Option<Box<T>> 2019-09-29 11:14:59 +02:00
Simon Sapin
ce60da497b Fix vec![x; n] with null raw fat pointer zeroing the pointer metadata
https://github.com/rust-lang/rust/pull/49496 introduced specialization based on:

```
unsafe impl<T: ?Sized> IsZero for *mut T {
    fn is_zero(&self) -> bool {
        (*self).is_null()
    }
}
```

… to call `RawVec::with_capacity_zeroed` for creating `Vec<*mut T>`,
which is incorrect for fat pointers
since `<*mut T>::is_null` only looks at the data component.
That is, a fat pointer can be “null” without being made entirely of zero bits.

This commit fixes it by removing the `?Sized` bound on this impl
(and the corresponding `*const T` one).
This regresses `vec![x; n]` with `x` a null raw slice of length zero,
but that seems exceptionally uncommon.
(Vtable pointers are never null, so raw trait objects would not take
the fast path anyway.

An alternative to keep the `?Sized` bound
(or even generalize to `impl<U: Copy> IsZero for U`)
would be to cast to `&[u8]` of length `size_of::<U>()`,
but the optimizer seems not to be able to propagate alignment information
and sticks with comparing one byte at a time:

https://rust.godbolt.org/z/xQFkwL

----

Without the library change, the new test fails as follows:

```
---- vec::vec_macro_repeating_null_raw_fat_pointer stdout ----
[src/liballoc/tests/vec.rs:1301] ptr_metadata(raw_dyn) = 0x00005596ef95f9a8
[src/liballoc/tests/vec.rs:1306] ptr_metadata(vec[0]) = 0x0000000000000000
thread 'vec::vec_macro_repeating_null_raw_fat_pointer' panicked at 'assertion failed: vec[0] == null_raw_dyn', src/liballoc/tests/vec.rs:1307:5
```
2019-09-29 11:06:53 +02:00
bors
fe2f7e0e53 Auto merge of #64886 - Centril:rollup-30dqh8j, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #63492 (Remove redundancy from the implementation of C variadics.)
 - #64589 (Differentiate AArch64 bare-metal targets between hf and non-hf.)
 - #64799 (Fix double panic when printing query stack during an ICE)
 - #64824 (No StableHasherResult everywhere)
 - #64884 (Add pkg-config to dependency list if building for Linux on Linux)

Failed merges:

r? @ghost
2019-09-29 06:08:50 +00:00
Mazdak Farrokhzad
3eba6c18d4 syntax: recover trailing | in or-patterns. 2019-09-29 07:11:26 +02:00
Mazdak Farrokhzad
0d4afa164b
Rollup merge of #64884 - jakevossen5:master, r=Mark-Simulacrum
Add pkg-config to dependency list if building for Linux on Linux

I got this message when building from source on Ubuntu:

```
It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
could not be found. If you have OpenSSL installed you can likely fix this by
installing `pkg-config`.
```

I feel like it would be a better experience to show this in the dependencies instead of having to run into this issue.
2019-09-29 04:36:04 +02:00
Mazdak Farrokhzad
d7d7c2fce2
Rollup merge of #64824 - Mark-Simulacrum:no-stable-hasher-result-everywhere, r=michaelwoerister
No StableHasherResult everywhere

This removes the generic parameter on `StableHasher`, instead moving it to the call to `finish`. This has the side-effect of making all `HashStable` impls nicer, since we no longer need the verbose `<W: StableHasherResult>` that previously existed -- often forcing line wrapping.

This is done for two reasons:
 * we should avoid false "generic" dependency on the result of StableHasher
     * we don't need to codegen two/three copies of all the HashStable impls when they're transitively used to produce a fingerprint, u64, or u128. I haven't measured, but this might actually make our artifacts somewhat smaller too.
 * Easier to understand/read/write code -- the result of the stable hasher is irrelevant when writing a hash impl.
2019-09-29 04:36:02 +02:00
Mazdak Farrokhzad
b30d9beafb
Rollup merge of #64799 - Aaron1011:fix/double-panic, r=Mark-Simulacrum
Fix double panic when printing query stack during an ICE

On the latest nightly, any call to `bug` or `span_bug` will result in two panics - the first one as a normal result of calling `bug` / `span_bug`, and the second as a result of trying to print the query stack from the panic handler. This is caused by the query-printing code attempting to acquire a lock on `HandlerInnder`, which is still being held by `bug`.

This PR moves the actual panic out of `HandlerInner`, into `Handler`. This allows us to release the lock on `HandlerInner` before triggering the panic, ensuring that the panic handler will be able to acquire the lock if necessary.
2019-09-29 04:36:01 +02:00