Commit Graph

120262 Commits

Author SHA1 Message Date
Ralf Jung
e5f31e0a3e
Rollup merge of #72150 - jackh726:unnorm_projection, r=nikomatsakis
Remove UnnormalizedProjection

This was only used for the old chalk integration with chalk-engine

r? @nikomatsakis
2020-05-14 10:22:59 +02:00
Ralf Jung
18d7c34625
Rollup merge of #72138 - wesleywiser:add_doc_comment, r=matthewjasper
Add doc comment for `rustc_middle::mir::mono::Linkage`
2020-05-14 10:22:57 +02:00
Ralf Jung
0b8b38c4c2
Rollup merge of #72137 - GuillaumeGomez:cleanup-e0581, r=Dylan-DPC
Clean up E0581 explanation

r? @Dylan-DPC
2020-05-14 10:22:55 +02:00
Ralf Jung
577da45097
Rollup merge of #71964 - jcotton42:bootstrap_decode_none_windows, r=Mark-Simulacrum
Fix bootstrap failing on win32

```powershell
python x.py -h # or really any x.py command
```
would fail with
```
info: Downloading and building bootstrap before processing --help
      command. See src/bootstrap/README.md for help with common
      commands.
Updating only changed submodules
Submodules updated in 0.15 seconds
Traceback (most recent call last):
  File "x.py", line 11, in <module>
    bootstrap.main()
  File "C:\Users\Joshua\Projects\forks\rust\src\bootstrap\bootstrap.py", line 960, in main
    bootstrap(help_triggered)
  File "C:\Users\Joshua\Projects\forks\rust\src\bootstrap\bootstrap.py", line 925, in bootstrap
    build.build = args.build or build.build_triple()
  File "C:\Users\Joshua\Projects\forks\rust\src\bootstrap\bootstrap.py", line 731, in build_triple
    return default_build_triple()
  File "C:\Users\Joshua\Projects\forks\rust\src\bootstrap\bootstrap.py", line 184, in default_build_triple
    ostype = require(["uname", "-s"], exit=required).decode(default_encoding)
AttributeError: 'NoneType' object has no attribute 'decode'
```

This PR defers the `decode` call until after we're sure `ostype` and `cputype` are not `None`, as they would be on Windows since `uname` doesn't exist
2020-05-14 10:22:54 +02:00
Ralf Jung
a6c1f61db7
Rollup merge of #71909 - Dolpheyn:doc-from-trait-for-option, r=steveklabnik
Document From trait for Option implementations

Add documentation for ```From``` trait for ```std::option::Option``` implementations

This PR solves a part of #51430 ( CC @skade )

This is my first PR ever in contributing for OSS. I'm happy to learn and make any changes if necessary :)
2020-05-14 10:22:52 +02:00
Ralf Jung
720ec68435
Rollup merge of #71870 - ltratt:more_specific_type_name_doc, r=kennytm
Be slightly more precise about any::type_name()'s guarantees.

The first commit in this PR rephrases the current documentation for `any::type_name()` to be a little more specific about the guarantees (or lack thereof) that this function makes. The second commit explicitly documents that lifetimes are currently not included in the output (since this bit me particularly hard recently).
2020-05-14 10:22:50 +02:00
Ralf Jung
7893d9a8d6
Rollup merge of #71741 - RalfJung:pointer-print, r=oli-obk
Pointer printing: do not print 0 offset

r? @eddyb Cc @oli-obk
2020-05-14 10:22:48 +02:00
Ralf Jung
32ea6a154f
Rollup merge of #71525 - ldm0:intosug, r=Mark-Simulacrum
`prefix` should not be mutable.

Change the process from for loop to find, which makes the `prefix` able to be immutable.
2020-05-14 10:22:40 +02:00
bors
7c34d8d662 Auto merge of #69756 - wesleywiser:simplify_try, r=oli-obk
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.

Fixes #66855
2020-05-14 06:22:40 +00:00
bors
7147068399 Auto merge of #5590 - ebroto:issue_5579, r=phansch
Fix ICE caused in unwrap module

changelog: Fix ICE in unwrap module with unexpected number of parameters for method of Option/Result

Fixes #5579
2020-05-14 05:34:54 +00:00
bors
23ffeea307 Auto merge of #72058 - RalfJung:no-dist-lldb, r=Mark-Simulacrum
bootstrap: remove lldb dist packaging

The lldb-preview rustup package is missing on every single target, and has never been shipped beyond x86_64-apple-darwin. It was removed in #62592 which landed around a year ago, and there's not been demand that we re-enable it since, so we're now removing support entirely to cleanup the code a bit.

The hope is that this will also kill the useless "lldb-preview" row on https://rust-lang.github.io/rustup-components-history/.
2020-05-14 02:50:34 +00:00
Tomasz Miąsko
dab3a5813e Fix Arc::decr_strong_count doc test 2020-05-14 00:56:49 +02:00
Eduardo Broto
9217675c7f Fix comparison_chain false positive 2020-05-14 00:26:09 +02:00
CAD97
90b196129b Improve Step::forward/backward for optimization
The previous definition did not optimize down to a single add operation,
but this version does appear to.
2020-05-13 17:57:06 -04:00
bors
94c0ab936b Auto merge of #72118 - flip1995:clippyup, r=oli-obk
Update Clippy to 43a1777

Updates Clippy to 43a1777b89

We should establish a process on how often and when to update Clippy. (After X feature PRs? Once per week? Only on bug fixes and in the release week? ...?)

r? @oli-obk
2020-05-13 21:15:09 +00:00
Tshepang Lekhonkhobe
e44f87fca3 docs: fix link
source https://github.com/rust-lang/rust/pull/72163#issuecomment-628234966
2020-05-13 23:02:56 +02:00
Bastian Kauschke
9001a64299 add spans to require_lang_items 2020-05-13 21:38:58 +02:00
Eduardo Broto
671c1e34cc Avoid running doctest that is expected to panic 2020-05-13 21:07:13 +02:00
CAD97
cef616b1dc Improve comments in iter::Step 2020-05-13 15:00:18 -04:00
Eduardo Broto
8d1029d3ca Move test for issue 5579 under tests/ui/crashes 2020-05-13 20:47:44 +02:00
Eduardo Broto
e4cd8e7961 Fix ICE caused in unwrap module 2020-05-13 20:35:52 +02:00
Eduardo Broto
064431d22f Re-add old tests for empty range loops 2020-05-13 20:33:32 +02:00
Eduardo Broto
0f2b1193f9 Remove reverse_range_loop lint 2020-05-13 20:33:32 +02:00
Eduardo Broto
8ffa0bfaa2 New lint: reversed_empty_ranges 2020-05-13 20:33:32 +02:00
Eduardo Broto
f20b962773 unused_unit: lint also in type parameters and where clauses 2020-05-13 20:33:12 +02:00
Tymoteusz Jankowski
617c7cd9fa Make intra links work inside trait impl block 2020-05-13 20:24:14 +02:00
Mark Rousskov
2b42a2b541 Forbid stage arguments to check
Users generally expect that check builds are fast, and that's only true in stage
0 (stages beyond that need us to build a compiler, which is slow).
2020-05-13 11:32:43 -04:00
bors
75e1463c52 Auto merge of #72013 - nnethercote:make-RawVec-grow-mostly-non-generic, r=Amanieu
Make `RawVec::grow` mostly non-generic.

`cargo-llvm-lines` shows that, in various benchmarks, `RawVec::grow` is
instantiated 10s or 100s of times and accounts for 1-8% of lines of
generated LLVM IR.

This commit moves most of `RawVec::grow` into a separate function that
isn't parameterized by `T`, which means it doesn't need to be
instantiated many times. This reduces compile time significantly.

r? @ghost
2020-05-13 14:29:56 +00:00
Faris Sufyan
6c3856f3ec
Update src/libcore/option.rs
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2020-05-13 21:13:35 +08:00
Faris Sufyan
ef1688db8e
Update src/libcore/option.rs
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2020-05-13 21:13:27 +08:00
Faris Sufyan
f445a8286e
Update src/libcore/option.rs
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2020-05-13 21:13:17 +08:00
Faris Sufyan
adc2bf0cfe
Update src/libcore/option.rs
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2020-05-13 21:13:08 +08:00
Faris Sufyan
644bb24e33
Update src/libcore/option.rs
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2020-05-13 21:12:50 +08:00
Faris Sufyan
a9e7d57238
Update src/libcore/option.rs
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2020-05-13 21:12:35 +08:00
Faris Sufyan
4588c26e53
Update src/libcore/option.rs
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2020-05-13 21:05:53 +08:00
Faris Sufyan
46e9cbea3a
Update src/libcore/option.rs
Co-authored-by: Steve Klabnik <steve@steveklabnik.com>
2020-05-13 21:04:52 +08:00
Bastian Kauschke
5f93bc774b use require_lang_item over unwrap. 2020-05-13 14:47:17 +02:00
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