Commit Graph

120275 Commits

Author SHA1 Message Date
Guillaume Gomez
bb2ff593a6 Clean up E0582 explanation 2020-05-13 13:40:55 +02:00
Julian Wollersberger
ff9a9ed37c Replace some usages of the old unescape_ functions in AST, clippy and tests. 2020-05-13 10:05:04 +02:00
Julian Wollersberger
43ae785454 Replace some usages of the old unescape_ functions in AST, clippy and tests. 2020-05-13 10:05:04 +02:00
Julian Wollersberger
18cc63d693 Unified validate_{byte,str,raw_str,raw_byte_str}_escape methods into one method validate_literal_escape with a mode argument.
This enables simplifying the `match` in `cook_lexer_literal()`
and it eliminates 90 lines of repetition :)
2020-05-13 09:52:01 +02:00
Julian Wollersberger
1be5d1eabb Unified unescape_{char,byte,str,byte_str,raw_str,raw_byte_str} methods into one method unescape_literal with a mode argument. 2020-05-13 09:42:30 +02:00
bors
750db09fa8 Auto merge of #71451 - estebank:suggest-super-trait-constraint, r=nikomatsakis
Suggest adding super trait constraints
2020-05-13 06:54:15 +00:00
bors
b20a9cd474 Auto merge of #5587 - flip1995:rustup, r=phansch
Rustup

Done with

```bash
git subtree push -P src/tools/clippy git@github.com:flip1995/rust-clippy rustup
```

from https://github.com/flip1995/rust/tree/clippyup

A rebase was required to get rid of empty merge commits, that somehow were not empty? 🤔

changelog: none
2020-05-13 05:55:10 +00:00
Nicholas Nethercote
3b108588d1 Change Iterator::nth to use self.next() in a while loop.
Currently it uses `for x in self`, which seems dubious within an
iterator method. Furthermore, `self.next()` is used in all the other
iterator methods.
2020-05-13 15:48:08 +10:00
Nicholas Nethercote
5a0ac0552e Use simpler impls for some Iterator methods for slices.
The default implementations of several `Iterator` methods use `fold` or
`try_fold`, which works, but is overkill for slices and bloats the
amount of LLVM IR generated and consequently hurts compile times.

This commit adds the simple, obvious implementations for `for_each`,
`all`, `any`, `find`, `find_map`, and simplifies the existing
implementations for `position` and `rposition`. These changes reduce
compile times significantly on some benchmarks.
2020-05-13 15:47:19 +10:00
bors
a2e0b48e6e Auto merge of #70416 - mzohreva:mz/sgx-test, r=nikomatsakis
Process termination test for SGX

The issue is described in https://github.com/fortanix/rust-sgx/issues/109

cc @jethrogb
2020-05-13 03:29:00 +00:00
Nicholas Nethercote
40d4868b39 Be less aggressive with DroplessArena/TypedArena growth.
`DroplessArena` and `TypedArena` use an aggressive growth strategy: the
first chunk is 4 KiB, the second is 8 KiB, and it keeps on doubling
indefinitely. DHAT profiles show that sometimes this results in large
chunks (e.g. 16-128 MiB) that are barely filled. Although these don't
contribute to RSS, they clog up the DHAT profiles.

This commit changes things so that the doubling stops at 2 MiB. This is
large enough that chunk allocations are still rare (you might get 100s
instead of 10s of them) but avoids lots of unused space in the worst
case. It gives a slight speed-up to cycle counts in some cases.
2020-05-13 11:35:32 +10:00
Nicholas Nethercote
9111d8b66e Fix the new capacity measurement in arenas.
For the given code paths, the amount of space used in the previous chunk
is irrelevant.

(This will almost never make a difference to behaviour, but it makes the
code clearer.)
2020-05-13 11:29:16 +10:00
Jade McGough
5320bd986b add long error explanation for E0228 2020-05-12 17:09:09 -07:00
Esteban Küber
58797b01f1 review comments 2020-05-12 11:56:11 -07:00
Eric Huss
722b3df454 Update books 2020-05-12 11:27:03 -07:00
Esteban Küber
4556130e7d fix test output after rebase 2020-05-12 11:19:07 -07:00
Esteban Küber
45738e8cd1 Increase verbosity of bound restriction suggestions
- Make the bound restriction suggestion `span_suggestion_verbose`.
- Fix whitespace typo.
2020-05-12 11:19:07 -07:00
Esteban Küber
545320a22f Suggest adding super trait constraints 2020-05-12 11:19:07 -07:00
Mark Rousskov
6c415450fd Provide separate option for std debug asserts 2020-05-12 13:24:07 -04:00
Laurence Tratt
003ed802c4 Map to -> return. 2020-05-12 16:54:29 +01:00
Kornel
2d39f5abcd Warn against thread::sleep in async fn 2020-05-12 16:38:02 +01:00
Joshua Cotton
34b2072599 Fix bootstrap failing on win32 2020-05-12 10:51:44 -04:00
bors
769d12eec1 Auto merge of #72091 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/72037
Cc @rust-lang/miri r? @ghost
2020-05-12 13:59:16 +00:00
Wesley Wiser
5063297c79 Add doc comment for rustc_middle::mir::mono::Linkage 2020-05-12 08:12:38 -04:00
Guillaume Gomez
61fbe57f4a Clean up E0581 explanation 2020-05-12 13:36:57 +02:00
Ralf Jung
3fccdb3ded Pointer printing: do not print 0 offset 2020-05-12 13:30:50 +02:00
Oliver Scherer
0a785cdf34 Add some more sanity tests and add a debug log message for it 2020-05-12 13:23:01 +02:00
Oliver Scherer
de434d8e44 Propagate locals, even if they have unpropagatable assignments somewhere. 2020-05-12 13:14:47 +02:00
Oliver Scherer
c849a0d087 Add a repro example for not propagating constants of partially const initialized variables 2020-05-12 12:55:55 +02:00
bors
d903a9def4 Auto merge of #72134 - Dylan-DPC:rollup-h3shfz5, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71737 (Miri: run liballoc tests with threads)
 - #71928 (Add strikethrough support to rustdoc)
 - #72048 (Visit move out of `_0` when visiting `return`)
 - #72096 (Make MIR typeck use `LocalDefId` and fix docs)
 - #72128 (strings do not have to be valid UTF-8 any more)

Failed merges:

r? @ghost
2020-05-12 10:28:08 +00:00
Dylan DPC
ceeb9bdee6
Rollup merge of #72128 - RalfJung:str-validity, r=oli-obk
strings do not have to be valid UTF-8 any more

Cc https://github.com/rust-lang/reference/pull/792
r? @oli-obk
2020-05-12 11:41:15 +02:00
Dylan DPC
31e5be027e
Rollup merge of #72096 - jonas-schievink:mirck-docs, r=matthewjasper
Make MIR typeck use `LocalDefId` and fix docs

The docs on `fn type_check` were not in sync with the arguments it takes.

r? @matthewjasper
2020-05-12 11:41:13 +02:00
Dylan DPC
0f9563091f
Rollup merge of #72048 - jonas-schievink:visit-return, r=oli-obk
Visit move out of `_0` when visiting `return`

Closes https://github.com/rust-lang/rust/issues/72032
2020-05-12 11:41:12 +02:00
Dylan DPC
5fe77e5997
Rollup merge of #71928 - mibac138:strikethrough, r=GuillaumeGomez
Add strikethrough support to rustdoc

Implements uncontroversial part of #71183.
r? @GuillaumeGomez
2020-05-12 11:41:10 +02:00
Dylan DPC
2a1581c50c
Rollup merge of #71737 - RalfJung:miri-test-threads, r=shepmaster
Miri: run liballoc tests with threads

Miri now supports threads, so we can run these tests. :)
2020-05-12 11:41:05 +02:00
Nicholas Nethercote
98d6254415 Change WorkProduct::saved_files to an Option.
Because there is at most one file.
2020-05-12 17:55:07 +10:00
Ralf Jung
6f9810c981 strings do not have to be valid UTF-8 any more 2020-05-12 09:46:41 +02:00
Jack Huey
41f6b958d5 Remove ty::UnnormalizedProjection 2020-05-12 01:56:29 -04:00
Nicholas Nethercote
68b75033ad Split RawVec::grow up.
The amortized case is much more common than the exact case, and it is
typically instantiated many times.

