[Meta] The never type `!`: which parts of Rust's never type Vx takes

Open
#3,391 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
15/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
compilers

Research direction

This is a tracking issue, so start from its table and the three linked sub-issues: #3392 (a loop with no break in a -> ! body, error E3028), #3393 (match arms for empty enums, error E3020) and #3394 (! as an ordinary type, deferred). Reproduce the table rows on main with a small program before touching the compiler. Contracts context is in #3390. Done means the sub-issues are closed or explicitly deferred, and the table rows are updated.

Written by the indexing model from the issue text.

Description

core-lang tracking

Rust's never type, ! (https://doc.rust-lang.org/std/primitive.never.html), is the type of code that never gives a value. This issue tracks which parts of it Vx takes.

What Vx has today

Each line was checked with a small program on main.

Rust Vx
fn f() -> !, and a call to it where any value is expected Yes (#1273)
return, break and panic(..) where a value is expected, such as an if branch or a match arm Yes
The prover knows that no path continues after a -> ! call Yes (#1276)
loop { .. } with no break never ends No: a -> ! body that ends in one gets E3028
A match needs no arm for a variant whose payload has no values No: Result<i32, Never> with enum Never {} needs an Err arm (E3020)
! as an ordinary type: let x : ! = .., Result<i32, !> No: a parse error

Plan

  • #3392 — a loop with no break ends a -> ! body. A bug fix: a -> ! function that runs forever cannot be written today.
  • #3393 — an enum with no variants has no values, and match needs no arm for it. This gives most of the value of Result<T, !>, with no new syntax.
  • #3394 — ! as an ordinary type. Not now. The issue records why, and what would change that.

The contracts chapter explains -> ! for the prover (#3390).

Dominant language
Rust
Stars
35
Forks
5
Avg merge
12h 26m
Merged PRs (30d)
799

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vx-lang/Vx

All issues in vx-lang/Vx

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.