Commit Graph

120727 Commits

Author SHA1 Message Date
Eric Huss
a0431e26fe Update cargo 2020-05-25 17:56:32 -07:00
Eric Huss
0fdbfd3f05 Update books 2020-05-25 17:17:27 -07:00
bors
698c5c6d95 Auto merge of #72589 - Dylan-DPC:rollup-7l2a2bo, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #72061 (add regression tests for stalled_on const vars)
 - #72424 (fix ICE when debug-printing MIR)
 - #72450 (Fix ice-#72442)
 - #72451 (Perform MIR NRVO even if types don't match)
 - #72538 (Removed all instances of const_field.)

Failed merges:

r? @ghost
2020-05-25 22:04:44 +00:00
Dylan DPC
b6a8915b20
Rollup merge of #72538 - rakshith-ravi:refactor/remove-const-query, r=oli-obk
Removed all instances of const_field.

Fixes #72264

r? @oli-obk
2020-05-25 23:58:59 +02:00
Dylan DPC
036688f875
Rollup merge of #72451 - ecstatic-morse:nrvo-type-mismatch, r=matthewjasper
Perform MIR NRVO even if types don't match

This is the most straightforward way to resolve #72428, but it could cause problems in codegen since the type of `_0` may no longer match the return type of the body.
2020-05-25 23:58:57 +02:00
Dylan DPC
a7ff5a0077
Rollup merge of #72450 - csmoe:issue-72442, r=oli-obk
Fix ice-#72442

Closes #72442
Closes #72426
r? @oli-obk
2020-05-25 23:58:56 +02:00
Dylan DPC
0498845e54
Rollup merge of #72424 - RalfJung:mir-print-ice, r=oli-obk
fix ICE when debug-printing MIR

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

This bug also makes debugging Miri harder as `MIRI_LOG=info` ICEs.
2020-05-25 23:58:54 +02:00
Dylan DPC
b3f1b9541a
Rollup merge of #72061 - lcnr:const-inference-test, r=eddyb
add regression tests for stalled_on const vars

closes #70180

Afaict this has been fixed sometime after #70213

`trait_ref_type_vars` correctly adds const infers and I did not find any remaining `FIXME`s which correspond to this issue.
7c59a81a5f/src/librustc_trait_selection/traits/fulfill.rs (L555-L557)

Added both examples from the issue as regression tests and renamed `trait_ref_type_vars` -> `trait_ref_infer_vars`.

r? @eddyb
2020-05-25 23:58:53 +02:00
Jonas Schievink
fe1753af84 Always validate MIR after optimizing 2020-05-25 22:04:48 +02:00
Samrat Man Singh
91dcbbbf50 Allow unlabeled breaks from desugared ? in labeled blocks 2020-05-26 01:18:07 +05:30
Jonas Schievink
e04318e0fa Add a small MIR validation pass 2020-05-25 21:44:36 +02:00
Jonas Schievink
4ca626258a Avoid Operand::Copy with &mut T 2020-05-25 21:44:36 +02:00
bors
f93bb2a50b Auto merge of #72575 - Dylan-DPC:rollup-zo679hv, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #72153 (exhaustively check `ty::Kind` during structural match checking)
 - #72308 (Emit a better diagnostic when function actually has a 'self' parameter)
 - #72560 (Enable `glacier` command via triagebot)
 - #72567 (Clean up E0608 explanation)

Failed merges:

r? @ghost
2020-05-25 17:14:44 +00:00
Dylan DPC
aa8d64b005
Rollup merge of #72567 - GuillaumeGomez:cleanup-e0608, r=Dylan-DPC
Clean up E0608 explanation

r? @Dylan-DPC
2020-05-25 18:07:48 +02:00
Dylan DPC
c57910292b
Rollup merge of #72560 - JohnTitor:glacier, r=Mark-Simulacrum
Enable `glacier` command via triagebot

