Skip to content

RFC: const ergonomics for NonZero<T> #3786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion text/3786-const-nonzero-ergonomics.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ foo(123 - 1); // Error - coercion not applied for expressions.
const MAGIC_VALUE: NonZero<i8> = 123; // OK - coercion logic is same as when calling a fn.

let i: i8 = 123;
foo(i); // Error - the coercion only applies to literals, not for values in general.
foo(i); // Error - the coercion only applies to literals and `i` is not a literal.
```

# Drawbacks
Expand Down