]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #66211 - kinnison:kinnison/fix-66159, r=GuillaumeGomez
bors [Wed, 13 Nov 2019 23:22:03 +0000 (23:22 +0000)]
Auto merge of #66211 - kinnison:kinnison/fix-66159, r=GuillaumeGomez

Fix ICE when documentation includes intra-doc-link

When collecting intra-doc-links we could trigger the loading of extra crates into the crate store due to name resolution finding crates referred to in documentation but not in code.  This might be due to
configuration differences or simply referring to something else.

This would cause an ICE because the newly loaded crate metadata existed in a crate store associated with the rustdoc global context, but the resolver had its own crate store cloned just before the documentation processing began and as such it could try and look up crates in a store which lacked them.

In this PR, I add support for `--extern-private` to the `rustdoc` tool so that it is supported for `compiletest` to then pass the crates in; and then I fix the issue by forcing the resolver to look over all the crates before we then lower the input ready for processing into documentation.

The first commit (the `--extern-private`) could be replaced with a commit which adds support for `--extern` to `compiletest` if preferred, though I think that adding `--extern-private` to `rustdoc` is more useful anyway since it makes the CLI a little more like `rustc`'s which might help reduce surprise for someone running it by hand or in their own test code.

The PR is meant to fix #66159 though it may also fix #65840.

cc @GuillaumeGomez

4 years agoAuto merge of #66170 - ecstatic-morse:hir-const-check, r=Centril,oli-obk
bors [Wed, 13 Nov 2019 20:10:54 +0000 (20:10 +0000)]
Auto merge of #66170 - ecstatic-morse:hir-const-check, r=Centril,oli-obk

Add a HIR pass to check consts for `if`, `loop`, etc.

Resolves #66125.

This PR adds a HIR pass to check for high-level control flow constructs that are forbidden in a const-context. The MIR const-checker is unable to provide good spans for these since they are lowered to control flow primitives (e.g., `Goto` and `SwitchInt`), and these often don't map back to the underlying statement as a whole. This PR is intended only to improve diagnostics once `if` and `match` become commonplace in constants (behind a feature flag). The MIR const-checker will continue to operate unchanged, and will catch anything this check might miss.

In this implementation, the HIR const-checking pass is run much earlier than the MIR one, so it will supersede any errors from the latter. I will need some mentoring if we wish to change this, since I'm not familiar with the diagnostics system. Moving this pass into the same phase as the MIR const-checker could also help keep backwards compatibility for items like `const _: () = loop { break; };`, which are currently (erroneously?) accepted by the MIR const-checker (see #62272).