Also, we can put a chunk of the code into a function that isn't generic
over T, which reduces the amount of LLVM IR generated quite a lot,
improving compile times.
2020-05-12 12:38:14 +10:00
Nicholas Nethercote
f420726566 Remove RawVec::double.
It's only used once, for `VecDeque`, and can easily be replaced by
something else. The commit changes `grow_if_necessary` to `grow` to
avoid some small regressions caused by changed inlining.

The commit also removes `Strategy::Double`, and streamlines the
remaining variants of `Strategy`.

It's a compile time win on some benchmarks because the many
instantations of `RawVec::grow` are a little smaller.
2020-05-12 12:37:22 +10:00
Wesley Wiser
6de6d70ae0 Modify SimplifyArmIdentity so it can trigger on mir-opt-level=1
I also added test cases to make sure the optimization can fire on all of
these cases:

```rust
fn case_1(o: Option<u8>) -> Option<u8> {
  match o {
    Some(u) => Some(u),
    None => None,
  }
}

fn case2(r: Result<u8, i32>) -> Result<u8, i32> {
  match r {
    Ok(u) => Ok(u),
    Err(i) => Err(i),
  }
}

fn case3(r: Result<u8, i32>) -> Result<u8, i32> {
  let u = r?;
  Ok(u)
}

```

Without MIR inlining, this still does not completely optimize away the
`?` operator because the `Try::into_result()`, `From::from()` and
`Try::from_error()` calls still exist. This does move us a bit closer to
that goal though because:

- We can now run the pass on mir-opt-level=1

- We no longer depend on the copy propagation pass running which is
  unlikely to stabilize anytime soon.
2020-05-11 20:31:02 -04:00
bors
09c817eeb2 Auto merge of #72120 - Dylan-DPC:rollup-ca0tur2, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #72014 (Deprecated emoji)
 - #72019 (Fix debug assertion in error code)
 - #72027 (Use CDN for ci-caches on download)
 - #72044 (use min_specialization for some rustc crates where it requires no changes)
 - #72052 (display `ConstKind::Param`)
 - #72067 (Emit a warning when optimization fuel runs out)
 - #72072 (doc: minus (U+2212) instead of dash (U+002D) for negative infinity)
 - #72077 (Improve E0571 wording)
 - #72107 (Clean up E0579 explanation)
 - #72109 (Fix clippy warnings)

Failed merges:

r? @ghost
2020-05-11 23:14:06 +00:00
Nicholas Nethercote
a3cc435f57 Remove RawVec::double_in_place.
It's unused.
2020-05-12 08:39:08 +10:00
Dylan DPC
dfa3677bee
Rollup merge of #72109 - matthiaskrgr:cl8ppy, r=Dylan-DPC
Fix clippy warnings

Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}

r? @Dylan-DPC
2020-05-11 22:21:08 +02:00
Dylan DPC
dd53768692
Rollup merge of #72107 - GuillaumeGomez:cleanup-e0579, r=Dylan-DPC
Clean up E0579 explanation

r? @Dylan-DPC
2020-05-11 22:21:07 +02:00
Dylan DPC
400a9bae49
Rollup merge of #72077 - GuillaumeGomez:cleanup-E0571, r=Dylan-DPC
Improve E0571 wording

r? @Dylan-DPC
2020-05-11 22:21:05 +02:00
Dylan DPC
6a8ac8b975
Rollup merge of #72072 - tspiteri:minus-inf, r=Dylan-DPC
doc: minus (U+2212) instead of dash (U+002D) for negative infinity

Like #67430, for the new associated constants.
2020-05-11 22:21:03 +02:00
Dylan DPC
d9c3110ae8
Rollup merge of #72067 - jonas-schievink:fuel-warn, r=varkor
Emit a warning when optimization fuel runs out

`eprintln!` gets swallowed by Cargo too easily.
2020-05-11 22:21:01 +02:00
Dylan DPC
a14af7fff8
Rollup merge of #72052 - lcnr:const_pprint, r=ecstatic-morse
display `ConstKind::Param`
2020-05-11 22:20:59 +02:00
Dylan DPC
eade6f7881
Rollup merge of #72044 - RalfJung:min-spec, r=matthewjasper
use min_specialization for some rustc crates where it requires no changes

and add FIXME for the rest

Cc @matthewjasper
2020-05-11 22:20:57 +02:00