[Meta] The never type `!`: which parts of Rust's never type Vx takes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 15/100
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
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
loopwith nobreakends a-> !body. A bug fix: a-> !function that runs forever cannot be written today. - #3393 — an enum with no variants has no values, and
matchneeds no arm for it. This gives most of the value ofResult<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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vx-lang/Vx
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
bug testing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
`pub struct` gives "Expected 'fn' after 'pub'": the error should say that a struct needs no `pub`Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug devex
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
longbridge/gpui-kit#4031 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
neuralmagic/crucible#465 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
compiler P3
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
HerringtonDarkholme/hd-lang#2162 ·
Maintainers usually reply within 1 day
-
embedded SQL: pin correlated-guard behaviour when a closed variable is reassigned inside a branchOpenpriority: low
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
jonathanong/no-mistakes#3627 ·
Maintainers usually reply within 1 day