Can references inside an enum transiently set an invalid enum discriminant?

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

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

評価

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

調査の方向性

Start by reading the referenced unsafe-code-guidelines issue comment and the discussion around rust-lang/rust pull request 161452. Determine whether the stated temporary-invalid-value rule applies to niche-optimized enum discriminants, then document the agreed semantic conclusion in the relevant guidelines discussion.

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

説明

disposition-merge finished-final-comment-period S-waiting-on-review T-opsem to-announce

Per https://github.com/rust-lang/unsafe-code-guidelines/issues/414#issuecomment-4096685918, opsem consensus appeared to be that a &mut T can write an invalid value of T "temporarily", so long as it's restored to a valid form before returning into safe code. Does this also mean that, for a T with niches, it is valid to overwrite the discriminant of a wrapping enum (e.g. could a &mut NonNull<T> transiently write 0 or uninit even if the said NonNull was part of an Option<NonNull<T>>)?

Relevant to https://github.com/rust-lang/rust/pull/161452

主要言語
言語のデータがありません
スター
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 を短くまとめたダイジェスト。