]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoClean some error codes diagnostics
Guillaume Gomez [Mon, 11 Nov 2019 22:34:57 +0000 (23:34 +0100)]
Clean some error codes diagnostics

4 years agofix tidy issue on file length
Guillaume Gomez [Mon, 11 Nov 2019 22:19:10 +0000 (23:19 +0100)]
fix tidy issue on file length

4 years agoregen
Guillaume Gomez [Mon, 11 Nov 2019 21:47:05 +0000 (22:47 +0100)]
regen

4 years agoRemove unused error_codes.rs files
Guillaume Gomez [Mon, 11 Nov 2019 21:46:36 +0000 (22:46 +0100)]
Remove unused error_codes.rs files

4 years agoUpdate to use new librustc_error_codes library
Guillaume Gomez [Mon, 11 Nov 2019 21:46:56 +0000 (22:46 +0100)]
Update to use new librustc_error_codes library

4 years agoCreate new librustc_error_codes lib and move error codes declaration inside it
Guillaume Gomez [Mon, 11 Nov 2019 21:45:32 +0000 (22:45 +0100)]
Create new librustc_error_codes lib and move error codes declaration inside it

4 years agoAuto merge of #66403 - JohnTitor:rollup-7obuivl, r=JohnTitor
bors [Thu, 14 Nov 2019 08:03:01 +0000 (08:03 +0000)]
Auto merge of #66403 - JohnTitor:rollup-7obuivl, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #66253 (Improve errors after re rebalance coherence)
 - #66264 (fix an ICE in macro's diagnostic message)
 - #66349 (expand source_util macros with def-site context)
 - #66351 (Tweak non-char/numeric in range pattern diagnostic)
 - #66360 (Fix link to Exten in Vec::set_len)
 - #66361 (parser: don't use `unreachable!()` in `fn unexpected`.)
 - #66363 (Improve error message in make_tests)
 - #66369 (compiletest: Obtain timestamps for common inputs only once)
 - #66372 (Fix broken links in Ipv4Addr::is_benchmarking docs)

Failed merges:

r? @ghost

4 years agoRollup merge of #66372 - ogham:patch-2, r=jonas-schievink
Yuki Okushi [Thu, 14 Nov 2019 05:16:27 +0000 (14:16 +0900)]
Rollup merge of #66372 - ogham:patch-2, r=jonas-schievink

Fix broken links in Ipv4Addr::is_benchmarking docs

[The documentation for `Ipv4Addr::is_benchmarking`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_benchmarking) is correct — it has the right RFC number — but the Markdown links are broken. Looks like a copy-and-paste error and a typo.

This PR fixes the links to make them clickable.

4 years agoRollup merge of #66369 - tmiasko:compiletest-stamp, r=Mark-Simulacrum
Yuki Okushi [Thu, 14 Nov 2019 05:16:26 +0000 (14:16 +0900)]
Rollup merge of #66369 - tmiasko:compiletest-stamp, r=Mark-Simulacrum

compiletest: Obtain timestamps for common inputs only once

Obtain timestamps for common inputs (e.g., libraries in run-lib path, or
sources in `src/tool/compiletest/`) only once and reuse the result,
instead of repeating the work for each test case.

4 years agoRollup merge of #66363 - Munksgaard:patch-1, r=dtolnay
Yuki Okushi [Thu, 14 Nov 2019 05:16:25 +0000 (14:16 +0900)]
Rollup merge of #66363 - Munksgaard:patch-1, r=dtolnay

Improve error message in make_tests

We should use expect instead of unwrap.

This commit is based on https://github.com/laumann/compiletest-rs/pull/58. Thanks to @colin-kiegel.

4 years agoRollup merge of #66361 - Centril:66357, r=pnkfelix
Yuki Okushi [Thu, 14 Nov 2019 05:16:23 +0000 (14:16 +0900)]
Rollup merge of #66361 - Centril:66357, r=pnkfelix

parser: don't use `unreachable!()` in `fn unexpected`.

Fixes #66357

r? @estebank

4 years agoRollup merge of #66360 - elichai:2019-11-vec-link, r=dtolnay
Yuki Okushi [Thu, 14 Nov 2019 05:16:22 +0000 (14:16 +0900)]
Rollup merge of #66360 - elichai:2019-11-vec-link, r=dtolnay

Fix link to Exten in Vec::set_len

Fixes #66354

