]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #70707 - ecstatic-morse:dataflow-graphviz-cleanup, r=nikomatsakis
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:10 +0000 (22:55 +0200)]
Rollup merge of #70707 - ecstatic-morse:dataflow-graphviz-cleanup, r=nikomatsakis

Remove unused graphviz emitter

This was only used by the old dataflow framework that was removed in #69644.

4 years agoRollup merge of #70641 - estebank:dedup-code, r=nikomatsakis
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:08 +0000 (22:55 +0200)]
Rollup merge of #70641 - estebank:dedup-code, r=nikomatsakis

Remove duplicated code in trait selection

4 years agoRollup merge of #70640 - jonas-schievink:async-ice, r=cramertj
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:07 +0000 (22:55 +0200)]
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

4 years agoRollup merge of #70597 - vakaras:thread_new_double_free_bug_fix, r=Amanieu
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:05 +0000 (22:55 +0200)]
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.

4 years agoRollup merge of #70576 - Rustin-Liu:rustin-patch-link-cfg, r=varkor
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:03 +0000 (22:55 +0200)]
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.

4 years agoRollup merge of #69860 - faern:use-assoc-int-consts, r=dtolnay
Mazdak Farrokhzad [Fri, 3 Apr 2020 20:55:02 +0000 (22:55 +0200)]
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.

4 years agoUpdate the description of link_cfg unstable
Rustin-Liu [Mon, 30 Mar 2020 17:04:03 +0000 (01:04 +0800)]
Update the description of link_cfg unstable

Fmt code

Update tests

Modify msg

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
4 years agoDelete unnecessary stub stack overflow handler for cloudabi.
Vytautas Astrauskas [Fri, 3 Apr 2020 17:13:49 +0000 (10:13 -0700)]
Delete unnecessary stub stack overflow handler for cloudabi.

4 years agoDelete unnecessary stub stack overflow handler for hermit.
Vytautas Astrauskas [Fri, 3 Apr 2020 17:07:40 +0000 (10:07 -0700)]
Delete unnecessary stub stack overflow handler for hermit.

4 years agoAuto merge of #70734 - Dylan-DPC:rollup-xmncatq, r=Dylan-DPC
bors [Fri, 3 Apr 2020 13:42:08 +0000 (13:42 +0000)]
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

4 years agoRollup merge of #70731 - JohnTitor:follow-up-rustc-middle, r=eddyb
Dylan DPC [Fri, 3 Apr 2020 11:31:30 +0000 (13:31 +0200)]
Rollup merge of #70731 - JohnTitor:follow-up-rustc-middle, r=eddyb

Minor follow-up after renaming librustc(_middle)

Fixes #70537
r? @Centril @eddyb

4 years agoRollup merge of #70730 - yoshuawuyts:fix-wake-docs-link, r=Dylan-DPC
Dylan DPC [Fri, 3 Apr 2020 11:31:28 +0000 (13:31 +0200)]
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)

4 years agoRollup merge of #70728 - TimDiekmann:allocref-doc, r=Amanieu
Dylan DPC [Fri, 3 Apr 2020 11:31:27 +0000 (13:31 +0200)]
Rollup merge of #70728 - TimDiekmann:allocref-doc, r=Amanieu

Minor doc improvements on `AllocRef`

r? @Amanieu

4 years agoRollup merge of #70725 - Centril:nix-unwraps, r=estebank
Dylan DPC [Fri, 3 Apr 2020 11:31:25 +0000 (13:31 +0200)]
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

4 years agoRollup merge of #70706 - gizmondo:check-theme, r=GuillaumeGomez
Dylan DPC [Fri, 3 Apr 2020 11:31:24 +0000 (13:31 +0200)]
Rollup merge of #70706 - gizmondo:check-theme, r=GuillaumeGomez

Minor cleanup in rustdoc --check-theme

Expand and remove try_something macro. Since https://github.com/rust-lang/rust/commit/2f6226518bd5085896a0f27cfd3ea396367ecd50 there has been only one invocation.

r? @GuillaumeGomez

4 years agoRollup merge of #70696 - jumbatm:extend-issue-69020-test, r=RalfJung
Dylan DPC [Fri, 3 Apr 2020 11:31:22 +0000 (13:31 +0200)]
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

4 years agoAuto merge of #70695 - RalfJung:miri, r=RalfJung
bors [Fri, 3 Apr 2020 10:23:15 +0000 (10:23 +0000)]
Auto merge of #70695 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/70664
r? @ghost Cc @oli-obk

4 years agoMinor follow-up after renaming librustc(_middle)
Yuki Okushi [Fri, 3 Apr 2020 10:03:13 +0000 (19:03 +0900)]
Minor follow-up after renaming librustc(_middle)

4 years agoFix link in task::Wake docs
Yoshua Wuyts [Fri, 3 Apr 2020 09:33:27 +0000 (11:33 +0200)]
Fix link in task::Wake docs

4 years agoReplace float module consts with assoc consts in documentation
Linus Färnstrand [Fri, 27 Mar 2020 21:26:08 +0000 (22:26 +0100)]
Replace float module consts with assoc consts in documentation

4 years agoReplace max/min_value() with MAX/MIN assoc consts
Linus Färnstrand [Fri, 27 Mar 2020 21:15:02 +0000 (22:15 +0100)]
Replace max/min_value() with MAX/MIN assoc consts

4 years agoMake documentation examples use new integer assoc consts
Linus Färnstrand [Fri, 27 Mar 2020 21:43:28 +0000 (22:43 +0100)]
Make documentation examples use new integer assoc consts

4 years agoAuto merge of #70582 - pnkfelix:update-llvm-to-fix-69841, r=cuviper
bors [Fri, 3 Apr 2020 07:26:00 +0000 (07:26 +0000)]
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.

4 years agoupdate miri
Ralf Jung [Thu, 2 Apr 2020 13:10:04 +0000 (15:10 +0200)]
update miri

4 years agoUpdate mod.rs
Tim Diekmann [Fri, 3 Apr 2020 06:22:31 +0000 (08:22 +0200)]
Update mod.rs

4 years agoMinor doc improvements on `AllocRef`
Tim Diekmann [Fri, 3 Apr 2020 05:28:23 +0000 (07:28 +0200)]
Minor doc improvements on `AllocRef`

4 years agoAuto merge of #70726 - Centril:rollup-zrdkkpt, r=Centril
bors [Fri, 3 Apr 2020 04:18:32 +0000 (04:18 +0000)]
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

4 years agoRollup merge of #70715 - awh6al:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:52 +0000 (03:26 +0200)]
Rollup merge of #70715 - awh6al:patch-1, r=Dylan-DPC

Fix typo in operands section

4 years agoRollup merge of #70698 - nikomatsakis:x-py-json-output, r=Mark-Simulacrum
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:50 +0000 (03:26 +0200)]
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

4 years agoRollup merge of #70532 - RalfJung:miri-assign, r=eddyb
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:49 +0000 (03:26 +0200)]
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.

4 years agoRollup merge of #70224 - GuillaumeGomez:clean-up-rustdoc-js-testers, r=Dylan-DPC
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:47 +0000 (03:26 +0200)]
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

4 years agoRollup merge of #68334 - andre-richter:master, r=japaric
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:26:45 +0000 (03:26 +0200)]
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

4 years agoAuto merge of #70642 - eddyb:remap-sysroot-src, r=Mark-Simulacrum
bors [Fri, 3 Apr 2020 01:22:39 +0000 (01:22 +0000)]
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

4 years ago.unwrap() less on .span_to_snippet()
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:17:40 +0000 (03:17 +0200)]
.unwrap() less on .span_to_snippet()

