Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #70174

Merged
merged 23 commits into from
Mar 20, 2020
Merged

Rollup of 9 pull requests #70174

merged 23 commits into from
Mar 20, 2020

Conversation

JohnTitor
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

oli-obk and others added 23 commits March 11, 2020 13:55
…d a long lost assertion

This reverts part of commit 9712fa4.
Co-Authored-By: Ralf Jung <post@ralfj.de>
This commit modifies the use of `subst_and_normalize_erasing_regions` on
parts of the MIR bodies returned from `instance_mir`, so that
`InstanceDef::CloneShim` and `InstanceDef::DropGlue` (where there is a
type) do not perform substitutions. This avoids double substitutions and
enables polymorphic `InstanceDef`s.

Signed-off-by: David Wood <david@davidtw.co>
Fixes rust-lang#55099

The minimized reproducer in issue rust-lang#55099 now compiles successfully.
This commit adds a regression test for it.
patch is required to avoid compiler errors by building src/libpanic_unwind/hermit.rs
As discussed on reddit, this commit addresses two issues with the
documentation of `mem::forget()`:

* The documentation of `mem::forget()` can confuse the reader because of the
  discrepancy between usage examples that show correct usage and the
  accompanying text which speaks of the possibility of double-free.  The
  text that says "if the panic occurs before `mem::forget` was called"
  refers to a variant of the second example that was never shown, modified
  to use `mem::forget` instead of `ManuallyDrop`.  Ideally the documentation
  should show both variants, so it's clear what it's talking about.

  Also, the double free could be fixed just by placing `mem::forget(v)`
  before the construction of `s`.  Since the lifetimes of `s` and `v`
  wouldn't overlap, there would be no point where panic could cause a double
  free.  This could be mentioned, and contrasted against the more robust fix
  of using `ManuallyDrop`.

* This sentence seems unjustified: "For some types, operations such as
  passing ownership (to a funcion like `mem::forget`) requires them to
  actually be fully owned right now [...]".  Unlike C++, Rust has no move
  constructors, its moves are (possibly elided) bitwise copies.  Even if you
  pass an invalid object to `mem::forget`, no harm should come to pass
  because `mem::forget` consumes the object and exists solely to prevent
  drop, so there no one left to observe the invalid state state.
…m::forget.

As pointed out by Ralf Jung, dangling references and boxes are
undefined behavior as per
https://doc.rust-lang.org/reference/behavior-considered-undefined.html
and the Miri checker.
Co-Authored-By: Ralf Jung <post@ralfj.de>
Co-Authored-By: lzutao <taolzu@gmail.com>
Clarify the relationship between `forget()` and `ManuallyDrop`.

As discussed on reddit, this commit addresses two issues with the
documentation of `mem::forget()`:

* The documentation of `mem::forget()` can confuse the reader because of the
  discrepancy between usage examples that show correct usage and the
  accompanying text which speaks of the possibility of double-free.  The
  text that says "if the panic occurs before `mem::forget` was called"
  refers to a variant of the second example that was never shown, modified
  to use `mem::forget` instead of `ManuallyDrop`.  Ideally the documentation
  should show both variants, so it's clear what it's talking about.

  Also, the double free could be fixed just by placing `mem::forget(v)`
  before the construction of `s`.  Since the lifetimes of `s` and `v`
  wouldn't overlap, there would be no point where panic could cause a double
  free.  This could be mentioned, and contrasted against the more robust fix
  of using `ManuallyDrop`.

* This sentence seems unjustified: "For some types, operations such as
  passing ownership (to a funcion like `mem::forget`) requires them to
  actually be fully owned right now [...]".  Unlike C++, Rust has no move
  constructors, its moves are (possibly elided) bitwise copies.  Even if you
  pass an invalid object to `mem::forget`, no harm should come to pass
  because `mem::forget` consumes the object and exists solely to prevent
  drop, so there no one left to observe the invalid state state.
…lfJung

Compute the correct layout for variants of uninhabited enums

r? @eddyb
cc @RalfJung

fixes rust-lang#69191
cc rust-lang#69763
codegen/mir: support polymorphic `InstanceDef`s

cc rust-lang#69925

This PR modifies the use of `subst_and_normalize_erasing_regions` on parts of the MIR bodies returned from `instance_mir`, so that `InstanceDef::CloneShim` and `InstanceDef::DropGlue` (where there is a type) do not perform substitutions. This avoids double substitutions and enables polymorphic `InstanceDef`s.

r? @eddyb
cc @nikomatsakis
…ikomatsakis

Add regression test for TAIT lifetime inference (issue rust-lang#55099)

Fixes rust-lang#55099

The minimized reproducer in issue rust-lang#55099 now compiles successfully.
This commit adds a regression test for it.
…atsakis

remove unused imports

patch is required to avoid compiler errors by building src/libpanic_unwind/hermit.rs
doc: Add quote to .init_array

The current formatting is not good without quotes:
![without-quote](https://i.imgur.com/RkIm4cr.png)
…rk-Simulacrum

triagebot.toml: accept cleanup-crew

r? @Mark-Simulacrum
@JohnTitor
Copy link
Member Author

@bors r+ p=9 rollup=never

@bors
Copy link
Contributor

bors commented Mar 20, 2020

📌 Commit 43c7a50 has been approved by JohnTitor

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 20, 2020
@JohnTitor JohnTitor added the rollup A PR which is a rollup label Mar 20, 2020
@bors
Copy link
Contributor

bors commented Mar 20, 2020

⌛ Testing commit 43c7a50 with merge 547a95a3cd8d194643781a20ea37b96a36819445...

@JohnTitor
Copy link
Member Author

Hm, failed in dist-i686-msvc and it seems spurious.

@bors retry

error: failed to get `cc` as a dependency of package `bootstrap v0.0.0 (D:\a\1\s\src\bootstrap)`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  error inflating zlib stream; class=Zlib (5)
failed to run: D:\a\1\s\build\i686-pc-windows-msvc\stage0\bin\cargo.exe build --manifest-path D:\a\1\s\src/bootstrap/Cargo.toml --locked
Build completed unsuccessfully in 0:00:09

@bors
Copy link
Contributor

bors commented Mar 20, 2020

⌛ Testing commit 43c7a50 with merge fa81648701f90b92034bf9e5ecbcf48aaf5c2e5c...

@bors
Copy link
Contributor

bors commented Mar 20, 2020

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 20, 2020
@Centril
Copy link
Contributor

Centril commented Mar 20, 2020

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 20, 2020
@bors
Copy link
Contributor

bors commented Mar 20, 2020

⌛ Testing commit 43c7a50 with merge fbafce24329e954b672e5c8a5ffb5dbd39e007c9...

@JohnTitor
Copy link
Member Author

Well, the above failure occurs again.

@bors
Copy link
Contributor

bors commented Mar 20, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 20, 2020
@JohnTitor
Copy link
Member Author

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 20, 2020
@bors
Copy link
Contributor

bors commented Mar 20, 2020

⌛ Testing commit 43c7a50 with merge 2835ca6...

@bors
Copy link
Contributor

bors commented Mar 20, 2020

☀️ Test successful - checks-azure
Approved by: JohnTitor
Pushing 2835ca6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 20, 2020
@bors bors merged commit 2835ca6 into rust-lang:master Mar 20, 2020
@JohnTitor JohnTitor deleted the rollup-0lum0jh branch March 20, 2020 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants