Skip to content

refactor: use std::optional#14094

Open
eric-wieser wants to merge 2 commits into
leanprover:masterfrom
eric-wieser:optional
Open

refactor: use std::optional#14094
eric-wieser wants to merge 2 commits into
leanprover:masterfrom
eric-wieser:optional

Conversation

@eric-wieser

@eric-wieser eric-wieser commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This PR removes the custom lean::optional now that C++20 is available.

The only breakage is that the forwarding constructor now needs an initial std::in_place argument.

One motivation for this is that it replaces #10815, which corrects an inefficient move constructor and an exception-unsafe copy-constructor.

Future stylistic cleanup could use nullopt in more places and drop the some helpers, or even drop the lean::optional alias entirely.

@eric-wieser eric-wieser requested a review from leodemoura as a code owner June 17, 2026 16:48
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jun 17, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase e61bb27413928f773d9046cb760e965d1affe94e --onto 4792cd22887c8b529a351f6563b693426ff2a8f8. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-17 17:25:29)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase e61bb27413928f773d9046cb760e965d1affe94e --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-06-17 17:25:31)

@Kha Kha added the release-ci Enable all CI checks for a PR, like is done for releases label Jun 18, 2026
@Kha

Kha commented Jun 18, 2026

Copy link
Copy Markdown
Member

!bench

@leanprover-radar

leanprover-radar commented Jun 18, 2026

Copy link
Copy Markdown

Benchmark results for 6fdb26f against e61bb27 are in. No significant results found. @Kha

  • 🟥 build//instructions: +1.7G (+0.02%)

No significant changes detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-ci Enable all CI checks for a PR, like is done for releases toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants