Commit graph

124480 commits

Author SHA1 Message Date
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
Matthew McAllister
98eb29cbba Fix trait alias inherent impl resolution
Fixes #60021 and #72415.
2020-05-24 17:54:30 -07: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
Markus Westerlind
ebc7eda9e7 perf: Add inline on commonly used methods added in 69464
Reclaims most of the regression in inflate
2020-05-24 22:35:17 +02:00
Alex Gaynor
cd5f228acd
Added a codegen test for a recent optimization for overflow-checks=on
Closes #58692
2020-05-24 16:20:02 -04: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
Hoe Hao Cheng
d1bc8ada45 Fix tests 2020-05-24 23:04:46 +08: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
Hoe Hao Cheng
716acff7b1 Remove heterogeneous ordering for SocketAddr 2020-05-24 22:14:06 +08:00
Rakshith Ravi
245ebc7210 Removed all instances of const_field. 2020-05-24 19:38:54 +05:30
Amanieu d'Antras
be2fd61d78 Fix InlineAsmOperand expresions being visited twice during liveness checking 2020-05-24 14:26:20 +01:00
Ralf Jung
9b87f4009b bump Miri 2020-05-24 15:11:00 +02:00
Ralf Jung
b9b1554dac Fix unsizing casts 2020-05-24 15:10:15 +02:00
Kagami Sascha Rosylight
df2f9a4bd1
Use sort_unstable_by in its own docs 2020-05-24 14:56:57 +02:00
ratijas
d1f4796845
Use dyn trait syntax in more comments and docs
Probably missed it out during earlier `dyn` refactoring.
2020-05-24 14:46:50 +03:00
bors
94fccccd2c Auto merge of #72529 - RalfJung:rollup-ydthv90, r=RalfJung
Rollup of 3 pull requests

Successful merges:

 - #72284 (Remove `macro_defs` map)
 - #72393 (Rewrite `Parser::collect_tokens`)
 - #72528 (Fix typo in doc comment.)

Failed merges:

r? @ghost
2020-05-24 11:02:23 +00:00
Guillaume Gomez
2220eb4d8a Clean up E0602 explanation 2020-05-24 12:52:45 +02:00
Ralf Jung
e2e3aacc23
Rollup merge of #72528 - emosenkis:patch-1, r=dtolnay
Fix typo in doc comment.

call_one_force -> call_on**c**e_force
2020-05-24 12:17:12 +02:00
Ralf Jung
8692c45595
Rollup merge of #72393 - Aaron1011:feature/rewrite-collect-tokens, r=petrochenkov
Rewrite `Parser::collect_tokens`

The previous implementation did not work when called on an opening
delimiter, or when called re-entrantly from the same `TokenCursor` stack
depth.

I'm not sure how to test this apart from https://github.com/rust-lang/rust/pull/72287
2020-05-24 12:17:11 +02:00
Ralf Jung
94d96b1d75
Rollup merge of #72284 - Aaron1011:feature/inline-macro-did, r=petrochenkov
Remove `macro_defs` map

We now store the `DefId` directly in `ExpnKind::Macro`. This will allow
us to serialize `ExpnData` in PR #72121 without needing to manage a side
table.
2020-05-24 12:17:09 +02:00
Eitan Mosenkis
806f5815d4
Fix typo in doc comment.
call_one_force -> call_once_force
2020-05-24 11:59:07 +03:00
bors
7726070fa7 Auto merge of #72524 - RalfJung:rollup-s9f1pcc, r=RalfJung
Rollup of 2 pull requests

Successful merges:

 - #72388 (Recursively expand `TokenKind::Interpolated` in `probably_equal_for_proc_macro`)
 - #72517 (small select cleanup)

Failed merges:

r? @ghost
2020-05-24 07:46:13 +00:00
Ralf Jung
7a121ad77f bootstrap: propagate test-args to miri and clippy test suites 2020-05-24 09:45:14 +02:00
Ralf Jung
b97ed1a46c Miri casts: do not blindly rely on dest type 2020-05-24 09:38:29 +02:00
Ralf Jung
6cb1c0eb64
Rollup merge of #72517 - lcnr:refactor-winnowing, r=jonas-schievink
small select cleanup
2020-05-24 09:30:37 +02:00
Ralf Jung
fb848a6b7d
Rollup merge of #72388 - Aaron1011:fix/deep-tokenstream-equality, r=petrochenkov
Recursively expand `TokenKind::Interpolated` in `probably_equal_for_proc_macro`

Fixes #68430

When comparing the captured and re-parsed `TokenStream` for a `TokenKind::Interpolated`, we currently treat any nested `TokenKind::Interpolated` tokens as unequal. If a `TokenKind::Interpolated` token shows up in the captured `TokenStream` due to a `macro_rules!` expansion, we will throw away the captured `TokenStream`, losing span information.

This PR recursively invokes `nt_to_tokenstream` on nested `TokenKind::Interpolated` tokens, effectively flattening the stream into a sequence of non-interpolated tokens. This allows it to compare equal with the re-parsed stream, allowing us to keep the original captured `TokenStream` (with span information).

This requires all of the `probably_equal_for_proc_macro` methods to be moved from `librustc_ast` to `librustc_parse` so that they can call `nt_to_tokenstream`.
2020-05-24 09:30:31 +02:00
Benjamin Saunders
730f7366bb Fix asinh of negative values
When `x` has large magnitude, `x + ((x * x) + 1.0).sqrt()` approaches
`x + x.abs()`. For negative values of `x`, this leads to catastrophic
cancellation, resulting in large errors or even 0 being passed to
`ln`, producing incorrect results including `-inf`.

Becuase asinh is an odd function, i.e. -asinh(x) = asinh(-x) for all
x, we can avoid the catastrophic cancellation and obtain correct
results by taking the absolute value of `self` for the first
term. `self * self` is always positive, so in effect this gives us
`x.abs().asinh().copysign(x)` which as discussed above is
algebraically equivalent, but is much more accurate.
2020-05-24 00:03:35 -07:00
Michal Sudwoj
e18054d5c0 Added comment about static variables 2020-05-24 08:20:40 +02:00