Commit Graph

109588 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
752961b4ca
Rollup merge of #70641 - estebank:dedup-code, r=nikomatsakis
Remove duplicated code in trait selection
2020-04-03 22:55:08 +02:00
Mazdak Farrokhzad
a928f64464
Rollup merge of #70640 - jonas-schievink:async-ice, r=cramertj
Hide `task_context` when lowering body

Fixes https://github.com/rust-lang/rust/issues/70594
2020-04-03 22:55:07 +02:00
Mazdak Farrokhzad
1ea8653d01
Rollup merge of #70597 - vakaras:thread_new_double_free_bug_fix, r=Amanieu
Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new

While working on concurrency support for Miri, I found that the `libstd::syn::unix::Thread::new` method has two potential problems: double-free and undefined behaviour.

**Double-free** could occur if the following events happened (credit for pointing this out goes to @RalfJung):

1.  The call to `pthread_create` successfully launched a new thread that executed to completion and deallocated `p`.
2.  The call to `pthread_attr_destroy` returned a non-zero value causing the `assert_eq!` to panic.
3.  Since `mem::forget(p)` was not yet executed, the destructor of `p` would be executed and cause a double-free.

As far as I understand, this code also violates the stacked-borrows aliasing rules and thus would result in **undefined behaviour** if these rules were adopted.  The problem is that the ownership of `p` is passed to the newly created thread before the call to `mem::forget`. Since the call to `mem::forget` is still a call, it counts as a use of `p` and triggers UB.

This pull request changes the code to use `mem::ManuallyDrop` instead of `mem::forget`. As a consequence, in case of a panic, `p` would be potentially leaked, which while undesirable is probably better than double-free or undefined behaviour.
2020-04-03 22:55:05 +02:00
Mazdak Farrokhzad
17a59fb29c
Rollup merge of #70576 - Rustin-Liu:rustin-patch-link-cfg, r=varkor
Update the description of the ticket to point at RFC 1721

Fixes #70538.

My first PR to rust. So please let me know if I'm doing something wrong.
2020-04-03 22:55:03 +02:00
Mazdak Farrokhzad
9b22fdc121
Rollup merge of #69860 - faern:use-assoc-int-consts, r=dtolnay
Use associated numeric consts in documentation

