Commit Graph

102742 Commits

Author SHA1 Message Date
Nadrieril
3531c52bfe Factor out range construction in all_constructors 2019-11-15 16:14:32 +00:00
Nadrieril
8f7ba7a058 Clarify conditions for exhaustive integer range matching 2019-11-15 16:01:03 +00:00
Nadrieril
c75685bef6 Note link between apply/specialize/arity functions 2019-11-15 15:38:31 +00:00
Ralf Jung
065e1b8d8a more comment 2019-11-15 15:57:01 +01:00
Yuki Okushi
09f0ee51c9 Apply suggestion from Centril
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-15 23:54:52 +09:00
Yuki Okushi
564c78a698 Fix test case and issue number 2019-11-15 23:54:52 +09:00
Yuki Okushi
74329bf619 Add test for issue-58094 2019-11-15 23:54:52 +09:00
Yuki Okushi
4e621a8b0c Add test for issue-36122 2019-11-15 23:54:52 +09:00
Tyler Mandry
d252ba35d4 Improve error message for tests with panic=abort 2019-11-15 05:52:06 -08:00
Tyler Mandry
b8dca6c827 Add --force-run-in-process unstable libtest option 2019-11-15 05:52:06 -08:00
Mark Rousskov
c31a8754e3 Move JSON emitter to rustc_errors 2019-11-15 08:45:49 -05:00
Mark Rousskov
3f93ffc333 Remove SourceMapper trait
SourceMap is now in the root of all rustc-specific crates, syntax_pos,
so there's no need for the trait object to decouple the dependencies
between librustc_errors and libsyntax as was needed previously.
2019-11-15 08:45:43 -05:00
bors
1bd30ce2aa Auto merge of #66449 - tmandry:rollup-3p1t0sb, r=tmandry
Rollup of 4 pull requests

Successful merges:

 - #66197 (Push `ast::{ItemKind, ImplItemKind}::OpaqueTy` hack down into lowering)
 - #66429 (Add a regression test for #62524)
 - #66435 (Correct `const_in_array_repeat_expressions` feature name)
 - #66443 (Port erased cleanup)

Failed merges:

r? @ghost
2019-11-15 13:45:25 +00:00
Tyler Mandry
0f2f03fbd1
Rollup merge of #66443 - GuillaumeGomez:port-erased-cleanup, r=Mark-Simulacrum
Port erased cleanup

Just realised that the changes I made in #65965 were removed after the move of all error codes so here it is. I made them into separate commits to make the history look better this time.

r? @Mark-Simulacrum
2019-11-15 14:44:52 +01:00
Tyler Mandry
d99026e891
Rollup merge of #66435 - JohnTitor:fix-spelling, r=Centril
Correct `const_in_array_repeat_expressions` feature name

Fixes #66433

r? @estebank
2019-11-15 14:44:50 +01:00
Tyler Mandry
c6cdbe9a3e
Rollup merge of #66429 - guanqun:add-unit-test, r=Centril
Add a regression test for #62524

Closes #62524
2019-11-15 14:44:48 +01:00
Tyler Mandry
c5bb2ec0dd
Rollup merge of #66197 - Centril:transparent-ast, r=varkor
Push `ast::{ItemKind, ImplItemKind}::OpaqueTy` hack down into lowering

We currently have a hack in the form of `ast::{ItemKind, ImplItemKind}::OpaqueTy` which is constructed literally when you write `type Alias = impl Trait;` but not e.g. `type Alias = Vec<impl Trait>;`. Per https://github.com/rust-lang/rfcs/pull/2515, this needs to change to allow `impl Trait` in nested positions.  This PR achieves this change for the syntactic aspect but not the semantic one, which will require changes in lowering and def collection. In the interim, `TyKind::opaque_top_hack` is introduced to avoid knock-on changes in lowering, collection, and resolve. These hacks can then be removed and fixed one by one until the desired semantics are supported.