4 years agoget_fn_like_arguments: avoid .unwrap
Mazdak Farrokhzad [Fri, 3 Apr 2020 01:00:24 +0000 (03:00 +0200)]
get_fn_like_arguments: avoid .unwrap

4 years agoadd_type_neq_err_label: don't .unwrap
Mazdak Farrokhzad [Fri, 3 Apr 2020 00:28:23 +0000 (02:28 +0200)]
add_type_neq_err_label: don't .unwrap

4 years agoRemove unnecessary stack overflow handler stub for sgx.
Vytautas Astrauskas [Thu, 2 Apr 2020 23:29:09 +0000 (16:29 -0700)]
Remove unnecessary stack overflow handler stub for sgx.

4 years agoAdd comment explaining the reversed operands tests
jumbatm [Thu, 2 Apr 2020 22:05:16 +0000 (08:05 +1000)]
Add comment explaining the reversed operands tests

Also, fix the goofy reversed names with something clearer.

4 years agoAuto merge of #70722 - Centril:rollup-ar4gn1x, r=Centril
bors [Thu, 2 Apr 2020 22:32:52 +0000 (22:32 +0000)]
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

4 years agoRollup merge of #70716 - matthewjasper:infer-const-type-regions, r=eddyb
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:09 +0000 (00:32 +0200)]
Rollup merge of #70716 - matthewjasper:infer-const-type-regions, r=eddyb

Unerase regions in infer_placeholder_type

closes #70608

4 years agoRollup merge of #70708 - Pocakking:fix-ascii-case-conv-typo, r=sfackler
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:07 +0000 (00:32 +0200)]
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.

4 years agoRollup merge of #70700 - jrvidal:include-macro-paths, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:06 +0000 (00:32 +0200)]
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.

4 years agoRollup merge of #70694 - lzutao:self, r=Centril
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:04 +0000 (00:32 +0200)]
Rollup merge of #70694 - lzutao:self, r=Centril

Use Self over specific type in return position

4 years agoRollup merge of #70691 - TimDiekmann:allocref-docs, r=RalfJung
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:03 +0000 (00:32 +0200)]
Rollup merge of #70691 - TimDiekmann:allocref-docs, r=RalfJung

Improve docs in `AllocRef`

r? @RalfJung

4 years agoRollup merge of #70595 - wesleywiser:remove_unused_discriminant_reads, r=oli-obk
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:01 +0000 (00:32 +0200)]
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

4 years agoRollup merge of #70487 - Mark-Simulacrum:float-unchecked-casts, r=SimonSapin
Mazdak Farrokhzad [Thu, 2 Apr 2020 22:32:00 +0000 (00:32 +0200)]
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

4 years agoswitch assignment check back to testing layout equality
Ralf Jung [Thu, 2 Apr 2020 20:49:38 +0000 (22:49 +0200)]
switch assignment check back to testing layout equality

4 years agoremove confusing about lvalues term
@ßd€łw@ħ@ß [Thu, 2 Apr 2020 21:20:43 +0000 (22:20 +0100)]
remove confusing about lvalues term

4 years agoalso use mir_assign_valid_types in from_known_layout check
Ralf Jung [Sun, 29 Mar 2020 13:43:36 +0000 (15:43 +0200)]
also use mir_assign_valid_types in from_known_layout check

4 years agoalso accept fn-ptr-type-changing assignments
Ralf Jung [Sun, 29 Mar 2020 13:14:49 +0000 (15:14 +0200)]
also accept fn-ptr-type-changing assignments

4 years agoMiri engine: stronger type-based sanity check for assignments
Ralf Jung [Sun, 29 Mar 2020 12:10:16 +0000 (14:10 +0200)]
Miri engine: stronger type-based sanity check for assignments

4 years agounerase regions in `infer_placeholder_type`
Matthew Jasper [Thu, 2 Apr 2020 19:31:51 +0000 (20:31 +0100)]
unerase regions in `infer_placeholder_type`

