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

shim.rs: avoid creating Call terminators calling Self #73359

Merged
merged 6 commits into from
Jun 20, 2020
Merged

shim.rs: avoid creating Call terminators calling Self #73359

merged 6 commits into from
Jun 20, 2020

Conversation

jonas-schievink
Copy link
Contributor

Also contains some cleanup and doc comment additions so I could make sense of the code.

Fixes #73109
Closes #73175

r? @matthewjasper

It does the same thing as `Deref` now
The `Call` terminator only works with `FnDef` and `FnPtr` types.
It happened to work with `Self` so far because it was always
substituted with the real type before being used.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 14, 2020
@RalfJung
Copy link
Member

--Zdump-mir AFAIK can dump shims (at least it used to), so is it possible to have a mir-opt test for this?

@matthewjasper
Copy link
Contributor

unusual-item-types.rs and slice-drop-shim.rs test drop shims.

@RalfJung
Copy link
Member

I suppose that's a "yes"? :D

// (as only `FnDef` and `FnPtr` callees are allowed in MIR).

// EMIT_MIR rustc.ops-function-Fn-call.AddMovesForPackedDrops.before.mir
fn main() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow up we should add tests for all of the shims.

@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jun 17, 2020

📌 Commit 4cb26ad has been approved by matthewjasper

@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 Jun 17, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 20, 2020
…arth

Rollup of 16 pull requests

Successful merges:

 - rust-lang#71420 (Specialization is unsound)
 - rust-lang#71899 (Refactor `try_find` a little)
 - rust-lang#72689 (add str to common types)
 - rust-lang#72791 (update coerce docs and unify relevant tests)
 - rust-lang#72934 (forbid mutable references in all constant contexts except for const-fns)
 - rust-lang#73027 (Make `need_type_info_err` more conservative)
 - rust-lang#73347 (Diagnose use of incompatible sanitizers)
 - rust-lang#73359 (shim.rs: avoid creating `Call` terminators calling `Self`)
 - rust-lang#73399 (Clean up E0668 explanation)
 - rust-lang#73436 (Clean up E0670 explanation)
 - rust-lang#73440 (Add src/librustdoc as an alias for src/tools/rustdoc)
 - rust-lang#73442 (pretty/mir: const value enums with no variants)
 - rust-lang#73452 (Unify region variables when projecting associated types)
 - rust-lang#73458 (Use alloc::Layout in DroplessArena API)
 - rust-lang#73484 (Update the doc for std::prelude to the correct behavior)
 - rust-lang#73506 (Bump Rustfmt and RLS)

Failed merges:

r? @ghost
@bors bors merged commit fe4b485 into rust-lang:master Jun 20, 2020
@jonas-schievink jonas-schievink deleted the do-the-shimmy branch July 25, 2020 12:30
@cuviper cuviper added this to the 1.46 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

ICE: -Zvalidate-mir: broken mir in libcore
6 participants