r? @varkor
2019-11-15 14:44:47 +01:00
Mark Rousskov
942f0a6f7a Move SourceMap to syntax_pos
This does not update the use sites or delete the now unnecessary
SourceMapper trait, to allow git to interpret the file move as a rename
rather than a new file.
2019-11-15 08:38:31 -05:00
Mark Rousskov
e1a87ca17a Move FatalError to syntax_pos
This is a bit unfortunate, but code needs to be able to fatally error
early on (in particular, syntax_pos after we move SourceMap there). It's
also a tiny bit of code, which means it's ultimately not that bad.
2019-11-15 08:21:23 -05:00
Guillaume Gomez
f9fdc380c7 Clean up E0025, E0034, E0044, E0046 and E0053 2019-11-15 13:24:47 +01:00
Guillaume Gomez
041c9f6f48 Clean up E0054 2019-11-15 13:24:47 +01:00
Guillaume Gomez
1a3c8c8964 Clean up E0050 2019-11-15 13:24:47 +01:00
Guillaume Gomez
2312207d91 Clean up E0049 2019-11-15 13:24:47 +01:00
Guillaume Gomez
11bb297d2c Clean up E0045 2019-11-15 13:24:47 +01:00
Guillaume Gomez
a5fcc5137f Clean up E0040 2019-11-15 13:24:47 +01:00
Guillaume Gomez
cab1955b21 Clean up E0033 2019-11-15 13:24:47 +01:00
Guillaume Gomez
f8d575a007 Clean up E0029 2019-11-15 13:24:47 +01:00
Guillaume Gomez
86506281b5 Clean up E0027 2019-11-15 13:24:47 +01:00
Guillaume Gomez
88acc84073 Clean up E0026 2019-11-15 13:24:47 +01:00
Guillaume Gomez
57564c80e3 Add link to error code explanation RFC 2019-11-15 13:24:47 +01:00
Mazdak Farrokhzad
91aadf0305 find_deprecation: deprecation attr may be ill-formed meta. 2019-11-15 13:24:06 +01:00
Guillaume Gomez
9d4620870c Clean up E0023 2019-11-15 13:04:52 +01:00
Ralf Jung
b6d93d9167 libpanic_unwind for Miri: make sure we have the SEH lang items when needed 2019-11-15 12:54:08 +01:00
bors
ce36ab2b06 Auto merge of #66438 - JohnTitor:rollup-qpv3wia, r=JohnTitor
Rollup of 12 pull requests

Successful merges:

 - #65557 (rename Error::iter_chain() and remove Error::iter_sources())
 - #66013 (Avoid hashing the key twice in `get_query()`.)
 - #66306 (Remove cannot mutate statics in initializer of another static error)
 - #66338 (Update mdbook.)
 - #66388 (Do not ICE on recovery from unmet associated type bound obligation)
 - #66390 (Fix ICE when trying to suggest `Type<>` instead of `Type()`)
 - #66391 (Do not ICE in `if` without `else` in `async fn`)
 - #66398 (Remove some stack frames from `.async` calls)
 - #66410 (miri: helper methods for max values of machine's usize/isize)
 - #66418 (Link to tracking issue in HIR const-check error code description)
 - #66419 (Don't warn labels beginning with `_` on unused_labels lint)
 - #66428 (Cleanup unused function)

Failed merges:

r? @ghost
2019-11-15 09:37:24 +00:00
Yuki Okushi
a173353daa
Rollup merge of #66428 - dns2utf8:cleanup_unused_function, r=GuillaumeGomez
Cleanup unused function

The argument was not used.

r? @GuillaumeGomez
2019-11-15 18:36:35 +09:00
Yuki Okushi
26eb9093fd
Rollup merge of #66419 - JohnTitor:ignore-underscore, r=varkor
Don't warn labels beginning with `_` on unused_labels lint

Fixes #66382

r? @varkor
2019-11-15 18:36:34 +09:00
Yuki Okushi
10a112c6ce
Rollup merge of #66418 - ecstatic-morse:hir-const-check-err-msg, r=estebank
Link to tracking issue in HIR const-check error code description

This is a follow up to #66170 that addresses [this comment](https://github.com/rust-lang/rust/pull/66170#discussion_r344021268).

As an aside, the only other error code whose description uses the phrase "tracking issue" is `E0202`. We may want to come up with standards around this, especially since error codes are now centralized and easier to keep track of (thanks @GuillaumeGomez).

