Skip to content

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

Merged
tshepang merged 6 commits into
rust-lang:mainfrom
kirtchev-adacore:provenance-during-const-eval
Jul 24, 2026
Merged

[1.95.0] Document provenance and its use in const eval#707
tshepang merged 6 commits 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
@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 Outdated
Comment thread src/glossary.rst Outdated
@kirtchev-adacore
kirtchev-adacore force-pushed the provenance-during-const-eval branch 2 times, most recently from e42d104 to 1844443 Compare July 8, 2026 07:20
@rustbot

This comment has been minimized.

@kirtchev-adacore
kirtchev-adacore force-pushed the provenance-during-const-eval branch 2 times, most recently from e23ca4b to a8393ef Compare July 8, 2026 07:26
@kirtchev-adacore
kirtchev-adacore requested a review from tshepang July 8, 2026 07:28

@PLeVasseur PLeVasseur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @kirtchev-adacore, thanks for taking the time to write this up.

I spotted some things we could tune up here and there for precision and to match current understandings for provenance that seem to exist in the Project.

I know the release is tomorrow and we meet Friday, but hopefully this is not too much 😅

View changes since this review

Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/types-and-traits.rst Outdated
Comment thread src/values.rst Outdated
Comment thread src/glossary.rst Outdated
Comment thread src/values.rst Outdated
@kirtchev-adacore
kirtchev-adacore force-pushed the provenance-during-const-eval branch from 1f1b867 to e1d4a62 Compare July 9, 2026 08:51

@PLeVasseur PLeVasseur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for incorporating the ideas.
Really just a couple of small nits left.

Perhaps we punt on one of the items I raised? I can open an issue.

View changes since this review

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 e1d4a62 to 979328b Compare July 10, 2026 07:34
Comment thread src/glossary.rst Outdated
provenance
^^^^^^^^^^

:dt:`Provenance` is an optional property of :t:`[pointer]s` that restricts the memory locations the :t:`pointer` may access, the timespan during which the accesses may occur, and whether the accesses may read from or write to memory.

@tshepang tshepang Jul 13, 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.

  • I understand "access" as ability to read from the memory locations, such that a read is implied (unless you find the suggestion too vague)
  • "write to memory" does not indicate which memory
Suggested change
:dt:`Provenance` is an optional property of :t:`[pointer]s` that restricts the memory locations the :t:`pointer` may access, the timespan during which the accesses may occur, and whether the accesses may read from or write to memory.
:dt:`Provenance` is an optional property of :t:`[pointer]s` that restricts the memory locations the :t:`pointer` may access, the timespan during which the accesses may occur, and whether the :t:`pointer` can write to such memory locations.

View changes since the review

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.

Note that you left out reads! This is important, as provenance dictates read and write permissions.

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.

access sounds like it implies reads, at least in the context of a programming language

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.

I do not agree. "Memory access" has always meant reads and writes. You have RAM (Random Access Memory), which is both read and written, as opposed to ROM (Read-only Memory).

Also, from core::ptr:

Whether a pointer is valid depends on the operation it is used for (read or write), and the extent of the memory that is accessed (i.e., how many bytes are read/written)

If you do not like the verb "to access", then you will have to suggest a better alternative.

@tshepang tshepang Jul 24, 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.

If access means read and/or write, then we are here saying: "restricts the memory locations the pointer may read-write, when those reads-writes can happen, and whether those are reads and/or writes".

That is, "access" implies reads, but only includes writes optionally (hence my suggestion).

An alternative, in case that still doesn't work (to avoid "access'):

Provenance is an optional property of pointers that restricts the memory locations the pointer may read, the timespan during which the read may occur, and whether the pointer can also write to such memory locations.

It's a little vague, so maybe:

Provenance is an optional property of pointers that restricts the memory locations the pointer may read, the timespan during which the read may occur, and whether those reads can also include writes.

Not sure. What do you think.

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.

More like "and whether the reads and/or writes are allowed in the first place".

I do not think your suggestion is correct, as once again you are leaving out writes from several of the provenance properties. I am not sure why you are trying to "save on text", and cause the rule to imply additional semantics. One of the goals of the FLS is to spell out rules clearly, even if there is repetition, so that there is no doubt, implication, or ambiguity.

Basically "provenance" says

  • You are allowed to access memory locations from 0x000A to 0x001A.
  • You are allowed to access those memory locations from this part of your program to this part of your program.
  • You are allowed to read and/or write from/to those memory locations.

There is "write-only" memory from the point of view of your program! For example, GPU memory can behave this way. Your program simply dumps data onto the GPU buffers, and the GPU reads it. Your program does not read from the GPU.

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.

There is "write-only" memory from the point of view of your program! For example, GPU memory can behave this way.

good to know

@kirtchev-adacore
kirtchev-adacore force-pushed the provenance-during-const-eval branch from 357ecb4 to faac041 Compare July 23, 2026 07:03
@rustbot

This comment has been minimized.

@kirtchev-adacore
kirtchev-adacore force-pushed the provenance-during-const-eval branch from 4d0400d to bed3e05 Compare July 24, 2026 10:20
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread src/glossary.rst Outdated
Comment thread src/values.rst
Comment thread src/values.rst
Comment thread src/changelog.rst Outdated
@kirtchev-adacore
kirtchev-adacore force-pushed the provenance-during-const-eval branch from 5346bdc to 14fb5cc Compare July 24, 2026 11:29
@tshepang
tshepang dismissed PLeVasseur’s stale review July 24, 2026 11:56

delegated to me

@tshepang
tshepang enabled auto-merge July 24, 2026 11:56
@tshepang
tshepang added this pull request to the merge queue Jul 24, 2026
Merged via the queue into rust-lang:main with commit 85105eb Jul 24, 2026
3 checks passed
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.

4 participants