Commit Graph

102199 Commits

Author SHA1 Message Date
Dylan MacKenzie
33b62be862 Get FnSig by HirId 2019-11-13 10:44:13 -08:00
Dylan MacKenzie
8b7d2bc270 Add E0744 for control flow in consts 2019-11-13 10:44:13 -08:00
bors
695fe96517 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
2019-11-13 13:16:53 +00:00
Yuki Okushi
d52dafd2a8
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.
2019-11-13 22:09:31 +09:00
Yuki Okushi
fab583bdfc
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.
2019-11-13 22:09:29 +09:00
Yuki Okushi
f735cd2f89
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.
2019-11-13 22:09:28 +09:00
Yuki Okushi
5683fe5a48
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
2019-11-13 22:09:26 +09:00
Yuki Okushi
60ba5c70fc
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.
2019-11-13 22:09:25 +09:00
Yuki Okushi
1cbd34faf2
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
2019-11-13 22:09:23 +09:00
Yuki Okushi
c75a48a924
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
2019-11-13 22:09:22 +09:00
Yuki Okushi
961d51dcbb
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`.
2019-11-13 22:09:20 +09:00
Yuki Okushi
689cc04614
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.
2019-11-13 22:09:19 +09:00
Yuki Okushi
fac098291e
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.
2019-11-13 22:09:17 +09:00
Yuki Okushi
be3fcf4832
Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPC
Add long error explanation for E0623

Part of #61137.

r? @Dylan-DPC
2019-11-13 22:09:15 +09:00
Yuki Okushi
6eea5001b5
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
2019-11-13 22:09:13 +09:00
Yuki Okushi
e365d5aac6
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()`.
2019-11-13 22:09:11 +09:00
Yuki Okushi
4ac230ad3d
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
2019-11-13 22:09:10 +09:00
Ralf Jung
861698a493 make things ugly 2019-11-13 09:31:08 +01:00
Ralf Jung
5b5ae01340 expand docs 2019-11-13 09:11:09 +01:00
Ralf Jung
19ebe2fb6d clarify why we can do the ptr cast 2019-11-13 09:07:52 +01:00
Ralf Jung
aba385abbd
Trailing full stop
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-13 09:05:57 +01:00
bors
374ad1b006 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.
2019-11-13 03:48:42 +00:00
Dylan DPC
fd868d4bf4
tidy up! 2019-11-13 02:16:01 +01:00
Dylan DPC
1de094a28e
Update error_codes.rs 2019-11-13 01:50:12 +01:00
Dylan DPC
6a3a05580e
Update error_codes.rs 2019-11-13 01:47:25 +01:00
bors
0f12bad718 Auto merge of #66156 - Mark-Simulacrum:stage0-step, r=pietroalbini
Stage0 step

r? @pietroalbini
2019-11-13 00:42:19 +00:00
Mark Rousskov
994d83666d Remove no longer needed mutability 2019-11-12 16:37:22 -05:00
Mark Rousskov
f6832adadb Compiletest bump to stage0 bootstrap libtest 2019-11-12 16:36:57 -05:00
Mark Rousskov
8783766215 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.
2019-11-12 16:36:57 -05:00
Mark Rousskov
997feacddd Snap cfgs 2019-11-12 16:36:57 -05:00
Mark Rousskov
f4edc81ac4 Bump version to 1.41 2019-11-12 16:36:57 -05:00
bors
a333eed7fc 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
2019-11-12 21:27:04 +00:00
Mark Rousskov
2fd545485a Register queries with self profiler in rustc_interface 2019-11-12 13:13:14 -05:00
Mark Rousskov
8c29b74b15 Remove dead code for encoding/decoding lint IDs
This helps decouple the lint system from needing the implicit TLS TyCtxt
as well.
2019-11-12 13:04:31 -05:00
bors
4f03f4a989 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
2019-11-12 18:02:54 +00:00
Mark Rousskov
f696b21c5f 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).
2019-11-12 12:48:04 -05:00
Josh Stone
bfa5e5f788 Fallback to the unmodified path in bindir_relative 2019-11-12 09:42:46 -08:00
Yuki Okushi
74d45afbf5 Add test for issue-63279 2019-11-13 00:37:00 +09:00
Yuki Okushi
412f0006f5 Add test for issue-52432 2019-11-13 00:36:38 +09:00
Yuki Okushi
bae9832f71 Add test for issue-40231 2019-11-13 00:36:20 +09:00
Yuki Okushi
ec45882b42 Add test for issue-30904 2019-11-13 00:35:57 +09:00
Nadrieril
e398d897b0 Move NonExhaustive checks to the relevant match branches 2019-11-12 15:02:00 +00:00
Nadrieril
357d53c4ce Introduce Constructor::NonExhaustive
It counts as an extra constructor for types that are not allowed to be
matched exhaustively.
2019-11-12 15:02:00 +00:00
Nadrieril
eb99c73e04 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.
2019-11-12 15:02:00 +00:00
bors
5dda3ee931 Auto merge of #66318 - mati865:llvm-update, r=matthewjasper
Update LLVM submodule

Fixes https://github.com/rust-lang/rust/issues/66315
2019-11-12 12:55:02 +00:00
Mateusz Mikuła
5a1aa8def3 Update llvm submodule 2019-11-12 11:02:17 +01:00
bors
a19f93410d 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
2019-11-12 08:23:32 +00:00
Yuki Okushi
420f926306
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.
2019-11-12 16:36:18 +09:00
Yuki Okushi
4134a4acf5
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
2019-11-12 16:36:16 +09:00
Yuki Okushi
6bdd1beca6
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 `>`.
2019-11-12 16:36:15 +09:00