r? @estebank (since they +1'ed the comment)
2019-11-15 18:36:32 +09:00
Yuki Okushi
e4d5f0596d
Rollup merge of #66410 - RalfJung:miri-machine-max, r=oli-obk
miri: helper methods for max values of machine's usize/isize

We recently wanted this in Miri.

r? @oli-obk
2019-11-15 18:36:31 +09:00
Yuki Okushi
1f43824a8b
Rollup merge of #66398 - sfackler:no-async-nesting, r=Centril
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-15 18:36:29 +09:00
Yuki Okushi
c5b6dceb68
Rollup merge of #66391 - estebank:if-else-async-ice, r=Centril
Do not ICE in `if` without `else` in `async fn`

Fix #66387.
2019-11-15 18:36:28 +09:00
Yuki Okushi
1baa7724ba
Rollup merge of #66390 - estebank:parenice, r=Centril
Fix ICE when trying to suggest `Type<>` instead of `Type()`

Fixes #66286, but the output has no span:

```
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait

error: aborting due to previous error

For more information about this error, try `rustc --explain E0214`.
```
2019-11-15 18:36:26 +09:00
Yuki Okushi
c8d8f52b76
Rollup merge of #66388 - estebank:melt-ice, r=Centril
Do not ICE on recovery from unmet associated type bound obligation

Fix #66353.

r? @Centril
2019-11-15 18:36:25 +09:00
Yuki Okushi
8405fc6b70
Rollup merge of #66338 - ehuss:update-mdbook, r=alexcrichton
Update mdbook.

This brings in some important updates to fix some rendering issues in the books. In particular fixing hidden lines in code blocks, and some escaping issues.  More details at https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md

This also requires updating mdbook-linkcheck.
2019-11-15 18:36:23 +09:00
Yuki Okushi
41fb84e444
Rollup merge of #66306 - spastorino:remove-error-handled-by-miri, r=oli-obk
Remove cannot mutate statics in initializer of another static error

r? @oli-obk

This is just a refactoring. As the removed code itself said, it only a heuristic catching a few cases early instead of leaving it all to const eval. It's easy to work around the static check and then run into the miri-engine check.
2019-11-15 18:36:22 +09:00
Yuki Okushi
22c0f628df
Rollup merge of #66013 - nnethercote:avoid-hashing-twice-in-get_query, r=Zoxc
Avoid hashing the key twice in `get_query()`.

For a single-threaded parallel compiler, this reduces instruction counts
across several benchmarks, by up to 2.8%.

The commit also adds documentation about `Sharded`'s use of `FxHasher`.

r? @Zoxc
2019-11-15 18:36:20 +09:00
Yuki Okushi
00c0c31554
Rollup merge of #65557 - haraldh:error_iter_rename, r=sfackler
rename Error::iter_chain() and remove Error::iter_sources()

~~Rename~~
* ~~Error::iter_chain() -> Error::chained()~~
* ~~Error::iter_sources() -> Error::ancestors()~~
* ~~ErrorIter -> Chained and Ancestors~~

according to
https://github.com/rust-lang/rust/issues/58520#issuecomment-527704110

Tracker:
https://github.com/rust-lang/rust/issues/58520

Edit:

Rename
* Error::iter_chain() -> Error::chained()
* ErrorIter -> Chain

So, it seems, that even Path::ancestors() includes itself. So, to avoid confusion and simplify it more, I reduced PR  #65557 to only have `chained` and `Chain`.

Rationale:

   1. Such iterators are helpful. They should better be stabilized sooner than later.
   1. self should be included. It is easy to .skip(1) it.  Not including self is harmful because it is harder to add self to the iterator than to remove it.
   1. The chosen name should be telling and reflect the fact that self is included. `.chained()` was chosen in honor of error-chain and because the iterator iterates over the chain of errors that is somehow included in self.
   1. The resulting iterator is named `Chain` because the `error::Chain` is what we want to have.
2019-11-15 18:36:18 +09:00
Yuki Okushi
759c7e4397 Correct const_in_array_repeat_expressions feature name 2019-11-15 15:50:52 +09:00
Stefan Schindler
1bbb8168ec Prevent jumps when selecting one or many lines 2019-11-15 02:30:44 +01:00
bors
9e8c4e6fb1 Auto merge of #64432 - gnzlbg:simplify_truncate, r=alexcrichton
Make the semantics of Vec::truncate(N) consistent with slices.

This commit simplifies the implementation of `Vec::truncate(N)` and
makes its semantics identical to dropping the `[vec.len() - N..]`
sub-slice tail of the vector, which is the same behavior as dropping a
vector containing the same sub-slice.

This changes two unspecified aspects of `Vec::truncate` behavior:

* the drop order, from back-to-front to front-to-back,
* the behavior of `Vec::truncate` on panics: if dropping one element of
  the tail panics, currently, `Vec::truncate` panics, but with this PR all other
  elements are still dropped, and if dropping a second element of the tail
  panics, with this PR, the program aborts.

Programs can trivially observe both changes. For example
([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7bef575b83b06e82b3e3529e4edbcac7)):

```rust
fn main() {
    struct Bomb(usize);
    impl Drop for Bomb {
        fn drop(&mut self) {
            panic!(format!("{}", self.0));
        }
    }
    let mut v = vec![Bomb(0), Bomb(1)];
    std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
        v.truncate(0);
    }));
    assert_eq!(v.len(), 1);
    std::mem::forget(v);
}
```

panics printing `1` today and succeeds. With this change, it panics
printing `0` first (due to the drop order change), and then aborts
with a double-panic printing `1`, just like dropping the
`[Bomb(0), Bomb(1)]` slice does, or dropping
`vec![Bomb(0), Bomb(1)]` does.

This needs to go through a crater run.

r? @SimonSapin
2019-11-15 01:23:51 +00:00
Stefan Schindler
71cf364c3c Fix the source code highlighting on source comments 2019-11-15 02:02:09 +01:00