I noticed this was required by https://github.com/rust-lang/rust/issues/72554#issuecomment-633393847.
2020-05-25 18:07:46 +02:00
Dylan DPC
65607fbf98
Rollup merge of #72308 - Aaron1011:fix/hygiene-error-message, r=matthewjasper
Emit a better diagnostic when function actually has a 'self' parameter

Fixes #66898

When we are unable to resolve a reference to `self`, we current assume
that the containing function doesn't have a `self` parameter, and
emit an error message accordingly.

However, if the reference to `self` was created by a macro invocation,
then resolution will correctly fail, due to hygiene. In this case, we
don't want to tell the user that the containing fuction doesn't have a
'self' paramter if it actually has one.

This PR checks for the precense of a 'self' parameter, and adjusts the
error message we emit accordingly.

TODO: The exact error message we emit could probably be improved. Should
we explicitly mention hygiene?
2020-05-25 18:07:44 +02:00
Dylan DPC
d5250c160a
Rollup merge of #72153 - lcnr:exhaustively-match, r=pnkfelix
exhaustively check `ty::Kind` during structural match checking

This was prone to errors as we may forget new kinds in the future.

I am also not yet sure about some kinds.

`ty::GeneratorWitness(..) | ty::Infer(_) | ty::Placeholder(_) | ty::UnnormalizedProjection(..)  | ty::Bound(..)` might be unreachable here.

We may want to forbid `ty::Projection`, similar to `ty::Param`.

`ty::Opaque` seems fine afaict, should not be possible in a match atm.

I believe `ty::Foreign` should not be structurally match, as I don't even know what
that would actually mean.

r? @pnkfelix cc @eddyb
2020-05-25 18:07:42 +02:00
Russell Cohen
a93d31603f Fix bug in shebang handling
Shebang handling was too agressive in stripping out the first line in cases where it is actually _not_ a shebang, but instead, valid rust (#70528). This is a second attempt at resolving this issue (the first attempt was flawed, for, among other reasons, causing an ICE in certain cases (#71372, #71471).

The behavior is now codified by a number of UI tests, but simply:
For the first line to be a shebang, the following must all be true:
1. The line must start with `#!`
2. The line must contain a non whitespace character after `#!`
3. The next character in the file, ignoring comments & whitespace must not be `[`

I believe this is a strict superset of what we used to allow, so perhaps a crater run is unnecessary, but probably not a terrible idea.
2020-05-25 10:11:08 -04:00
bors
a0f06d11ae Auto merge of #72354 - tamird:remove-copyright, r=Mark-Simulacrum
Remove dangling COPYRIGHT references

Missed in 2a663555dd.

r? @Mark-Simulacrum
2020-05-25 13:40:42 +00:00
Ralf Jung
d959a8f91d rename lint 2020-05-25 15:32:46 +02:00
Guillaume Gomez
632f3de12b Clean up E0608 explanation 2020-05-25 13:03:38 +02:00
Diggory Blake
ee6e705d91 Fix UB in Arc
Use raw pointers to avoid making any assertions about the data field.
2020-05-25 11:47:48 +01:00
bors
ee6c0dae39 Auto merge of #72562 - RalfJung:rollup-2ngjgwi, r=RalfJung
Rollup of 5 pull requests

Successful merges:

 - #71940 (Add `len` and `slice_from_raw_parts` to `NonNull<[T]>`)
 - #72525 (Miri casts: do not blindly rely on dest type)
 - #72537 (Fix InlineAsmOperand expresions being visited twice during liveness checking)
 - #72544 (librustc_middle: Rename upvars query to upvars_mentioned)
 - #72551 (First draft documenting Debug stability.)

Failed merges:

r? @ghost
2020-05-25 09:43:59 +00:00
Ralf Jung
061773fd2b more test ref-to-packed tests 2020-05-25 11:15:38 +02:00
Ralf Jung
7c9fdb332b
Rollup merge of #72551 - alilleybrinker:document-debug-stability, r=KodrAus
First draft documenting Debug stability.

Debug implementations of std types aren't stable, and neither are derived Debug implementations for any types, including user-defined types. This commit adds a section to the Debug documentation noting this stability status.

This issue is tracked by #62794.
2020-05-25 11:01:10 +02:00
Ralf Jung
4f4b716675
Rollup merge of #72544 - sexxi-goose:upvars_mentioned, r=matthewjasper
librustc_middle: Rename upvars query to upvars_mentioned

As part of supporting RFC 2229, we will be capturing all the Places that
were mentioned in the closure.

This commit modifies the name of the upvars query to upvars_mentioned.

r? @nikomatsakis @blitzerr @matthewjasper
2020-05-25 11:01:08 +02:00
Ralf Jung
14941cfe11
Rollup merge of #72537 - Amanieu:fix-asm-liveness, r=petrochenkov
Fix InlineAsmOperand expresions being visited twice during liveness checking
2020-05-25 11:01:07 +02:00
Ralf Jung
4a5a6559d3
Rollup merge of #72525 - RalfJung:miri-cast-checks, r=eddyb
Miri casts: do not blindly rely on dest type

Make sure that we notice when the MIR is bad and the casted-to and destination type are e.g. of different size, as suggested by @eddyb.
2020-05-25 11:01:05 +02:00
Ralf Jung
bf816e0349
Rollup merge of #71940 - SimonSapin:nonnull-slice, r=kennytm
Add `len` and `slice_from_raw_parts` to `NonNull<[T]>`

This follows the precedent of the recently-added `<*const [T]>::len` (adding to its tracking issue https://github.com/rust-lang/rust/issues/71146) and `ptr::slice_from_raw_parts`.
2020-05-25 11:01:03 +02:00
Ralf Jung
c79535eab9 remove some unused types from the tests 2020-05-25 10:56:48 +02:00
Ralf Jung
b27e649537 add a lint against references to packed fields 2020-05-25 10:56:47 +02:00
Ross MacArthur
4e4b1edda8
Add test for old compiler ICE when using Borrow 2020-05-25 09:23:00 +02:00
Ralf Jung
d59fa081ec fix ICE when debug-printing MIR 2020-05-25 08:52:16 +02:00
bors
997d953eee Auto merge of #72520 - jonas-schievink:cleanup-userty, r=matthewjasper
Clear MIR local type annotations after borrowck
2020-05-25 06:17:15 +00:00
Yuki Okushi
3fcb0f4bfa
Enable glacier command via triagebot 2020-05-25 15:07:55 +09:00
bors
2679c38fc3 Auto merge of #72472 - LeSeulArtichaut:sync-command, r=dtolnay
Implement `Sync` for `process::Command on unix and vxworks

Closes #72387.
r? @cuviper
2020-05-25 02:48:55 +00:00
Andrew Lilley Brinker
698df11af5 First draft documenting Debug stability.
Debug implementations of std types aren't stable, and neither are
derived Debug implementations for any types, including user-defined
types. This commit adds a section to the Debug documentatio noting this
stability status.
2020-05-24 15:30:48 -07:00
bors
62da38d00d Auto merge of #72287 - Aaron1011:feature/min-token-collect, r=petrochenkov
Store tokens inside `ast::Expr`

This is a smaller version of #70091.

We now store captured tokens inside `ast::Expr`, which allows us to avoid some reparsing in `nt_to_tokenstream`. To try to mitigate the performance impact, we only collect tokens when we've seen an outer attribute.

This makes progress towards solving #43081. There are still many things left to do:

* Collect tokens for other AST items.
* Come up with a way to handle inner attributes (we need to be collecting tokens by the time we encounter them)
* Avoid re-parsing when a `#[cfg]` attr is used.

However, this is enough to fix spans for a simple example, which I've included as a test case.
2020-05-24 22:11:12 +00:00
Aaron Hill
14382c6437
Collect tokens for ast::Expr 2020-05-24 15:54:48 -04:00
bors
46e85b4328 Auto merge of #72539 - RalfJung:rollup-8yfidi8, r=RalfJung
Rollup of 5 pull requests

Successful merges:

 - #72402 (Remove all uses of `NodeId` in `ResolverOutputs`)
 - #72527 (bootstrap: propagate test-args to miri and clippy test suites)
 - #72530 (Clean up E0602 explanation)
 - #72532 (Use `dyn` trait syntax in more comments and docs)
 - #72535 (Use sort_unstable_by in its own docs)

Failed merges:

r? @ghost
2020-05-24 18:40:28 +00:00
Aman Arora
c3edb15f36 librustc_middle: Rename upvars query to upvars_mentioned
As part of supporting RFC 2229, we will be capturing all the Places that
were mentioned in the closure.

This commit modifies the name of the upvars query to upvars_mentioned.

Co-authored-by: Aman Arora <me@aman-arora.com>
Co-authored-by: Chris Pardy <chrispardy36@gmail.com>
2020-05-24 14:36:39 -04:00
Ralf Jung
8b5ba4a3c6 comment nit 2020-05-24 19:28:44 +02:00
Ralf Jung
7b98552cc0 use helper method for determining size of int type 2020-05-24 19:17:30 +02:00
Ralf Jung
134a165b6c
Rollup merge of #72535 - saschanaz:patch-1, r=jonas-schievink
Use sort_unstable_by in its own docs

Currently it uses `sort_by` instead of itself.
2020-05-24 16:51:36 +02:00
Ralf Jung
67b4e2b371
Rollup merge of #72532 - ratijas:dyn-trait-object-doc, r=jonas-schievink
Use `dyn` trait syntax in more comments and docs

Probably missed it out during earlier dyn refactoring.

033cbfe#diff-a0ba6bbf82d9ee83a4c9525873f85b04
2020-05-24 16:51:34 +02:00
Ralf Jung
cdeef96267
Rollup merge of #72530 - GuillaumeGomez:cleanup-e0602, r=Dylan-DPC
Clean up E0602 explanation

r? @Dylan-DPC
2020-05-24 16:51:32 +02:00
Ralf Jung
a75068ac37
Rollup merge of #72527 - RalfJung:miri-clippy-test-args, r=Mark-Simulacrum
bootstrap: propagate test-args to miri and clippy test suites

For Miri I verified this works. For clippy, unfortunately it doesn't seem to work as a stage 0 tool:
```
./x.py --stage 0 test src/tools/clippy --test-args init
```
gives
```
   Compiling clippy-mini-macro-test v0.2.0 (/home/r/src/rust/rustc.3/src/tools/clippy/mini-macro)
error[E0658]: procedural macros cannot be expanded to expressions
  --> src/tools/clippy/mini-macro/src/lib.rs:11:5
   |
11 | /     quote!(
12 | |         #[allow(unused)]
13 | |         fn needless_take_by_value(s: String) {
14 | |             println!("{}", s.len());
...  |
24 | |         }
25 | |     )
   | |_____^
   |
   = note: see issue #54727 <https://github.com/rust-lang/rust/issues/54727> for more information
   = help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable

   Compiling proc-macro2 v1.0.3
   Compiling syn v1.0.11
error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: could not compile `clippy-mini-macro-test`.
```
But propagating `--test-args` to the test suite seems to make sense regardless.
Cc @rust-lang/clippy
2020-05-24 16:51:30 +02:00
Ralf Jung
95c45838f0
Rollup merge of #72402 - marmeladema:resolver-outputs-def-id, r=ecstatic-morse
Remove all uses of `NodeId` in `ResolverOutputs`

cc #50928

r? @ecstatic-morse
2020-05-24 16:51:28 +02:00
bors
ff991d6034 Auto merge of #72531 - RalfJung:miri-upd, r=RalfJung
bump Miri

Fixes https://github.com/rust-lang/rust/issues/72358
r? @ghost Cc @rust-lang/miri
2020-05-24 14:49:54 +00:00
Rakshith Ravi
245ebc7210 Removed all instances of const_field. 2020-05-24 19:38:54 +05:30