Commit graph

132413 commits

Author SHA1 Message Date
Tomasz Miąsko 3b7157dc1a Assert that locals have storage when used
The validator in visit_local asserts that local has a stroage when used,
but visit_local is never called so validation is ineffective.

Use super_statement and super_terminator to ensure that locals are visited.
2020-10-31 21:06:29 +01:00
bors 4f7612ac14 Auto merge of #78594 - m-ou-se:rollup-h5c8frs, r=m-ou-se
Rollup of 7 pull requests

Successful merges:

 - #74622 (Add std::panic::panic_any.)
 - #77099 (make exp_m1 and ln_1p examples more representative of use)
 - #78526 (Strip tokens from trait and impl items before printing AST JSON)
 - #78550 (x.py setup: Create config.toml in the current directory, not the top-level directory)
 - #78577 (validator: Extend aliasing check to a call terminator)
 - #78581 (Constantify more BTreeMap and BTreeSet functions)
 - #78587 (parser: Cleanup `LazyTokenStream` and avoid some clones)

Failed merges:

r? `@ghost`
2020-10-31 17:09:38 +00:00
Mara Bos 1873ca55b3
Rollup merge of #78587 - petrochenkov:lazytok, r=Aaron1011
parser: Cleanup `LazyTokenStream` and avoid some clones

by using a named struct instead of a closure.

r? @Aaron1011
2020-10-31 09:49:41 +01:00
Mara Bos 3601f9d40b
Rollup merge of #78581 - a1phyr:const_btree_more, r=dtolnay
Constantify more BTreeMap and BTreeSet functions

Just because we can:

- `BTreeMap::len`
- `BTreeMap::is_empty`
- `BTreeSet::len`
- `BTreeSet::is_empty`

Note that I put the `const` under `const_btree_new`, because I don't think their is a need to create another feature flag for that.

cc #71835
2020-10-31 09:49:39 +01:00
Mara Bos 841f0e7f2c
Rollup merge of #78577 - tmiasko:validate-aliasing, r=jonas-schievink
validator: Extend aliasing check to a call terminator
2020-10-31 09:49:38 +01:00
Mara Bos c0f356d28f
Rollup merge of #78550 - jyn514:setup, r=Mark-Simulacrum
x.py setup: Create config.toml in the current directory, not the top-level directory

See https://github.com/rust-lang/rust/issues/78509 for discussion.

r? @pnkfelix
cc @cuviper @Mark-Simulacrum
2020-10-31 09:49:36 +01:00
Mara Bos 89aea55a7d
Rollup merge of #78526 - Aaron1011:fix/assoc-tokens, r=estebank
Strip tokens from trait and impl items before printing AST JSON

Fixes #78510
2020-10-31 09:49:34 +01:00
Mara Bos 4ebd5536b4
Rollup merge of #77099 - tspiteri:exp_m1-examples, r=m-ou-se
make exp_m1 and ln_1p examples more representative of use

With this PR, the examples for `exp_m1` would fail if `x.exp() - 1.0` is used instead of `x.exp_m1()`, and the examples for `ln_1p` would fail if `(x + 1.0).ln()` is used instead of `x.ln_1p()`.
2020-10-31 09:49:32 +01:00
Mara Bos 76b8b00b4f
Rollup merge of #74622 - fusion-engineering-forks:panic-box, r=KodrAus
Add std::panic::panic_any.

The discussion of #67984 lead to the conclusion that there should be a macro or function separate from `std::panic!()` for throwing arbitrary payloads, to make it possible to deprecate or disallow (in edition 2021) `std::panic!(arbitrary_payload)`.

Alternative names:

- `panic_with!(..)`
- ~~`start_unwind(..)`~~ (panicking doesn't always unwind)
- `throw!(..)`
- `panic_throwing!(..)`
- `panic_with_value(..)`
- `panic_value(..)`
- `panic_with(..)`
- `panic_box(..)`
- `panic(..)`

The equivalent (private, unstable) function in `libstd` is called `std::panicking::begin_panic`.

I suggest `panic_any`, because it allows for any (`Any + Send`) type.

_Tracking issue: #78500_
2020-10-31 09:49:28 +01:00
bors 3478d7c360 Auto merge of #76257 - JulianKnodt:i75777, r=Dylan-DPC
Add regression test

This adds a regression test for #75777, effectively closing it since it is solved on nightly and beta.

Closes #75777
2020-10-31 01:34:49 +00:00
Vadim Petrochenkov d0c63bccc5 parser: Cleanup LazyTokenStream and avoid some clones
by using a named struct instead of a closure.
2020-10-31 01:56:34 +03:00
bors 0d033dee3e Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obk
TypeVisitor: use `std::ops::ControlFlow` instead of `bool`

Implements MCP rust-lang/compiler-team#374.

Blocked on FCP in rust-lang/compiler-team#374.
r? `@lcnr` cc `@jonas-schievink`
2020-10-30 22:53:55 +00:00
Benoît du Garreau 307cc11beb Constantify more BTreeMap and BTreeSet functions
- BTreeMap::len
- BTreeMap::is_empty
- BTreeSet::len
- BTreeSet::is_empty
2020-10-30 19:24:08 +01:00
bors ffe52882ed Auto merge of #78424 - jyn514:THE-PAPERCLIP-COMETH, r=davidtwco
Fix some more clippy warnings

Found while working on https://github.com/rust-lang/rust/pull/77351. It turns out that `x.py clippy --fix` does work on that branch as long as you pass `CARGOFLAGS=--lib`.
2020-10-30 14:24:02 +00:00
Joshua Nelson 5339bd1ebe Add back missing comments 2020-10-30 10:13:41 -04:00
Joshua Nelson 57c6ed0c07 Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
Joshua Nelson bfecb18771 Fix some more clippy warnings 2020-10-30 10:12:56 -04:00
LeSeulArtichaut 9433eb83fe Remove implicit Continue type 2020-10-30 12:27:47 +01:00
LeSeulArtichaut 24e1a7e656 Use ControlFlow::is{break,continue} 2020-10-30 12:27:46 +01:00
LeSeulArtichaut 8e4cf0b3ed TypeVisitor: use ControlFlow in clippy 2020-10-30 12:27:45 +01:00
LeSeulArtichaut 61f8182cec TypeVisitor: use ControlFlow in rustc_{mir,privacy,traits,typeck} 2020-10-30 12:27:44 +01:00
LeSeulArtichaut 4fe735b320 TypeVisitor: use ControlFlow in rustc_{infer,lint,trait_selection} 2020-10-30 12:27:34 +01:00
LeSeulArtichaut 2c85b6fae0 TypeVisitor: use std::ops::ControlFlow instead of bool 2020-10-30 12:25:24 +01:00
bors 388ef34904 Auto merge of #78562 - JohnTitor:rollup-otg906u, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #77334 (Reorder benches const variable)
 - #77888 (Simplify a nested bool match)
 - #77921 (f64: Refactor collapsible_if)
 - #78523 (Revert invalid `fn` return type parsing change)
 - #78524 (Avoid BorrowMutError with RUSTC_LOG=debug)
 - #78545 (Make anonymous binders start at 0)
 - #78554 (Improve wording of `core::ptr::drop_in_place` docs)
 - #78556 (Link to pass docs from NRVO module docs)

Failed merges:

 - #78424 (Fix some more clippy warnings)

r? `@ghost`
2020-10-30 10:01:49 +00:00
Yuki Okushi 2471a7cdaa
Rollup merge of #78556 - camelid:mir-opt-nrvo-docs, r=jyn514
Link to pass docs from NRVO module docs

It can be easy to miss that this is documented on the pass's struct if you are
looking at the module docs.

Cc https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/what.20is.20NRVO.3F
2020-10-30 18:00:58 +09:00
Yuki Okushi 73d0340fd5
Rollup merge of #78554 - camelid:improve-drop_in_place-docs-wording, r=jyn514
Improve wording of `core::ptr::drop_in_place` docs

And two small intra-doc link conversions in `std::{f32, f64}`.
2020-10-30 18:00:58 +09:00
Yuki Okushi 05f80f03a9
Rollup merge of #78545 - jackh726:anonymous, r=oli-obk
Make anonymous binders start at 0

A few changes to some test outputs, but these actually look *more* correct to me.
2020-10-30 18:00:56 +09:00
Yuki Okushi f8539221d0
Rollup merge of #78524 - tmiasko:source-files-borrow, r=Aaron1011
Avoid BorrowMutError with RUSTC_LOG=debug

```console
$ touch empty.rs
$ env RUSTC_LOG=debug rustc +stage1 --crate-type=lib empty.rs
```

Fails with a `BorrowMutError` because source map files are already
borrowed while `features_query` attempts to format a log message
containing a span.

Release the borrow before the query to avoid the issue.
2020-10-30 18:00:54 +09:00
Yuki Okushi 8111706c18
Rollup merge of #78523 - estebank:fix-return-type-parse-regression, r=dtolnay
Revert invalid `fn` return type parsing change

Revert one of the changes in #78379.

Fix #78507.
2020-10-30 18:00:53 +09:00
Yuki Okushi 02a4b58a3f
Rollup merge of #77921 - wcampbell0x2a:f64-collapsible-if, r=jyn514
f64: Refactor collapsible_if
2020-10-30 18:00:49 +09:00
Yuki Okushi 439ea4b621
Rollup merge of #77888 - LingMan:ast_pretty_tt_prepend_space, r=jyn514
Simplify a nested bool match

Logically this first eliminates the innermost match by merging the patterns.
Then, in a second step, turns the newly innermost match into a `matches!` call.
2020-10-30 18:00:45 +09:00
Yuki Okushi 0723b274d2
Rollup merge of #77334 - pickfire:patch-4, r=jyn514
Reorder benches const variable

Move LEN so it is is read in order.
2020-10-30 18:00:41 +09:00
kadmin a7e8208074 Add regression test 2020-10-30 07:49:14 +00:00
bors 8df58ae03a Auto merge of #78393 - SNCPlay42:match-if-guard, r=tmandry
Always record reference to binding in match if guards

When encountering a binding from a `match` pattern in its `if` guard when computing a generator's interior types, we must always record the type of a reference to the binding because of how `if` guards are lowered to MIR. This was missed in #75213 because the binding in that test case was autorefed and we recorded that adjusted type anyway.

Fixes #78366
2020-10-30 07:05:57 +00:00
Camelid f558d96253 Link to pass docs from NRVO module docs 2020-10-29 23:05:45 -07:00
Camelid fee4f8feb0 Improve wording of core::ptr::drop_in_place docs
And two small intra-doc link conversions in `std::{f32, f64}`.
2020-10-29 20:09:29 -07:00
bors 0d33ab7af4 Auto merge of #78432 - sexxi-goose:fix-77993-take3, r=nikomatsakis
Handle type errors in closure/generator upvar_tys

Fixes #77993
2020-10-30 03:00:13 +00:00
Joshua Nelson 8cf7d66d0a Create config.toml in the current directory, not the top-level directory
See https://github.com/rust-lang/rust/issues/78509 for discussion.
2020-10-29 21:23:55 -04:00
bors c792f03379 Auto merge of #78540 - RalfJung:miri, r=RalfJung
update Miri

Cc `@rust-lang/miri` r? `@ghost`
2020-10-30 00:28:32 +00:00
Tomasz Miąsko b816e5dfb4 validator: Extend aliasing check to a call terminator 2020-10-30 00:00:00 +00:00
Jack Huey 41ce397990 Make anonymous binders start at 0 2020-10-29 18:50:23 -04:00
bors a3d7a5e945 Auto merge of #78528 - jonas-schievink:rollup-e70g9zk, r=jonas-schievink
Rollup of 11 pull requests

Successful merges:

 - #75078 (Improve documentation for slice strip_* functions)
 - #76138 (Explain fully qualified syntax for `Rc` and `Arc`)
 - #78244 (Dogfood {exclusive,half-open} ranges in compiler (nfc))
 - #78422 (Do not ICE on invalid input)
 - #78423 (rustc_span: improve bounds checks in byte_pos_to_line_and_col)
 - #78431 (Prefer new associated numeric consts in float error messages)
 - #78462 (Use unwrapDIPtr because the Scope may be null.)
 - #78493 (Update cargo)
 - #78499 (Prevent String::retain from creating non-utf8 strings when abusing panic)
 - #78505 (Update Clippy - temporary_cstring_as_ptr deprecation)
 - #78527 (Fix some more typos)

Failed merges:

r? `@ghost`
2020-10-29 20:56:25 +00:00
Ralf Jung 82634ffb0e update Miri 2020-10-29 21:33:37 +01:00
bors 6bdae9edd0 Auto merge of #78508 - wesleywiser:optimize_visit_scopes, r=petrochenkov
[resolve] Use `unwrap_or_else` instead of `unwrap_or` in a hot path

This improves the performance of the `resolve_crate` function by 30% for
a very large single file crate with auto-generated C bindings.

cc `@rylev`
2020-10-29 18:34:59 +00:00
Jonas Schievink e656e609ba
Rollup merge of #78527 - bugadani:typo3, r=jonas-schievink
Fix some more typos
2020-10-29 17:05:31 +01:00
Jonas Schievink 1d6e20e706
Rollup merge of #78505 - ebroto:clippyup, r=oli-obk
Update Clippy - temporary_cstring_as_ptr deprecation

In #75671 `clippy::temporary_cstr_as_ptr` was removed instead of being deprecated. This will trigger an error (unknown lint) for users that refer to that lint to e.g. allow it, instead of a more informative warning.

This update should fix that for nightly users.

r? @oli-obk
2020-10-29 17:05:30 +01:00
Jonas Schievink 48c4afbf9c
Rollup merge of #78499 - SkiFire13:fix-string-retain, r=m-ou-se
Prevent String::retain from creating non-utf8 strings when abusing panic

Fixes #78498

The idea is the same as `Vec::drain`, set the len to 0 so that nobody can observe the broken invariant if it escapes the function (in this case if `f` panics)
2020-10-29 17:05:28 +01:00
Jonas Schievink a01e5f8c0d
Rollup merge of #78493 - ehuss:update-cargo, r=ehuss
Update cargo

8 commits in dd83ae55c871d94f060524656abab62ec40b4c40..becb4c282b8f37469efb8f5beda45a5501f9d367
2020-10-20 19:31:26 +0000 to 2020-10-28 16:41:55 +0000
- List available packages if providing `--package` with an empty value (rust-lang/cargo#8808)
- Add a future-compatibility warning on allowed feature name characters. (rust-lang/cargo#8814)
- New namespaced features implementation. (rust-lang/cargo#8799)
- Remove redundant "For example, " (rust-lang/cargo#8810)
- Document platform-specific build-dependencies (rust-lang/cargo#8809)
- Remove some unused code. (rust-lang/cargo#8807)
- Some minor clippy fixes. (rust-lang/cargo#8804)
- Update TOML website links. (rust-lang/cargo#8803)
2020-10-29 17:05:26 +01:00
Jonas Schievink 38c34098b1
Rollup merge of #78462 - danielframpton:fixnullisa, r=nagisa
Use unwrapDIPtr because the Scope may be null.

I ran into an assertion when using debug information on Windows with LLVM assertions enabled.

It seems like we are using unwrap here (which in turn calls isa and requires the pointer to be non-null) but we expect the value to be null because that is what we are passing from rustc.

This change uses unwrapDIPtr which explicitly allows nullptr.

The FFI prototype for this method on the rust side has the `LLVMMetadataRef` parameter as `Scope: Option<&'a DIScope>`, and we always pass `None` when `msvc_like_names` is true.
2020-10-29 17:05:23 +01:00
Jonas Schievink 31cfe63fb9
Rollup merge of #78431 - Rustin-Liu:rustin-patch-lint, r=estebank
Prefer new associated numeric consts in float error messages

Fix https://github.com/rust-lang/rust/issues/78382
2020-10-29 17:05:21 +01:00