r? @Centril
cc @eddyb (since they filed #62272)

4 years agoUse `ast::Mutability`
Dylan MacKenzie [Wed, 13 Nov 2019 18:46:44 +0000 (10:46 -0800)]
Use `ast::Mutability`

4 years agoBless miri unleashed test now that errors are mandatory
Dylan MacKenzie [Mon, 11 Nov 2019 16:00:49 +0000 (08:00 -0800)]
Bless miri unleashed test now that errors are mandatory

4 years agoBless less verbose error messages
Dylan MacKenzie [Sat, 9 Nov 2019 17:29:57 +0000 (09:29 -0800)]
Bless less verbose error messages

The MIR const-checker errors for if/match/loop are now delay span bugs,
so nothing will be emitted unless the HIR checker misses something.

4 years agoChange control flow error to delay span bug
Dylan MacKenzie [Sat, 9 Nov 2019 17:07:13 +0000 (09:07 -0800)]
Change control flow error to delay span bug

4 years agoFix broken doc-test
Dylan MacKenzie [Fri, 8 Nov 2019 00:13:35 +0000 (16:13 -0800)]
Fix broken doc-test

4 years agoSmall fixes to comments
Dylan MacKenzie [Thu, 7 Nov 2019 18:02:01 +0000 (10:02 -0800)]
Small fixes to comments

4 years agoBless back-compat breakages
Dylan MacKenzie [Thu, 7 Nov 2019 01:45:10 +0000 (17:45 -0800)]
Bless back-compat breakages

This PR BREAKS CODE THAT WAS ACCEPTED ON STABLE. It's arguably a bug
that this was accepted in the first place, but here we are. See #62272
for more info.

4 years agoBless const tests with improved diagnostics
Dylan MacKenzie [Wed, 6 Nov 2019 20:29:30 +0000 (12:29 -0800)]
Bless const tests with improved diagnostics

4 years agoExtend const-loop and const-if to handle more cases
Dylan MacKenzie [Wed, 6 Nov 2019 20:26:59 +0000 (12:26 -0800)]
Extend const-loop and const-if to handle more cases

This makes sure that our HIR visitor is visiting as many
const-items as possible.

4 years agoRemove if/loop tests from min_const_fn
Dylan MacKenzie [Wed, 6 Nov 2019 20:24:23 +0000 (12:24 -0800)]
Remove if/loop tests from min_const_fn

These errors will be triggered before the MIR const-checker runs,
causing all other errors to be silenced. They are now checked in the
`const-{if,loop}` tests.

4 years agoEnable const-checking HIR bodies
Dylan MacKenzie [Wed, 6 Nov 2019 19:46:55 +0000 (11:46 -0800)]
Enable const-checking HIR bodies

4 years agoAdd HIR pass to check for `if`s and `loop`s in a `const`
Dylan MacKenzie [Wed, 6 Nov 2019 19:44:56 +0000 (11:44 -0800)]
Add HIR pass to check for `if`s and `loop`s in a `const`

These high-level constructs get mapped to control-flow primitives by the
time the MIR const-checker runs, making it hard to get the span for the
erroneous expression.

4 years agoGet `FnSig` by `HirId`
Dylan MacKenzie [Wed, 6 Nov 2019 19:43:33 +0000 (11:43 -0800)]
Get `FnSig` by `HirId`

4 years agoAdd E0744 for control flow in consts
Dylan MacKenzie [Wed, 6 Nov 2019 19:41:27 +0000 (11:41 -0800)]
Add E0744 for control flow in consts

4 years agoAuto merge of #66366 - JohnTitor:rollup-xlc1bj2, r=JohnTitor
bors [Wed, 13 Nov 2019 13:16:53 +0000 (13:16 +0000)]
Auto merge of #66366 - JohnTitor:rollup-xlc1bj2, r=JohnTitor

Rollup of 14 pull requests

Successful merges:

 - #65932 (download .tar.xz if python3 is used)
 - #66094 (Fix documentation for `Iterator::count()`.)
 - #66166 (rename cfg(rustdoc) into cfg(doc))
 - #66186 (Add long error explanation for E0623)
 - #66227 (docs: Fix link to BufWriter::flush)
 - #66248 (add raw ptr variant of UnsafeCell::get)
 - #66292 (add Result::map_or)
 - #66297 (Add a callback that allows compiler consumers to override queries.)
 - #66317 (Use a relative bindir for rustdoc to find rustc)
 - #66330 (Improve non-exhaustiveness handling in usefulness checking)
 - #66331 (Add some tests for fixed ICEs)
 - #66334 (Move Session fields to CrateStore)
 - #66335 (Move self-profile infrastructure to data structures)
 - #66337 (Remove dead code for encoding/decoding lint IDs)

Failed merges:

r? @ghost

4 years agoRollup merge of #66337 - Mark-Simulacrum:no-decode-lint-id, r=Dylan-DPC
Yuki Okushi [Wed, 13 Nov 2019 13:09:31 +0000 (22:09 +0900)]
Rollup merge of #66337 - Mark-Simulacrum:no-decode-lint-id, r=Dylan-DPC

Remove dead code for encoding/decoding lint IDs

This helps decouple the lint system from needing the implicit TLS TyCtxt
as well.

4 years agoRollup merge of #66335 - Mark-Simulacrum:self-profile-to-data, r=michaelwoerister
Yuki Okushi [Wed, 13 Nov 2019 13:09:29 +0000 (22:09 +0900)]
Rollup merge of #66335 - Mark-Simulacrum:self-profile-to-data, r=michaelwoerister

Move self-profile infrastructure to data structures

The single dependency on queries (QueryName) can be fairly easily
abstracted via a trait and this further decouples Session from librustc
(the primary goal).

This is intended as a precursor to moving Session out of librustc, but since that involves lots of smaller steps that move around code I'm splitting it up into separate PRs.

4 years agoRollup merge of #66334 - Mark-Simulacrum:sess-cstore, r=petrochenkov
Yuki Okushi [Wed, 13 Nov 2019 13:09:28 +0000 (22:09 +0900)]
Rollup merge of #66334 - Mark-Simulacrum:sess-cstore, r=petrochenkov

Move Session fields to CrateStore

`allocator_kind` and `injected_panic_runtime` are both query-like, this moves them out of Session and into CrateStore, avoiding the `Once` they previously had by clearing separating initialization and de-initialization.

4 years agoRollup merge of #66331 - JohnTitor:add-tests, r=Centril
Yuki Okushi [Wed, 13 Nov 2019 13:09:26 +0000 (22:09 +0900)]
Rollup merge of #66331 - JohnTitor:add-tests, r=Centril

Add some tests for fixed ICEs

Closes #30904 (fixed between nightly-2019-07-14 and nightly-2019-07-31)
Closes #40231 (example 1 is fixed in 1.32.0, example 2 is fixed in 1.38.0)
Closes #52432 (fixed in rustc 1.40.0-beta.1 (76b40532a 2019-11-05))
Closes #63279 (fixed in rustc 1.40.0-nightly (246be7e1a 2019-10-25))

r? @Centril

4 years agoRollup merge of #66330 - Nadrieril:nonexhaustive-constructor, r=varkor
Yuki Okushi [Wed, 13 Nov 2019 13:09:25 +0000 (22:09 +0900)]
Rollup merge of #66330 - Nadrieril:nonexhaustive-constructor, r=varkor

Improve non-exhaustiveness handling in usefulness checking

The comments around code paths for the `non_exhaustive` feature mention stuff like "we act as if the type had an extra unmatcheable constructor". So I thought I'd make this explicit by defining a special constructor that does exactly this.
This makes those code paths a bit more legible and less prone to error.

4 years agoRollup merge of #66317 - cuviper:bindir_relative, r=Mark-Simulacrum
Yuki Okushi [Wed, 13 Nov 2019 13:09:23 +0000 (22:09 +0900)]
Rollup merge of #66317 - cuviper:bindir_relative, r=Mark-Simulacrum

Use a relative bindir for rustdoc to find rustc

In bootstrap, we set `RUSTC_INSTALL_BINDIR` to `config.bindir`, so
rustdoc can find rustc relative to the toolchain sysroot. However, if a
distro script like Fedora's `%configure` sets an absolute path, then
rustdoc's `sysroot.join(bin_path)` ignores that sysroot altogether.

That would be OK once the toolchain is actually installed, but it breaks
the in-tree doc tests during the build, since `/usr/bin/rustc` is still
the old version. So now we try to make `RUSTC_INSTALL_BINDIR` relative
to the sysroot prefix in the first place.

r? @Mark-Simulacrum

4 years agoRollup merge of #66297 - vakaras:edit-queries, r=oli-obk
Yuki Okushi [Wed, 13 Nov 2019 13:09:22 +0000 (22:09 +0900)]
Rollup merge of #66297 - vakaras:edit-queries, r=oli-obk

Add a callback that allows compiler consumers to override queries.

This pull request adds an additional callback that allows compiler consumers such as Prusti and MIRAI to override queries. My hope is that in this way it will be possible to get access to the internal compiler information (e.g. borrow checker) without major changes to the compiler.

This pull request is work in progress because I am still testing if I can get the information which I need.

cc @nikomatsakis

r? @oli-obk

4 years agoRollup merge of #66292 - lzutao:result-map_or, r=SimonSapin
Yuki Okushi [Wed, 13 Nov 2019 13:09:20 +0000 (22:09 +0900)]
Rollup merge of #66292 - lzutao:result-map_or, r=SimonSapin

add Result::map_or

This PR adds this API to make it consistent with `Option::map_or`.

```rust
impl<T, E> Result<T, E> {
    pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U {
        match self {
            Ok(t) => f(t),
            Err(_) => default,
        }
    }
}
```

This API is very small. We already has a similar API for `Option::map_or`.

4 years agoRollup merge of #66248 - RalfJung:unsafe_cell_raw_get, r=SimonSapin
Yuki Okushi [Wed, 13 Nov 2019 13:09:19 +0000 (22:09 +0900)]
Rollup merge of #66248 - RalfJung:unsafe_cell_raw_get, r=SimonSapin

add raw ptr variant of UnsafeCell::get

This has come up recently in https://github.com/rust-lang/rust/pull/66051 (Cc @Centril @pitdicker) as well as in discussion with @nikomatsakis and in unrelated discussion with @withoutboats.

4 years agoRollup merge of #66227 - bryanburgers:bufwriter-docs-fix-flush-link, r=Dylan-DPC
Yuki Okushi [Wed, 13 Nov 2019 13:09:17 +0000 (22:09 +0900)]
Rollup merge of #66227 - bryanburgers:bufwriter-docs-fix-flush-link, r=Dylan-DPC

docs: Fix link to BufWriter::flush

One of the links in the docs was being rendered as a literal
open-bracket followed by a single quote, instead of being transformed
into a link. Fix it to match the link earlier in the same paragraph.

4 years agoRollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPC
Yuki Okushi [Wed, 13 Nov 2019 13:09:15 +0000 (22:09 +0900)]
Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPC

Add long error explanation for E0623

Part of #61137.

r? @Dylan-DPC

4 years agoRollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=QuietMisdreavus
Yuki Okushi [Wed, 13 Nov 2019 13:09:13 +0000 (22:09 +0900)]
Rollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=QuietMisdreavus

rename cfg(rustdoc) into cfg(doc)

Needed by https://github.com/rust-lang/rust/pull/61351

r? @QuietMisdreavus

4 years agoRollup merge of #66094 - ArturKovacs:fix-count-doc, r=Dylan-DPC
Yuki Okushi [Wed, 13 Nov 2019 13:09:11 +0000 (22:09 +0900)]
Rollup merge of #66094 - ArturKovacs:fix-count-doc, r=Dylan-DPC

Fix documentation for `Iterator::count()`.

The documentation of std::core::Iterator::count() stated that the number returned is the number of times `next` is called on the iterator. However this is not true as the number of times `next` is called is exactly one plus the number returned by `count()`.

4 years agoRollup merge of #65932 - guanqun:download-xz, r=alexcrichton
Yuki Okushi [Wed, 13 Nov 2019 13:09:10 +0000 (22:09 +0900)]
Rollup merge of #65932 - guanqun:download-xz, r=alexcrichton

download .tar.xz if python3 is used

fixes https://github.com/rust-lang/rust/issues/65757

4 years agomake things ugly
Ralf Jung [Wed, 13 Nov 2019 08:31:08 +0000 (09:31 +0100)]
make things ugly

4 years agoexpand docs
Ralf Jung [Wed, 13 Nov 2019 08:11:09 +0000 (09:11 +0100)]
expand docs

4 years agoclarify why we can do the ptr cast
Ralf Jung [Wed, 13 Nov 2019 08:07:52 +0000 (09:07 +0100)]
clarify why we can do the ptr cast

4 years agoTrailing full stop
Ralf Jung [Wed, 13 Nov 2019 08:05:57 +0000 (09:05 +0100)]
Trailing full stop

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
4 years agoAuto merge of #65637 - ssomers:master, r=scottmcm
bors [Wed, 13 Nov 2019 03:48:42 +0000 (03:48 +0000)]
Auto merge of #65637 - ssomers:master, r=scottmcm

proposal for BTreeMap/Set min/max, #62924

- Which pair of names: #62924 lists the existing possibilities min/max, first/last, (EDIT) front/back, peek(/peek_back?). Iterators have next/next_back or next/last. I'm slightly in favour of first/last because min/max might suggest they search over the entire map, and front/back pretends they are only about position.
- Return key only instead of pair like iterator does?
- If not, then keep the _key_value suffix? ~~Also provide variant with mutable value? But there is no such variant for get_key_value.~~
- Look for and upgrade more usages of `.iter().next()` and such in the libraries? I only upgraded the ones I contributed myself, all very recently.

4 years agotidy up!
Dylan DPC [Wed, 13 Nov 2019 01:16:01 +0000 (02:16 +0100)]
tidy up!

4 years agoUpdate error_codes.rs
Dylan DPC [Wed, 13 Nov 2019 00:50:12 +0000 (01:50 +0100)]
Update error_codes.rs

4 years agoUpdate error_codes.rs
Dylan DPC [Wed, 13 Nov 2019 00:47:25 +0000 (01:47 +0100)]
Update error_codes.rs

4 years agoAuto merge of #66156 - Mark-Simulacrum:stage0-step, r=pietroalbini
bors [Wed, 13 Nov 2019 00:42:19 +0000 (00:42 +0000)]
Auto merge of #66156 - Mark-Simulacrum:stage0-step, r=pietroalbini

Stage0 step

r? @pietroalbini

4 years agoRemove no longer needed mutability
Mark Rousskov [Tue, 12 Nov 2019 21:37:22 +0000 (16:37 -0500)]
Remove no longer needed mutability

4 years agoCompiletest bump to stage0 bootstrap libtest
Mark Rousskov [Wed, 6 Nov 2019 20:17:02 +0000 (15:17 -0500)]
Compiletest bump to stage0 bootstrap libtest

4 years agoHopefully fix rustdoc build
Mark Rousskov [Tue, 5 Nov 2019 16:16:46 +0000 (11:16 -0500)]
Hopefully fix rustdoc build

It's super unclear why this broke when we switched to beta but not
previously -- but at least it's hopefully fixed now.

4 years agoSnap cfgs
Mark Rousskov [Wed, 6 Nov 2019 13:09:55 +0000 (08:09 -0500)]
Snap cfgs

4 years agoBump version to 1.41
Mark Rousskov [Wed, 6 Nov 2019 13:01:56 +0000 (08:01 -0500)]
Bump version to 1.41

4 years agoAuto merge of #60026 - Aaron1011:feature/miri-unwind, r=RalfJung,oli-obk
bors [Tue, 12 Nov 2019 21:27:04 +0000 (21:27 +0000)]
Auto merge of #60026 - Aaron1011:feature/miri-unwind, r=RalfJung,oli-obk

Add hooks for Miri panic unwinding

This commits adds in some additional hooks to allow Miri to properly
handle panic unwinding. None of this should have any impact on CTFE mode

This supports https://github.com/rust-lang/miri/pull/693

4 years agoRegister queries with self profiler in rustc_interface
Mark Rousskov [Tue, 12 Nov 2019 16:44:01 +0000 (11:44 -0500)]
Register queries with self profiler in rustc_interface

4 years agoRemove dead code for encoding/decoding lint IDs
Mark Rousskov [Tue, 12 Nov 2019 16:20:01 +0000 (11:20 -0500)]
Remove dead code for encoding/decoding lint IDs

This helps decouple the lint system from needing the implicit TLS TyCtxt
as well.

4 years agoAuto merge of #65608 - matthewjasper:mir-eval-order, r=pnkfelix
bors [Tue, 12 Nov 2019 18:02:54 +0000 (18:02 +0000)]
Auto merge of #65608 - matthewjasper:mir-eval-order, r=pnkfelix

Fix MIR lowering evaluation order and soundness bug

* Fixes a soundness issue with built-in index operations
* Ensures correct evaluation order of assignment expressions where the RHS is a FRU or is a use of a local of reference type.
* Removes an unnecessary symbol to string conversion

closes #65909
closes #65910

4 years agoMove self-profile infrastructure to data structures
Mark Rousskov [Mon, 11 Nov 2019 22:15:36 +0000 (17:15 -0500)]
Move self-profile infrastructure to data structures

The single dependency on queries (QueryName) can be fairly easily
abstracted via a trait and this further decouples Session from librustc
(the primary goal).

4 years agoFallback to the unmodified path in bindir_relative
Josh Stone [Tue, 12 Nov 2019 17:42:46 +0000 (09:42 -0800)]
Fallback to the unmodified path in bindir_relative

4 years agoAdd test for issue-63279
Yuki Okushi [Tue, 12 Nov 2019 15:37:00 +0000 (00:37 +0900)]
Add test for issue-63279

4 years agoAdd test for issue-52432
Yuki Okushi [Tue, 12 Nov 2019 15:36:38 +0000 (00:36 +0900)]
Add test for issue-52432

4 years agoAdd test for issue-40231
Yuki Okushi [Tue, 12 Nov 2019 15:36:20 +0000 (00:36 +0900)]
Add test for issue-40231

4 years agoAdd test for issue-30904
Yuki Okushi [Tue, 12 Nov 2019 15:35:57 +0000 (00:35 +0900)]
Add test for issue-30904

4 years agoMove NonExhaustive checks to the relevant match branches
Nadrieril [Tue, 12 Nov 2019 14:51:59 +0000 (14:51 +0000)]
Move NonExhaustive checks to the relevant match branches

4 years agoIntroduce Constructor::NonExhaustive
Nadrieril [Tue, 12 Nov 2019 12:44:00 +0000 (12:44 +0000)]
Introduce Constructor::NonExhaustive

It counts as an extra constructor for types that are not allowed to be
matched exhaustively.

4 years agoMatch constructor first in Constructor methods
Nadrieril [Tue, 12 Nov 2019 10:36:56 +0000 (10:36 +0000)]
Match constructor first in Constructor methods

This makes it easier to add new non-standard constructors, and this also
ensures that we don't forget cases when adding a new constructor.

4 years agoAuto merge of #66318 - mati865:llvm-update, r=matthewjasper
bors [Tue, 12 Nov 2019 12:55:02 +0000 (12:55 +0000)]
Auto merge of #66318 - mati865:llvm-update, r=matthewjasper

Update LLVM submodule

Fixes https://github.com/rust-lang/rust/issues/66315

4 years agoUpdate llvm submodule
Mateusz Mikuła [Tue, 12 Nov 2019 10:02:17 +0000 (11:02 +0100)]
Update llvm submodule

4 years agoAuto merge of #66323 - JohnTitor:rollup-jl8xdk4, r=JohnTitor
bors [Tue, 12 Nov 2019 08:23:32 +0000 (08:23 +0000)]
Auto merge of #66323 - JohnTitor:rollup-jl8xdk4, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #65965 (Clean up librustc_typeck error_codes file)
 - #66230 (remove vestigial comments referring to defunct numeric trait hierarchy)
 - #66241 (bump openssl version)
 - #66257 (Drop long-section-names linker workaround for windows-gnu)
 - #66263 (make the error message more readable)
 - #66267 (Add rustdoc doc)
 - #66276 (Move lock into CodeStats)
 - #66278 (Fix error message about exported symbols from proc-macro crates)
 - #66280 (Fix HashSet::union performance)
 - #66299 (support issue = "none" in unstable attributes )
 - #66309 (Tiny cleanup to size assertions)

Failed merges:

r? @ghost

4 years agoRollup merge of #66309 - petrochenkov:annoying, r=Mark-Simulacrum
Yuki Okushi [Tue, 12 Nov 2019 07:36:18 +0000 (16:36 +0900)]
Rollup merge of #66309 - petrochenkov:annoying, r=Mark-Simulacrum

Tiny cleanup to size assertions

The need to write `#[cfg(target_arch = "x86_64")]` twice mildly annoys me, the full paths look better in comparison.

4 years agoRollup merge of #66299 - rossmacarthur:fix-41260-avoid-issue-0, r=varkor
Yuki Okushi [Tue, 12 Nov 2019 07:36:16 +0000 (16:36 +0900)]
Rollup merge of #66299 - rossmacarthur:fix-41260-avoid-issue-0, r=varkor

support issue = "none" in unstable attributes

This works towards fixing #41260.

This PR allows the use of `issue = "none"` in unstable attributes and makes changes to internally store the issue number as an `Option<NonZeroU32>`. For example:

```rust
#[unstable(feature = "unstable_test_feature", issue = "none")]
fn unstable_issue_none() {}
```

It was not made optional because feedback seen here #60860 suggested that people might forget the issue field if it was optional.

I could not remove the current uses of `issue = "0"` (of which there are a lot) because the stage 0 compiler expects the old syntax. Once this is available in the stage 0 compiler we can replace all uses of `"0"` with `"none"` and no longer allow `"0"`. This is my first time contributing, so I'm not sure what the protocol is with two-part things like this, so some guidance would be appreciated.

r? @varkor

4 years agoRollup merge of #66280 - stepancheg:union, r=alexcrichton
Yuki Okushi [Tue, 12 Nov 2019 07:36:15 +0000 (16:36 +0900)]
Rollup merge of #66280 - stepancheg:union, r=alexcrichton

Fix HashSet::union performance

Consider this example: small_set = 0..2, large_set = 0..1000.

To efficiently compute the union of these sets, we should
* take all elements of the larger set
* for each element of the smaller set check it is not in the larger set

This is exactly what this commit does.

This particular optimization was implemented a year ago, but the
author mistaken `<` and `>`.

4 years agoRollup merge of #66278 - LukasKalbertodt:fix-proc-macro-error, r=Centril
Yuki Okushi [Tue, 12 Nov 2019 07:36:13 +0000 (16:36 +0900)]
Rollup merge of #66278 - LukasKalbertodt:fix-proc-macro-error, r=Centril

Fix error message about exported symbols from proc-macro crates

Someone forgot to update the error message after `#[proc_macro]` and
`#[proc_macro_attribute]` were stabilized.

4 years agoRollup merge of #66276 - Mark-Simulacrum:sess-code-stats, r=nikomatsakis
Yuki Okushi [Tue, 12 Nov 2019 07:36:12 +0000 (16:36 +0900)]
Rollup merge of #66276 - Mark-Simulacrum:sess-code-stats, r=nikomatsakis

Move lock into CodeStats

Prevent (theoretical) accidental too-long borrows by ensuring only encapsulated locking.

4 years agoRollup merge of #66267 - GuillaumeGomez:add-rustdoc-doc, r=kinnison
Yuki Okushi [Tue, 12 Nov 2019 07:36:10 +0000 (16:36 +0900)]
Rollup merge of #66267 - GuillaumeGomez:add-rustdoc-doc, r=kinnison

Add rustdoc doc

r? @kinnison

4 years agoRollup merge of #66263 - guanqun:make-error-explicit, r=alexcrichton
Yuki Okushi [Tue, 12 Nov 2019 07:36:08 +0000 (16:36 +0900)]
Rollup merge of #66263 - guanqun:make-error-explicit, r=alexcrichton

make the error message more readable

When I type it wrong e.g. `--stage --bless`, missing a number here, this change would make it more explicit what's going wrong here.

4 years agoRollup merge of #66257 - mati865:long-section-names-no-more, r=alexcrichton
Yuki Okushi [Tue, 12 Nov 2019 07:36:07 +0000 (16:36 +0900)]
Rollup merge of #66257 - mati865:long-section-names-no-more, r=alexcrichton

Drop long-section-names linker workaround for windows-gnu

If we can trust objdump Rust doesn't emit sections loaded at runtime longer than 8 characters on windows-gnu (but still does on linux-gnu), debug sections are not affected by that limit.
I've ran tests and built few crates using exactly the same mingw-w64 version as Rusts CI just fine using **x86_64** toolchain.

The motivation for this change is making LLD work (it doesn't support `--enable-long-section-names`) with this target without hacks.

Bit of history:
The behaviour of LD changed in Binutils 2.20 released on 2009-10-16 and `--enable-long-section-names` was added to return to the old non conformant behaviour. Looking at the comment I can only guess there was a bug fixed in newer versions.

This workaround was added in https://github.com/rust-lang/rust/pull/13315 half a decade ago.

4 years agoRollup merge of #66241 - lzutao:ssl, r=alexcrichton
Yuki Okushi [Tue, 12 Nov 2019 07:36:05 +0000 (16:36 +0900)]
Rollup merge of #66241 - lzutao:ssl, r=alexcrichton

bump openssl version

Fixes #65808

This PR updates `openssl` and `openssl-sys` to support newer versions of `libressl` in `rust` builds.

4 years agoRollup merge of #66230 - Axelderan:remove-vestigial-comments, r=alexcrichton
Yuki Okushi [Tue, 12 Nov 2019 07:36:03 +0000 (16:36 +0900)]
Rollup merge of #66230 - Axelderan:remove-vestigial-comments, r=alexcrichton

remove vestigial comments referring to defunct numeric trait hierarchy

I've been poking around the numeric trait hierarchy and also some of the actual numeric type implementations.

This is a small change but a matter of effective communication.  I looked for other related references and saw none.

4 years agoRollup merge of #65965 - GuillaumeGomez:clean-up-librustc_typeck-error-codes, r=Mark...
Yuki Okushi [Tue, 12 Nov 2019 07:36:01 +0000 (16:36 +0900)]
Rollup merge of #65965 - GuillaumeGomez:clean-up-librustc_typeck-error-codes, r=Mark-Simulacrum

Clean up librustc_typeck error_codes file

r? @Dylan-DPC

4 years agoAuto merge of #66129 - Nadrieril:refactor-slice-pat-usefulness, r=varkor
bors [Tue, 12 Nov 2019 04:44:30 +0000 (04:44 +0000)]
Auto merge of #66129 - Nadrieril:refactor-slice-pat-usefulness, r=varkor

Refactor slice pattern usefulness checking

As a follow up to https://github.com/rust-lang/rust/pull/65874, this PR changes how variable-length slice patterns are handled in usefulness checking. The objectives are: cleaning up that code to make it easier to understand, and paving the way to handling fixed-length slices more cleverly too, for https://github.com/rust-lang/rust/issues/53820.

Before this, variable-length slice patterns were eagerly expanded into a union of fixed-length slices. Now they have their own special constructor, which allows expanding them a bit more lazily.
As a nice side-effect, this improves diagnostics.

This PR shows a slight performance improvement, mostly due to https://github.com/rust-lang/rust/pull/66129/commits/149792b6080f40875c0072aae378a0eb31d23df0. This will probably have to be reverted in some way when we implement or-patterns.

4 years agoadd Result::map_or
Lzu Tao [Mon, 11 Nov 2019 13:25:19 +0000 (13:25 +0000)]
add Result::map_or

4 years agoAuto merge of #66310 - Manishearth:clippyup, r=Manishearth
bors [Mon, 11 Nov 2019 22:33:10 +0000 (22:33 +0000)]
Auto merge of #66310 - Manishearth:clippyup, r=Manishearth

Update clippy

Fixes #66300

r? @ghost

4 years agoUse a relative bindir for rustdoc to find rustc
Josh Stone [Mon, 11 Nov 2019 22:22:23 +0000 (14:22 -0800)]
Use a relative bindir for rustdoc to find rustc

In bootstrap, we set `RUSTC_INSTALL_BINDIR` to `config.bindir`, so
rustdoc can find rustc relative to the toolchain sysroot. However, if a
distro script like Fedora's `%configure` sets an absolute path, then
rustdoc's `sysroot.join(bin_path)` ignores that sysroot altogether.

That would be OK once the toolchain is actually installed, but it breaks
the in-tree doc tests during the build, since `/usr/bin/rustc` is still
the old version. So now we try to make `RUSTC_INSTALL_BINDIR` relative
to the sysroot prefix in the first place.

4 years agoEvaluate borrow and struct expressions in `into`
Matthew Jasper [Sat, 19 Oct 2019 20:01:36 +0000 (21:01 +0100)]
Evaluate borrow and struct expressions in `into`

This fixes some ordering problems around assignment expressions.

4 years agoFix soundness issue with index bounds checks
Matthew Jasper [Sat, 19 Oct 2019 20:00:21 +0000 (21:00 +0100)]
Fix soundness issue with index bounds checks

An expression like `x[1][{ x = y; 2}]` would perform the bounds check
for the inner index operation before evaluating the outer index. This
would allow out of bounds memory accesses.

4 years agoAvoid a string comparison in MIR construction
Matthew Jasper [Sun, 26 May 2019 09:00:34 +0000 (10:00 +0100)]
Avoid a string comparison in MIR construction

4 years agoUpdate
Aaron Hill [Sat, 9 Nov 2019 16:02:15 +0000 (11:02 -0500)]
Update

4 years agoReturn Ok(false) instead of throwing when handling a diverging intrinsic
Aaron Hill [Wed, 6 Nov 2019 19:13:57 +0000 (14:13 -0500)]
Return Ok(false) instead of throwing when handling a diverging intrinsic

4 years agoFix rebase fallout
Aaron Hill [Wed, 6 Nov 2019 18:47:40 +0000 (13:47 -0500)]
Fix rebase fallout

4 years agoRename to
Aaron Hill [Wed, 6 Nov 2019 18:20:08 +0000 (13:20 -0500)]
Rename  to

4 years agoFix debug assertion
Aaron Hill [Tue, 5 Nov 2019 05:22:49 +0000 (00:22 -0500)]
Fix debug assertion

4 years agoRemove trampoline, pass `ret` and `unwind` when handling intrinsics
Aaron Hill [Tue, 5 Nov 2019 05:06:05 +0000 (00:06 -0500)]
Remove trampoline, pass `ret` and `unwind` when handling intrinsics

4 years agoFix tidy
Aaron Hill [Mon, 4 Nov 2019 21:10:35 +0000 (16:10 -0500)]
Fix tidy

4 years agoAdd more detailed codegen comment
Aaron Hill [Mon, 4 Nov 2019 21:10:02 +0000 (16:10 -0500)]
Add more detailed codegen comment

4 years agoMove to miri.rs and re-export it
Aaron Hill [Mon, 4 Nov 2019 20:34:19 +0000 (15:34 -0500)]
Move  to miri.rs and re-export it

4 years agoSome code cleanup
Aaron Hill [Mon, 4 Nov 2019 20:00:41 +0000 (15:00 -0500)]
Some code cleanup

4 years agoMake doc comment more accurate
Aaron Hill [Mon, 4 Nov 2019 18:49:50 +0000 (13:49 -0500)]
Make doc comment more accurate

4 years agoChange TODO to FIXME
Aaron Hill [Wed, 30 Oct 2019 18:40:21 +0000 (14:40 -0400)]
Change TODO to FIXME

4 years agoAdd comment
Aaron Hill [Wed, 30 Oct 2019 01:09:51 +0000 (21:09 -0400)]
Add comment

4 years agoAdd miri trampoline, fix handling of intrinsic return
Aaron Hill [Wed, 30 Oct 2019 01:03:30 +0000 (21:03 -0400)]
Add miri trampoline, fix handling of intrinsic return

4 years agoUse proper intrinsic type
Aaron Hill [Tue, 29 Oct 2019 22:48:29 +0000 (18:48 -0400)]
Use proper intrinsic type

4 years agoMore work on miri_start_panic
Aaron Hill [Tue, 29 Oct 2019 22:23:36 +0000 (18:23 -0400)]
More work on miri_start_panic

4 years agoFix up intrinsic implementation
Aaron Hill [Tue, 29 Oct 2019 21:31:54 +0000 (17:31 -0400)]
Fix up intrinsic implementation

4 years agoAdd explicit Miri support to libpanic_unwind
Aaron Hill [Tue, 29 Oct 2019 02:44:30 +0000 (22:44 -0400)]
Add explicit Miri support to libpanic_unwind

4 years agoDon't attempt to get cwd when printing backtrace under Miri
Aaron Hill [Tue, 29 Oct 2019 02:23:41 +0000 (22:23 -0400)]
Don't attempt to get cwd when printing backtrace under Miri

This allows Miri to print backtraces in isolation mode

4 years agoFix unwinding logic
Aaron Hill [Tue, 29 Oct 2019 01:37:58 +0000 (21:37 -0400)]
Fix unwinding logic

4 years agoSome cleanup
Aaron Hill [Mon, 28 Oct 2019 23:09:54 +0000 (19:09 -0400)]
Some cleanup