Unrelated to this PR, I think we should stop using `../../std/MODULE` and replace it with `../MODULE` that way if you're looking at docs in `core` or `alloc` clicking at a link won't forward you to `std`.

4 years agoRollup merge of #66351 - JohnTitor:tweak-range-err-msg, r=Centril
Yuki Okushi [Thu, 14 Nov 2019 05:16:20 +0000 (14:16 +0900)]
Rollup merge of #66351 - JohnTitor:tweak-range-err-msg, r=Centril

Tweak non-char/numeric in range pattern diagnostic

Fixes #66283

r? @estebank

4 years agoRollup merge of #66349 - euclio:def-site-builtins, r=petrochenkov
Yuki Okushi [Thu, 14 Nov 2019 05:16:19 +0000 (14:16 +0900)]
Rollup merge of #66349 - euclio:def-site-builtins, r=petrochenkov

expand source_util macros with def-site context

cc @petrochenkov

See https://internals.rust-lang.org/t/spans-from-built-in-macro-expansions-are-not-from-expansion/11276/2 for context.

4 years agoRollup merge of #66264 - guanqun:fix-mbe-missing-close-delim, r=estebank
Yuki Okushi [Thu, 14 Nov 2019 05:16:17 +0000 (14:16 +0900)]
Rollup merge of #66264 - guanqun:fix-mbe-missing-close-delim, r=estebank

fix an ICE in macro's diagnostic message

This has two small fixes:
1. for the left brace, we don't need `<space>{`, simply `{` is enough.
2. for the right brace, it tries to peel off one character even when the close delim is missing. Without this fix, it would crash in some cases. (as shown in the new test case)

r? @estebank

4 years agoRollup merge of #66253 - ohadravid:improve-errors-after-re-rebalance-coherence, r...
Yuki Okushi [Thu, 14 Nov 2019 05:16:16 +0000 (14:16 +0900)]
Rollup merge of #66253 - ohadravid:improve-errors-after-re-rebalance-coherence, r=estebank

Improve errors after re rebalance coherence

Following #65247, I noticed that some error messages should be updated to reflect the changes of `re_rebalance_coherence` (also there was a [note](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html#teaching-users) in the RFC about it).

First, error message `E0210` was updated to match the RFC, and I also tried to improve a little the error when the "order" of types is problematic.

For code like this:
```
#![feature(re_rebalance_coherence)] // Now stable

struct Wrap<T>(T);

impl<T> From<Wrap<T>> for T {
    fn from(x: Wrap<T>) -> T {
        x.0
    }
}
```

The old error was:
```
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
 --> src/lib.rs:5:6
  |
5 | impl<T> From<Wrap<T>> for T {
  |      ^ type parameter `T` must be used as the type parameter for some local type
  |
  = note: only traits defined in the current crate can be implemented for a type parameter

```

and the new error is:
```
error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Wrap<T>`)
  --> main.rs:66:6
   |
66 | impl<T> From<Wrap<T>> for T {
   |      ^ type parameter `T` must be covered by another type when it appears before the first local type (`Wrap<T>`)
   |
   = note: implementing a foreign trait is only possible if at least one of the types for which is it implemented is local, and no uncovered type parameters appear before that first local type
   = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last
```

I tried to point at the uncovered `T`, but couldn't get something which was reliable (but I'll be happy to try if someone points me in the right direction).

r? @estebank
cc @nikomatsakis

Fixes #65247

4 years agoAuto merge of #66233 - cjgillot:constkind, r=oli-obk
bors [Thu, 14 Nov 2019 04:54:51 +0000 (04:54 +0000)]
Auto merge of #66233 - cjgillot:constkind, r=oli-obk

Split ConstValue into two enums

Hello,

Issue #59210 appeared abandoned, so I gave it a go.
Some further cleanup and refactoring may be mandated.

I did not test beyond `x.py check`, since my home computer dies compiling librustc.

Fixes #59210

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 agocompiletest: Avoid double negation in ignore condition
Tomasz Miąsko [Wed, 13 Nov 2019 00:00:00 +0000 (00:00 +0000)]
compiletest: Avoid double negation in ignore condition

4 years agocompiletest: Obtain timestamps for common inputs only once
Tomasz Miąsko [Mon, 11 Nov 2019 00:00:00 +0000 (00:00 +0000)]
compiletest: Obtain timestamps for common inputs only once

Obtain timestamps for common inputs (e.g., libraries in run-lib path, or
sources in `src/tool/compiletest/`) only once and reuse the result,
instead of repeating the work for each test case.

No functional changes intended.

4 years agoAvoid using same code
Yuki Okushi [Wed, 13 Nov 2019 14:22:48 +0000 (23:22 +0900)]
Avoid using same code

4 years agoFix broken links in Ipv4Addr::is_benchmarking docs
Benjamin Sago [Wed, 13 Nov 2019 15:09:40 +0000 (15:09 +0000)]
Fix broken links in Ipv4Addr::is_benchmarking docs

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 agoImprove error message in make_tests
Philip Munksgaard [Wed, 13 Nov 2019 11:44:43 +0000 (12:44 +0100)]
Improve error message in make_tests

We should use expect instead of unwrap.

This commit is based on https://github.com/laumann/compiletest-rs/pull/58. Thanks to @colin-kiegel.

4 years agoparser: don't use `unreachable!()` in `fn unexpected`.
Mazdak Farrokhzad [Wed, 13 Nov 2019 11:05:37 +0000 (12:05 +0100)]
parser: don't use `unreachable!()` in `fn unexpected`.

4 years agoDoc: Fix link to Exten in Vec::set_len
Elichai Turkel [Wed, 13 Nov 2019 10:53:24 +0000 (12:53 +0200)]
Doc: Fix link to Exten in Vec::set_len

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 agoTweak non-char/numeric in range pattern diagnostic
Yuki Okushi [Tue, 12 Nov 2019 23:27:53 +0000 (08:27 +0900)]
Tweak non-char/numeric in range pattern diagnostic

4 years agoexpand source_util macros with def-site context
Andy Russell [Tue, 12 Nov 2019 22:48:33 +0000 (17:48 -0500)]
expand source_util macros with def-site context

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 agoBless mir-dump test.
Camille GILLOT [Tue, 12 Nov 2019 21:02:55 +0000 (22:02 +0100)]
Bless mir-dump test.

4 years agoBless symbol-names.
Camille GILLOT [Tue, 12 Nov 2019 19:09:31 +0000 (20:09 +0100)]
Bless symbol-names.

4 years agoCentril review.
Camille GILLOT [Sat, 9 Nov 2019 10:43:32 +0000 (11:43 +0100)]
Centril review.

4 years agoFix tidy.
Camille GILLOT [Sat, 9 Nov 2019 10:30:51 +0000 (11:30 +0100)]
Fix tidy.

4 years agoRemove cruft.
Camille GILLOT [Fri, 8 Nov 2019 23:06:37 +0000 (00:06 +0100)]
Remove cruft.

4 years agoRename in librustdoc.
Camille GILLOT [Fri, 8 Nov 2019 22:19:55 +0000 (23:19 +0100)]
Rename in librustdoc.

4 years agoRename in librustc_codegen_llvm.
Camille GILLOT [Fri, 8 Nov 2019 22:19:46 +0000 (23:19 +0100)]
Rename in librustc_codegen_llvm.

4 years agoRename in librustc_codegen_ssa.
Camille GILLOT [Fri, 8 Nov 2019 22:12:26 +0000 (23:12 +0100)]
Rename in librustc_codegen_ssa.

4 years agoRename in librustc_codegen_utils.
Camille GILLOT [Fri, 8 Nov 2019 22:12:17 +0000 (23:12 +0100)]
Rename in librustc_codegen_utils.

4 years agoRename in librustc_mir.
Camille GILLOT [Fri, 8 Nov 2019 22:11:51 +0000 (23:11 +0100)]
Rename in librustc_mir.

4 years agoRename in librustc_typecheck.
Camille GILLOT [Fri, 8 Nov 2019 22:11:43 +0000 (23:11 +0100)]
Rename in librustc_typecheck.

4 years agoRename in librustc_traits.
Camille GILLOT [Fri, 8 Nov 2019 22:11:31 +0000 (23:11 +0100)]
Rename in librustc_traits.

4 years agoRefactor pretty_print_const.
Camille GILLOT [Fri, 8 Nov 2019 20:55:19 +0000 (21:55 +0100)]
Refactor pretty_print_const.

4 years agoCreate intermediate enum ty::ConstKind.
Camille GILLOT [Fri, 8 Nov 2019 20:32:56 +0000 (21:32 +0100)]
Create intermediate enum ty::ConstKind.

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