We have a semantically relevant inlining pass?

オープン
#597 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
20/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
rust
領域
compilers

調査の方向性

Start with the linked rust-lang/rust pull request 134082 and this issue's discussion of mir-opt-level=0, MIR transforms, drop elaboration, and rustc_force_inline. Determine which transforms remain enabled and whether the inlining behavior changes the documented opsem or UB model; done requires an agreed policy for future MIR transforms and their documentation.

索引モデルが issue の本文から書いたものです。

説明

I was just made aware of https://github.com/rust-lang/rust/pull/134082, which is a concerning PR: it seems to add an inlining pass that cannot be disabled. This is something that should have involved t-opsem and maybe even t-lang since it affects which code has UB.

I don't think we should have any MIR transforms that remain enabled under mir-opt-level=0, except for the ones that transform the MIR from one dialect to another -- at the moment, that should be drop elaboration and nothing else. Every such MIR transform is semantically relevant and needs to be accounted for in the documentation of what is and is not UB.

For the concrete example of inlining, https://github.com/rust-lang/rust/pull/134082 had the side-effect of removing UB related to violating the Stacked Borrows protectors of references passed to force-inline functions. Was it an intended part of the PR to remove such UB? I assume not, since surely someone would have pinged t-opsem. So please take this into account for future work on MIR transforms: everything that can't be turned off becomes part of the opsem!

And then the next question is -- why is it so important that these functions be inlined that we have to adjust the opsem to make it happen? I found no use of rustc_force_inline in the standard library. The PR mentions ROP gadgets for pointer authentication instructions; those are AFAIK concerns that live outside the opsem so they should be resolved in a way that does not impact the opsem or Miri.

Cc @saethlin @davidtwco

主要言語
言語のデータがありません
スター
760
フォーク
68
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/unsafe-code-guidelines のほかの issue

rust-lang/unsafe-code-guidelines の issue をすべて見る

似ている issue

Compilers の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。