4 years agofix type in operands section
@ßd€łw@ħ@ß [Thu, 2 Apr 2020 19:30:46 +0000 (20:30 +0100)]
fix type in operands section

4 years agoRemove unused graphviz visualization
Dylan MacKenzie [Thu, 2 Apr 2020 18:03:47 +0000 (11:03 -0700)]
Remove unused graphviz visualization

This was used by the old framework that was removed in #69644.

4 years agoFix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase
Pocakking [Thu, 2 Apr 2020 18:01:29 +0000 (20:01 +0200)]
Fix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase

fith => fifth

4 years agoExpand and remove try_something macro.
Alex Aktsipetrov [Thu, 2 Apr 2020 17:55:56 +0000 (19:55 +0200)]
Expand and remove try_something macro.

Since https://github.com/rust-lang/rust/commit/2f6226518bd5085896a0f27cfd3ea396367ecd50
there has been only one invocation.

4 years agoAuto merge of #70692 - Centril:rollup-d0t4ecx, r=Centril
bors [Thu, 2 Apr 2020 15:33:19 +0000 (15:33 +0000)]
Auto merge of #70692 - Centril:rollup-d0t4ecx, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #70281 (Implement Hash for Infallible)
 - #70421 (parse: recover on `const fn()` / `async fn()`)
 - #70615 (Renamed `PerDefTables` to `Tables`)
 - #70631 (Update cargo)
 - #70634 (Remove some reexports in `rustc_middle`)
 - #70658 (add `STILL_FURTHER_SPECIALIZABLE` flag)
 - #70678 (Add missing markdown rust annotation)
 - #70681 (Handle unterminated raw strings with no #s properly)

Failed merges:

r? @ghost

4 years agobootstrap: add `--json-output` for rust-analyzer
Niko Matsakis [Tue, 31 Mar 2020 01:21:35 +0000 (21:21 -0400)]
bootstrap: add `--json-output` for rust-analyzer

4 years agoExpand on platform details of `include_xxx` macros
Roberto Vidal [Thu, 2 Apr 2020 14:34:43 +0000 (16:34 +0200)]
Expand on platform details of `include_xxx` macros

4 years agoRemove unnecessary intermediate pointer cast in Thread::new.
Vytautas Astrauskas [Thu, 2 Apr 2020 14:15:45 +0000 (07:15 -0700)]
Remove unnecessary intermediate pointer cast in Thread::new.

4 years agoRemove stack overflow handler stub for wasm.
Vytautas Astrauskas [Thu, 2 Apr 2020 14:15:12 +0000 (07:15 -0700)]
Remove stack overflow handler stub for wasm.

4 years agoMove #69020 test to ui/associated-const + rebless.
jumbatm [Thu, 2 Apr 2020 12:47:53 +0000 (22:47 +1000)]
Move #69020 test to ui/associated-const + rebless.

4 years agoExtend #69020 test to include reversed order.
jumbatm [Thu, 2 Apr 2020 12:45:40 +0000 (22:45 +1000)]
Extend #69020 test to include reversed order.

Make sure we check the case where the generic operand comes first, in
case any future changes make this ordering matter.

4 years agoRollup merge of #70681 - rcoh:russell/70677-raw-str-panic, r=petrochenkov
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:28:03 +0000 (14:28 +0200)]
Rollup merge of #70681 - rcoh:russell/70677-raw-str-panic, r=petrochenkov

Handle unterminated raw strings with no #s properly

The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file.

Fixes #70677

r? @petrochenkov

cc @Centril

4 years agoRollup merge of #70678 - lzutao:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:28:01 +0000 (14:28 +0200)]
Rollup merge of #70678 - lzutao:patch-1, r=Dylan-DPC

Add missing markdown rust annotation

4 years agoRollup merge of #70658 - davidtwco:issue-70285-still-further-specializable, r=eddyb
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:28:00 +0000 (14:28 +0200)]
Rollup merge of #70658 - davidtwco:issue-70285-still-further-specializable, r=eddyb

