Skip to content

[1.95.0] Document provenance and its use in const eval#707

Open
kirtchev-adacore wants to merge 1 commit into
rust-lang:mainfrom
kirtchev-adacore:provenance-during-const-eval
Open

[1.95.0] Document provenance and its use in const eval#707
kirtchev-adacore wants to merge 1 commit into
rust-lang:mainfrom
kirtchev-adacore:provenance-during-const-eval

Conversation

@kirtchev-adacore

Copy link
Copy Markdown
Contributor

The information has been taken from

Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
@kirtchev-adacore kirtchev-adacore force-pushed the provenance-during-const-eval branch from 812a13f to ecca0f0 Compare July 1, 2026 10:16
Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
The information has been taken from
- [core::ptr
  Provenance](https://doc.rust-lang.org/core/ptr/index.html#provenance)
- [reference#2091](rust-lang/reference#2091)
- [reference#2139](rust-lang/reference#2138)
@kirtchev-adacore kirtchev-adacore force-pushed the provenance-during-const-eval branch from ecca0f0 to 21bb6de Compare July 1, 2026 11:51
Comment thread src/glossary.rst
well-formed indirection value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A :dt:`well-formed indirection value` is an :t:`indirection value` with :t:`provenance`, where all bytes that comprise the :t:`indirection value` are part of the same group.

@tshepang tshepang Jul 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the definition feels incomplete, but I don't know yet how to fill it... maybe inspiration can be taken from a review from my old pr

View changes since the review

@kirtchev-adacore kirtchev-adacore Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe

... bytes that comprise the :t:`indirection value` are initialized and are part
of the same group.

Basically we want to say that an indirection value does not (somehow) contain the bytes of something else.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this about "group of bytes"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right.

I think what the Reference PRs and core::ptr are trying to say is that you can obtain a value by doing sketchy things, such as memory transmutation. If you plan on using that value as an indirection value with provenance, then the value better have "correct bytes", what 2091 calls "bytes must be fragments of the same original pointer value in the correct order" and 2138 calls "part of an adjacent group of correctly-ordered bytes that form an entire pointer".

Comment thread src/glossary.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants