Commit Graph

102391 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
89b5907357 TAIT: adjust save-analysis 2019-11-14 13:40:42 +01:00
Mazdak Farrokhzad
e31d75caee TAIT: remove redundant check from ast_validation 2019-11-14 13:40:42 +01:00
Mazdak Farrokhzad
aa6a72f4a5 TAIT: use hack in ->HIR to avoid more changes 2019-11-14 13:40:42 +01:00
Mazdak Farrokhzad
0e8e176b69 TAIT: parse recursively instead of hack. 2019-11-14 13:40:42 +01:00
Mazdak Farrokhzad
6d8e300e35 TAIT: feature gate recursive locations 2019-11-14 13:40:42 +01:00
Mazdak Farrokhzad
6a49b523be TAIT: remove OpaqueTy in AST. 2019-11-14 13:40:42 +01:00
Guillaume Gomez
b5b2a8984e Move E0210 to new error location 2019-11-14 13:08:23 +01:00
Guillaume Gomez
bfa3d599eb move E0744 to new error code 2019-11-14 13:05:56 +01:00
Guillaume Gomez
27b58edc23 Update rustc --explain to the new error codes format 2019-11-14 13:05:56 +01:00
Guillaume Gomez
411f94c3b9 move E0623 into the new error code format 2019-11-14 13:05:56 +01:00
Guillaume Gomez
356da40db5 Adapt error index generator to the new format 2019-11-14 13:05:56 +01:00
Guillaume Gomez
ec50a750f9 Fix error codes index generation 2019-11-14 13:05:56 +01:00
Guillaume Gomez
cfd4e9722e Fix ui tests with better error code usage 2019-11-14 13:05:56 +01:00
Guillaume Gomez
cd274632f8 Put each error code long explanation into their own markdown file 2019-11-14 13:05:56 +01:00
Guillaume Gomez
3302190b67 Clean some error codes diagnostics 2019-11-14 13:05:56 +01:00
Guillaume Gomez
0aea1ca014 fix tidy issue on file length 2019-11-14 13:05:56 +01:00
Guillaume Gomez
125da0cf2a regen 2019-11-14 13:05:56 +01:00
Guillaume Gomez
4963116e59 Remove unused error_codes.rs files 2019-11-14 13:05:56 +01:00
Guillaume Gomez
798e389e57 Update to use new librustc_error_codes library 2019-11-14 13:05:42 +01:00
Guillaume Gomez
3816fce76c Create new librustc_error_codes lib and move error codes declaration inside it 2019-11-14 13:05:42 +01:00
Yuki Okushi
a9a75dfe3b Update Clippy 2019-11-14 21:04:08 +09:00
bors
d63b24ffcc Auto merge of #66378 - rkruppe:revert-pr-65134, r=pnkfelix
Revert #65134

To stop giving people on nightly reasons to `allow(improper_ctypes)` while tweaks to the lint are being prepared.

cc #66220
2019-11-14 11:06:41 +00:00
Ralf Jung
6c9ba97d23 miri: helper methods for max values of machine's usize/isize 2019-11-14 10:42:54 +01:00
bors
a2491ee4e6 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
2019-11-14 08:03:01 +00:00
Yuki Okushi
d145d1e72c
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.
2019-11-14 14:16:27 +09:00
Yuki Okushi
8bd84653af
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.
2019-11-14 14:16:26 +09:00
Yuki Okushi
2d453b3907
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.
2019-11-14 14:16:25 +09:00
Yuki Okushi
8d059974f7
Rollup merge of #66361 - Centril:66357, r=pnkfelix
parser: don't use `unreachable!()` in `fn unexpected`.

Fixes #66357

r? @estebank
2019-11-14 14:16:23 +09:00
Yuki Okushi
28c0e40b44
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`.
2019-11-14 14:16:22 +09:00
Yuki Okushi
20c356263d
Rollup merge of #66351 - JohnTitor:tweak-range-err-msg, r=Centril
Tweak non-char/numeric in range pattern diagnostic

Fixes #66283

r? @estebank
2019-11-14 14:16:20 +09:00
Yuki Okushi
2acbd3dd54
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.
2019-11-14 14:16:19 +09:00
Yuki Okushi
187e9118cc
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
2019-11-14 14:16:17 +09:00
Yuki Okushi
79e2afc28c
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
2019-11-14 14:16:16 +09:00
bors
5e380b797b 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
2019-11-14 04:54:51 +00:00
Steven Fackler
3fe7cfc326 Remove some stack frames from .async calls
The `Context` argument is currently smuggled through TLS for
async-generated futures. The current infrastructure is closure-based,
and results in an extra 6 stack frames when .awaiting an async-generated
future!

```
  12: foo::async_b::{{closure}}
             at src/main.rs:10
  13: <std::future::GenFuture<T> as core::future::future::Future>::poll::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:43
  14: std::future::set_task_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:79
  15: <std::future::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:43
  16: std::future::poll_with_tls_context::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:121
  17: std::future::get_task_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:111
  18: std::future::poll_with_tls_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:121
  19: foo::async_a::{{closure}}
             at src/main.rs:6
```

While the long (medium?) term solution is to remove the use of TLS
entirely, we can improve things a bit in the meantime. In particular,
this commit does 2 things:

1. `get_task_context` has been inlined into `poll_with_tls_context`,
    removing 2 frames (16 and 17 above).
2. `set_task_context` now returns a guard type that resets the TLS
    rather than taking a closure, removing 2 frames (13 and 14 above).

We can also remove frame 18 by removing `poll_with_tls_context` in favor
of a `get_task_context` function which returns a guard, but that
requires adjusting the code generated for .await, so I've left that off
for now.
2019-11-13 17:14:50 -08:00
Esteban Küber
7d61484b46 Do not ICE in if without else in async fn 2019-11-13 15:22:45 -08:00
bors
3f07f1cd78 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
2019-11-13 23:22:03 +00:00
Esteban Küber
41372631ff Fix ICE when trying to suggest Type<> instead of Type() 2019-11-13 14:45:58 -08:00
Esteban Küber
bc1bd95e5a Do not ICE on recovery from unmet associated type bound obligation 2019-11-13 14:28:15 -08:00
bors
ded5ee0013 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)
2019-11-13 20:10:54 +00:00
Dylan MacKenzie
7552bd662f Use ast::Mutability 2019-11-13 10:46:44 -08:00
Dylan MacKenzie
5e048da5a5 Bless miri unleashed test now that errors are mandatory 2019-11-13 10:44:14 -08:00
Dylan MacKenzie
86734b13bb 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.
2019-11-13 10:44:14 -08:00
Dylan MacKenzie
70aa781c2d Change control flow error to delay span bug 2019-11-13 10:44:14 -08:00
Dylan MacKenzie
0123cbdc31 Fix broken doc-test 2019-11-13 10:44:14 -08:00
Dylan MacKenzie
eff83e5f49 Small fixes to comments 2019-11-13 10:44:14 -08:00
Dylan MacKenzie
281e898ecf 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.
2019-11-13 10:44:14 -08:00
Dylan MacKenzie
3ce8ca45d6 Bless const tests with improved diagnostics 2019-11-13 10:44:14 -08:00
Dylan MacKenzie
67336bb399 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.
2019-11-13 10:44:14 -08:00
Dylan MacKenzie
92386e8e57 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.
2019-11-13 10:44:13 -08:00