add `STILL_FURTHER_SPECIALIZABLE` flag

Contributes to #70285.

This PR adds a `STILL_FURTHER_SPECIALIZABLE` flag to `TypeFlags`
which replaces `needs_infer` and `needs_subst` in `Instance::resolve`
and `assemble_candidates_from_impls`.

r? @eddyb

4 years agoRollup merge of #70634 - Centril:import-directly, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:58 +0000 (14:27 +0200)]
Rollup merge of #70634 - Centril:import-directly, r=Mark-Simulacrum

Remove some reexports in `rustc_middle`

This will help get these imports out of the way of detecting the true dependencies in and out to `rustc_middle`, thereby helping future work towards https://github.com/rust-lang/rust/issues/65031.

4 years agoRollup merge of #70631 - ehuss:update-cargo, r=ehuss
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:57 +0000 (14:27 +0200)]
Rollup merge of #70631 - ehuss:update-cargo, r=ehuss

Update cargo

8 commits in 8a0d4d9c9abc74fd670353094387d62028b40ae9..6e07d2dfb7fc87b1c9489de41da4dafa239daf03
2020-03-24 17:57:04 +0000 to 2020-03-31 03:22:39 +0000
- Fix man page typo for "Owner Options". (rust-lang/cargo#8057)
- enable progress bar on all UNIX platforms (rust-lang/cargo#8054)
- Squelch some rustdoc warnings. (rust-lang/cargo#8052)
- Remove clippy tests. (rust-lang/cargo#8053)
- Fix -Zfeatures=itarget with certain host dependencies (rust-lang/cargo#8048)
- Checking for binary that is built as an implicit dependency of an integration test. (rust-lang/cargo#8020)
- Use stabilized version of rustdoc's --crate-version (rust-lang/cargo#8039)
- Remove the `git-checkout` subcommand. (rust-lang/cargo#8040)

4 years agoRollup merge of #70615 - Lezzz:rename-tables, r=oli-obk
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:55 +0000 (14:27 +0200)]
Rollup merge of #70615 - Lezzz:rename-tables, r=oli-obk

Renamed `PerDefTables` to `Tables`

Originally suggested by @eddyb

4 years agoRollup merge of #70421 - Centril:recover-const-async-fn-ptr, r=estebank
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:54 +0000 (14:27 +0200)]
Rollup merge of #70421 - Centril:recover-const-async-fn-ptr, r=estebank

parse: recover on `const fn()` / `async fn()`

Recover on `const fn()` and `async fn()` function pointers, suggesting to remove the qualifier.
For example:
```
error: an `fn` pointer type cannot be `async`
  --> $DIR/recover-const-async-fn-ptr.rs:6:11
   |
LL | type T3 = async fn();
   |           -----^^^^^
   |           |
   |           `async` because of this
   |           help: remove the `async` qualifier
```

r? @estebank

4 years agoRollup merge of #70281 - xfix:infallible-hash, r=dtolnay
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:52 +0000 (14:27 +0200)]
Rollup merge of #70281 - xfix:infallible-hash, r=dtolnay

Implement Hash for Infallible

https://www.reddit.com/r/rust/comments/fmllgx/never_crate_stable_alternative_to/ lists not implementing `Hash` as a reason for the `never` crate. I see no reason not to implement `Hash` for `Infallible`, so might as well do it.

No changes necessary for `!`, because `!` already implements `Hash` (see https://github.com/rust-lang/rust/pull/51404).

4 years agoImprove docs in `AllocRef`
Tim Diekmann [Thu, 2 Apr 2020 12:20:35 +0000 (14:20 +0200)]
Improve docs in `AllocRef`

4 years agoRemove unused discriminant reads from MIR bodies
Wesley Wiser [Mon, 30 Mar 2020 13:56:52 +0000 (09:56 -0400)]
Remove unused discriminant reads from MIR bodies

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

4 years agofix fulldeps test fallout
Mazdak Farrokhzad [Tue, 31 Mar 2020 21:02:59 +0000 (23:02 +0200)]
fix fulldeps test fallout

4 years agonix CachingSourceMapView reexport
Mazdak Farrokhzad [Tue, 31 Mar 2020 19:51:04 +0000 (21:51 +0200)]
nix CachingSourceMapView reexport

4 years agodirect imports for langitem stuff
Mazdak Farrokhzad [Tue, 31 Mar 2020 19:38:14 +0000 (21:38 +0200)]
direct imports for langitem stuff

4 years agouse direct import for ErrorReported
Mazdak Farrokhzad [Tue, 31 Mar 2020 19:18:30 +0000 (21:18 +0200)]
use direct import for ErrorReported

4 years agonix rustc_target::abi::* reexport in ty::layout
Mazdak Farrokhzad [Tue, 31 Mar 2020 16:16:47 +0000 (18:16 +0200)]
nix rustc_target::abi::* reexport in ty::layout

4 years agoadd `STILL_FURTHER_SPECIALIZABLE` flag
David Wood [Wed, 1 Apr 2020 15:20:27 +0000 (16:20 +0100)]
add `STILL_FURTHER_SPECIALIZABLE` flag

This commit adds a STILL_FURTHER_SPECIALIZABLE flag to `TypeFlags`
which replaces `needs_infer` and `needs_subst` in `Instance::resolve`
and `assemble_candidates_from_impls.`

Signed-off-by: David Wood <david@davidtw.co>
4 years agoAuto merge of #70628 - pietroalbini:gha-multiple-tries, r=Mark-Simulacrum
bors [Thu, 2 Apr 2020 09:10:06 +0000 (09:10 +0000)]
Auto merge of #70628 - pietroalbini:gha-multiple-tries, r=Mark-Simulacrum

GHA: enable running multiple try builds at the same time

While for auto, try and PR builds we only want the latest commit to be tested, that's not true for try builds: each commit pushed to the branch is a different PR being tested, and we want multiple PRs to be tested in parallel if there is enough demand.

Fixes #70569

4 years agotests: remove ignore directives from tests that mention core/alloc/std spans.
Eduard-Mihai Burtescu [Wed, 1 Apr 2020 01:10:13 +0000 (04:10 +0300)]
tests: remove ignore directives from tests that mention core/alloc/std spans.

4 years agoTranslate the virtual `/rustc/$hash` prefix back to a real directory.
Eduard-Mihai Burtescu [Wed, 1 Apr 2020 01:00:52 +0000 (04:00 +0300)]
Translate the virtual `/rustc/$hash` prefix back to a real directory.

4 years agoAuto merge of #70362 - TimDiekmann:alloc-overhaul, r=Amanieu
bors [Thu, 2 Apr 2020 06:08:35 +0000 (06:08 +0000)]
Auto merge of #70362 - TimDiekmann:alloc-overhaul, r=Amanieu

Overhaul of the `AllocRef` trait to match allocator-wg's latest consens; Take 2

GitHub won't let me reopen #69889 so I make a new PR.

In addition to #69889 this fixes the unsoundness of `RawVec::into_box` when using allocators supporting overallocating. Also it uses `MemoryBlock` in `AllocRef` to unify `_in_place` methods by passing `&mut MemoryBlock`. Additionally, `RawVec` now checks for `size_of::<T>()` again and ignore every ZST. The internal capacity of `RawVec` isn't used by ZSTs anymore, as `into_box` now requires a length to be specified.

r? @Amanieu

fixes rust-lang/wg-allocators#38
fixes rust-lang/wg-allocators#41
fixes rust-lang/wg-allocators#44
fixes rust-lang/wg-allocators#51

4 years agoHandle unterminated raw strings with no #s properly
Russell Cohen [Thu, 2 Apr 2020 04:08:58 +0000 (00:08 -0400)]
Handle unterminated raw strings with no #s properly

The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file.

4 years agoUse Self over specific type in return position
Lzu Tao [Thu, 2 Apr 2020 03:55:35 +0000 (03:55 +0000)]
Use Self over specific type in return position

4 years agoAuto merge of #70667 - flip1995:clippyup, r=Manishearth
bors [Thu, 2 Apr 2020 03:16:46 +0000 (03:16 +0000)]
Auto merge of #70667 - flip1995:clippyup, r=Manishearth

Update Clippy

r? @Manishearth

Closes #70663

4 years agoAdd missing markdown rust annotation
lzutao [Thu, 2 Apr 2020 01:34:57 +0000 (08:34 +0700)]
Add missing markdown rust annotation

4 years agoRemove duplicated code in trait selection
Esteban Küber [Tue, 31 Mar 2020 23:50:15 +0000 (16:50 -0700)]
Remove duplicated code in trait selection

4 years agoAuto merge of #70672 - Dylan-DPC:rollup-cco9bbd, r=Dylan-DPC
bors [Wed, 1 Apr 2020 20:30:35 +0000 (20:30 +0000)]
Auto merge of #70672 - Dylan-DPC:rollup-cco9bbd, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70535 (Track the finalizing node in the specialization graph)
 - #70590 (Miri: make backtrace function names and spans match up)
 - #70616 (rustc_target::abi: rename FieldPlacement to FieldsShape.)
 - #70626 (cargotest: remove webrender)
 - #70649 (clean up E0468 explanation)
 - #70662 (compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.)

Failed merges:

r? @ghost

4 years agoRollup merge of #70662 - eddyb:compiletest-stdout-fix, r=Mark-Simulacrum
Dylan DPC [Wed, 1 Apr 2020 20:25:23 +0000 (22:25 +0200)]
Rollup merge of #70662 - eddyb:compiletest-stdout-fix, r=Mark-Simulacrum

compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.

This PR undoes a change made during #69916, which became unnecessary during review but was left in by accident, and which isn't correct due to `libtest` using `std::io::set_print`, which overwrites the `println!` behavior but *not* `writeln!(std::io::stdout(), ...)`.

The effect of using `writeln!(std::io::stdout(), ...)` was that the diff output would show *while* running the tests, instead of at the end, when failing tests are listed.

r? @Mark-Simulacrum cc @oli-obk

4 years agoRollup merge of #70649 - GuillaumeGomez:cleanup-e0468, r=Dylan-DPC
Dylan DPC [Wed, 1 Apr 2020 20:25:22 +0000 (22:25 +0200)]
Rollup merge of #70649 - GuillaumeGomez:cleanup-e0468, r=Dylan-DPC

clean up E0468 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70626 - pietroalbini:remove-webrender-cargotest, r=Mark-Simulacrum
Dylan DPC [Wed, 1 Apr 2020 20:25:20 +0000 (22:25 +0200)]
Rollup merge of #70626 - pietroalbini:remove-webrender-cargotest, r=Mark-Simulacrum

cargotest: remove webrender

The current webrender commit occasionally fails without a reason, and the latest webrender commit is missing a dependency on our Windows builders. It's not worth installing an extra dependency for cargotest, and the spurious failure makes keeping this test not worth it.

r? @Mark-Simulacrum

4 years agoRollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obk
Dylan DPC [Wed, 1 Apr 2020 20:25:18 +0000 (22:25 +0200)]
Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obk

rustc_target::abi: rename FieldPlacement to FieldsShape.

Originally suggested by @eddyb.

4 years agoRollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obk
Dylan DPC [Wed, 1 Apr 2020 20:25:16 +0000 (22:25 +0200)]
Rollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obk

Miri: make backtrace function names and spans match up

Currently, Miri backtraces are a bit confusing:
```
error: Undefined Behavior: entering unreachable code
  --> tests/compile-fail/never_transmute_void.rs:10:11
   |
10 |     match v {} //~ ERROR  entering unreachable code
   |           ^ entering unreachable code
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
note: inside call to `f` at tests/compile-fail/never_transmute_void.rs:17:5
  --> tests/compile-fail/never_transmute_void.rs:17:5
   |
17 |     f(v); //~ inside call to `f`
   |     ^^^^
   = note: inside call to `main` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34
   = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73
   = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5
```
When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is *where the main function is called*.

This is not how backtraces are usually rendered (including e.g. with `RUST_BACKTRACE=1`). Usually we print next to each function name where inside that function the frame is currently executing, not where the *parent* frame is executing. With this PR and the Miri side at https://github.com/rust-lang/miri/pull/1283, the backtrace now looks as follows:
```
error: Undefined Behavior: entering unreachable code
  --> tests/compile-fail/never_transmute_void.rs:10:11
   |
10 |     match v {} //~ ERROR entering unreachable code
   |           ^ entering unreachable code
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
   = note: inside `f` at tests/compile-fail/never_transmute_void.rs:10:11
note: inside `main` at tests/compile-fail/never_transmute_void.rs:17:5
  --> tests/compile-fail/never_transmute_void.rs:17:5
   |
17 |     f(v); //~ inside `main`
   |     ^^^^
   = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:67:34
   = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:52:73
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6034 ~ std[87db]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc/src/libstd/sys_common/backtrace.rs:130:5
```
Now function name and printed line numbers match up in the notes.

This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside.

With this, we can also remove the `span` field from Miri's stack frames (which used to track the *caller span* of that frame, quite confusing), and then get of a whole lot of `span` arguments that ultimately just served to fill that field (and as a fallback for `caller_location`, which however was never actually used).

r? @oli-obk

4 years agoRollup merge of #70535 - jonas-schievink:graph-refactor, r=nikomatsakis
Dylan DPC [Wed, 1 Apr 2020 20:25:15 +0000 (22:25 +0200)]
Rollup merge of #70535 - jonas-schievink:graph-refactor, r=nikomatsakis

Track the finalizing node in the specialization graph

Fixes https://github.com/rust-lang/rust/issues/70419
Fixes https://github.com/rust-lang/rust/issues/70442

r? @eddyb

4 years agoIn Thread::new, add a comment that a panic could cause a memory leak.
Vytautas Astrauskas [Wed, 1 Apr 2020 19:46:14 +0000 (12:46 -0700)]
In Thread::new, add a comment that a panic could cause a memory leak.

4 years agoUpdate Clippy
flip1995 [Wed, 1 Apr 2020 19:06:06 +0000 (21:06 +0200)]
Update Clippy

4 years agocompiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.
Eduard-Mihai Burtescu [Wed, 1 Apr 2020 16:40:09 +0000 (19:40 +0300)]
compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.

4 years agoAuto merge of #70653 - Centril:rollup-vh5x5e5, r=Centril
bors [Wed, 1 Apr 2020 14:21:31 +0000 (14:21 +0000)]
Auto merge of #70653 - Centril:rollup-vh5x5e5, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #70511 (Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization)
 - #70522 (Improve error messages for raw strings (#60762))
 - #70547 (Add `can_unwind` field to `FnAbi`)
 - #70591 (Ensure LLVM is in the link path for "fulldeps" tests)
 - #70627 (Use place directly its copy)
 - #70652 (Add git repo address to unstable book)

Failed merges:

 - #70634 (Remove some reexports in `rustc_middle`)

r? @ghost

4 years agoRollup merge of #70652 - lzutao:patch-1, r=Centril
Mazdak Farrokhzad [Wed, 1 Apr 2020 12:32:21 +0000 (14:32 +0200)]
Rollup merge of #70652 - lzutao:patch-1, r=Centril

Add git repo address to unstable book