Now when the associated constants on int/float types are stabilized and the recommended way of accessing said constants (#68952). We can start using it in this repository, and recommend it via documentation example code.

This PR is the reincarnation of #67913 minus the actual adding + stabilization of said constants. (EDIT: Now it's only changing the documentation. So users will see the new consts, but we don't yet update the internal code)

Because of how fast bit rot happens to PRs that touch this many files, it does not try to replace 100% of the old usage of the constants in the entire repo, but a good chunk of them.
2020-04-03 22:55:02 +02:00
Rustin-Liu
d2ad9f4453 Update the description of link_cfg unstable
Fmt code

Update tests

Modify msg

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
2020-04-04 01:43:16 +08:00
Vytautas Astrauskas
d512b22f8b Delete unnecessary stub stack overflow handler for cloudabi. 2020-04-03 10:13:49 -07:00
Vytautas Astrauskas
d637d6e7a8 Delete unnecessary stub stack overflow handler for hermit. 2020-04-03 10:07:40 -07:00
bors
f6fe99c798 Auto merge of #70734 - Dylan-DPC:rollup-xmncatq, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #70696 (Extend #69020 test to include reversed operand order.)
 - #70706 (Minor cleanup in rustdoc --check-theme)
 - #70725 (Avoid `.unwrap()`s on `.span_to_snippet(...)`s)
 - #70728 (Minor doc improvements on `AllocRef`)
 - #70730 (Fix link in task::Wake docs)
 - #70731 (Minor follow-up after renaming librustc(_middle))

Failed merges:

r? @ghost
2020-04-03 13:42:08 +00:00
Dylan DPC
04824f302a
Rollup merge of #70731 - JohnTitor:follow-up-rustc-middle, r=eddyb
Minor follow-up after renaming librustc(_middle)

Fixes #70537
r? @Centril @eddyb
2020-04-03 13:31:30 +02:00
Dylan DPC
15be59ddb3
Rollup merge of #70730 - yoshuawuyts:fix-wake-docs-link, r=Dylan-DPC
Fix link in task::Wake docs

`task::Wake` was introduced in https://github.com/rust-lang/rust/pull/68700. While I was browsing the docs I noticed a link to `sync::Arc` wasn't resolving correctly. This patch fixes that. Thanks!

## Before

![Screenshot_2020-04-03 std task Wake - Rust](https://user-images.githubusercontent.com/2467194/78346384-466cb280-759f-11ea-97c8-aede186c674e.png)

## Proposed

![Screenshot_2020-04-03 alloc task Wake - Rust](https://user-images.githubusercontent.com/2467194/78349819-79657500-75a4-11ea-9282-16691ae2a5d4.png)
2020-04-03 13:31:28 +02:00
Dylan DPC
53d786f404
Rollup merge of #70728 - TimDiekmann:allocref-doc, r=Amanieu
Minor doc improvements on `AllocRef`

r? @Amanieu
2020-04-03 13:31:27 +02:00
Dylan DPC
b91c376e4a
Rollup merge of #70725 - Centril:nix-unwraps, r=estebank
Avoid `.unwrap()`s on `.span_to_snippet(...)`s

First commit fixes https://github.com/rust-lang/rust/issues/70724 and the others fix similar issues found by grepping.

r? @estebank
2020-04-03 13:31:25 +02:00
Dylan DPC
5082fe21a8
Rollup merge of #70706 - gizmondo:check-theme, r=GuillaumeGomez
Minor cleanup in rustdoc --check-theme

Expand and remove try_something macro. Since 2f6226518b there has been only one invocation.

r? @GuillaumeGomez
2020-04-03 13:31:24 +02:00
Dylan DPC
ea28134f2d
Rollup merge of #70696 - jumbatm:extend-issue-69020-test, r=RalfJung
Extend #69020 test to include reversed operand order.

Make sure we still emit if a lint if the generic argument comes first. See https://github.com/rust-lang/rust/pull/70566#issuecomment-607671340.

r? @RalfJung
2020-04-03 13:31:22 +02:00
bors
34f7f55e7a Auto merge of #70695 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/70664
r? @ghost Cc @oli-obk
2020-04-03 10:23:15 +00:00
Yuki Okushi
99e0d8ed79
Minor follow-up after renaming librustc(_middle) 2020-04-03 19:03:13 +09:00
Yoshua Wuyts
3d17993f9f Fix link in task::Wake docs 2020-04-03 11:33:27 +02:00
Linus Färnstrand
c831265940 Replace float module consts with assoc consts in documentation 2020-04-03 09:33:10 +02:00
Linus Färnstrand
c0ec0a27b3 Replace max/min_value() with MAX/MIN assoc consts 2020-04-03 09:33:10 +02:00
Linus Färnstrand
e9ce03648d Make documentation examples use new integer assoc consts 2020-04-03 09:33:10 +02:00
bors
424c793925 Auto merge of #70582 - pnkfelix:update-llvm-to-fix-69841, r=cuviper
Fix #69841 by updating LLVM submodule.

Fix #69841 by updating LLVM submodule.

Includes regression test for issue 69841.
2020-04-03 07:26:00 +00:00
Ralf Jung
677ba040b7 update miri 2020-04-03 08:52:12 +02:00
Tim Diekmann
c061ff4b69
Update mod.rs 2020-04-03 08:22:31 +02:00
Tim Diekmann
d8b0c5fb37 Minor doc improvements on AllocRef 2020-04-03 07:28:23 +02:00
bors
548afdbe1a Auto merge of #70726 - Centril:rollup-zrdkkpt, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #68334 (AArch64 bare-metal targets: Build rust-std)
 - #70224 (Clean up rustdoc js testers)
 - #70532 (Miri engine: stronger type-based sanity check for assignments)
 - #70698 (bootstrap: add `--json-output` for rust-analyzer)
 - #70715 (Fix typo in operands section)

Failed merges:

r? @ghost
2020-04-03 04:18:32 +00:00
Mazdak Farrokhzad
c2372f109e
Rollup merge of #70715 - awh6al:patch-1, r=Dylan-DPC
Fix typo in operands section
2020-04-03 03:26:52 +02:00
Mazdak Farrokhzad
17f204feee
Rollup merge of #70698 - nikomatsakis:x-py-json-output, r=Mark-Simulacrum
bootstrap: add `--json-output` for rust-analyzer

Motivation is that this allows us to customize rust-analyzer's "cargo watch" integration to run x.py. You simply have to set the command to run to be `x.py --json-output`

r? @Mark-Simulacrum -- feel free to make changes, this is quick and dirty for sure
2020-04-03 03:26:50 +02:00
Mazdak Farrokhzad
4f0a791d5d
Rollup merge of #70532 - RalfJung:miri-assign, r=eddyb
Miri engine: stronger type-based sanity check for assignments

r? @oli-obk @eddyb
Fixes https://github.com/rust-lang/rust/issues/70405

That issue says
> be sure to also add appropriate mutability checks to the patterns (mutable for the source, immutable for the dest)

I decided not to do that because I see no good reason to do it. The engine does not care either way, the assignment will happen correctly.
2020-04-03 03:26:49 +02:00
Mazdak Farrokhzad
a80b491ef2
Rollup merge of #70224 - GuillaumeGomez:clean-up-rustdoc-js-testers, r=Dylan-DPC
Clean up rustdoc js testers

I realized after the improvement made by @ollie27 on the rustdoc-js-tester that a lot of code was actually duplicated. This PR intends to remove this duplication, making it simpler to update in case of future main.js updates.

r? @ollie27

cc @kinnison
2020-04-03 03:26:47 +02:00
Mazdak Farrokhzad
73f0cf69c1
Rollup merge of #68334 - andre-richter:master, r=japaric
AArch64 bare-metal targets: Build rust-std

This PR complements https://github.com/rust-lang/rust/pull/68253
2020-04-03 03:26:45 +02:00
bors
c53e4b3877 Auto merge of #70642 - eddyb:remap-sysroot-src, r=Mark-Simulacrum
Translate the virtual `/rustc/$hash` prefix back to a real directory.

Closes #53486 and fixes #53081, by undoing the remapping to `/rustc/$hash` on the fly, when appropriate (e.g. our testsuites, or user crates that depend on `libstd`), but not during the Rust build itself (as that could leak the absolute build directory into the artifacts, breaking deterministic builds).

Tested locally by setting `remap-debuginfo = true` in `config.toml`, which without these changes, was causing 56 tests to fail (see https://github.com/rust-lang/rust/issues/53081#issuecomment-606703215 for more details).

cc @Mark-Simulacrum @alexcrichton @ehuss
2020-04-03 01:22:39 +00:00
Mazdak Farrokhzad
5cb5ddeb3c .unwrap() less on .span_to_snippet() 2020-04-03 03:17:40 +02:00
Mazdak Farrokhzad
08a724967e get_fn_like_arguments: avoid .unwrap 2020-04-03 03:00:24 +02:00
Mazdak Farrokhzad
9c0826902f add_type_neq_err_label: don't .unwrap 2020-04-03 02:28:23 +02:00
Vytautas Astrauskas
53aa5a1113 Remove unnecessary stack overflow handler stub for sgx. 2020-04-02 16:29:09 -07:00
jumbatm
0399d141b6 Add comment explaining the reversed operands tests
Also, fix the goofy reversed names with something clearer.
2020-04-03 08:58:00 +10:00
bors
c520802785 Auto merge of #70722 - Centril:rollup-ar4gn1x, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #70487 (Stabilize float::to_int_unchecked)
 - #70595 (Remove unused discriminant reads from MIR bodies)
 - #70691 (Improve docs in `AllocRef`)
 - #70694 (Use Self over specific type in return position)
 - #70700 (Expand on platform details of `include_xxx` macros)
 - #70708 (Fix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase)
 - #70716 (Unerase regions in infer_placeholder_type)

Failed merges:

r? @ghost
2020-04-02 22:32:52 +00:00
Mazdak Farrokhzad
98cf9d9aac
Rollup merge of #70716 - matthewjasper:infer-const-type-regions, r=eddyb
Unerase regions in infer_placeholder_type

closes #70608
2020-04-03 00:32:09 +02:00
Mazdak Farrokhzad
2f28058a34
Rollup merge of #70708 - Pocakking:fix-ascii-case-conv-typo, r=sfackler
Fix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase

Corrects misspelling of fifth.
2020-04-03 00:32:07 +02:00
Mazdak Farrokhzad
28084a1f36
Rollup merge of #70700 - jrvidal:include-macro-paths, r=Dylan-DPC
Expand on platform details of `include_xxx` macros

This is a small detail that is not explicitly mentioned, but it left me scratching my head for a while until I looked into its implementation details. Maybe worth mentioning.
2020-04-03 00:32:06 +02:00
Mazdak Farrokhzad
c00a21c2e3
Rollup merge of #70694 - lzutao:self, r=Centril
Use Self over specific type in return position
2020-04-03 00:32:04 +02:00
Mazdak Farrokhzad
e07f57c51c
Rollup merge of #70691 - TimDiekmann:allocref-docs, r=RalfJung
Improve docs in `AllocRef`

r? @RalfJung
2020-04-03 00:32:03 +02:00
Mazdak Farrokhzad
4cba69e585
Rollup merge of #70595 - wesleywiser:remove_unused_discriminant_reads, r=oli-obk
Remove unused discriminant reads from MIR bodies

Allow the `SimplifyLocals` pass to remove reads of discriminants if the
read is never used.

Fixes #70531

r? @oli-obk
2020-04-03 00:32:01 +02:00
Mazdak Farrokhzad
1eabbd024c
Rollup merge of #70487 - Mark-Simulacrum:float-unchecked-casts, r=SimonSapin
Stabilize float::to_int_unchecked

This renames and stabilizes unsafe floating point to integer casts, which are intended to be the substitute for the currently unsound `as` behavior, once that changes to safe-but-slower saturating casts. As such, I believe this also likely unblocks #10184 (our oldest I-unsound issue!), as once this rolls out to stable it would be far easier IMO to change the behavior of `as` to be safe by default.

This does not stabilize the trait or the associated method, as they are deemed internal implementation details (and consumers should not, generally, want to expose them, as in practice all callers likely know statically/without generics what the return type is).

Closes #67058
2020-04-03 00:32:00 +02:00
Ralf Jung
343b3f010c switch assignment check back to testing layout equality 2020-04-02 23:45:38 +02:00
@ßd€łw@ħ@ß
56918e52d1
remove confusing about lvalues term 2020-04-02 22:20:43 +01:00
Ralf Jung
351b7d099a also use mir_assign_valid_types in from_known_layout check 2020-04-02 22:42:56 +02:00
Ralf Jung
100c809386 also accept fn-ptr-type-changing assignments 2020-04-02 22:33:47 +02:00
Ralf Jung
f1ea273133 Miri engine: stronger type-based sanity check for assignments 2020-04-02 22:33:47 +02:00