Cargo: Provide help when encountering `O` (uppercase `o`) in version numbers

Created on 27 Mar 2020  路  1Comment  路  Source: rust-lang/cargo

Describe the problem you are trying to solve
When typing version numbers for a crate, it can happen to write an uppercase o (O) instead of a zero 0. On French keyboards for example, the numbers require SHIFT, and the 0 key is near the o key. You can therefore type O and not remark it because in monospaced fonts it looks like a zero.
You can then appreciate a not-that-helpful error from Cargo, and remark your mistake either immediately or never:

error: failed to parse manifest at `path/to/Cargo.toml`

Caused by:
  failed to parse the version requirement `O.7.3` for dependency `rand`

Caused by:
  the given version requirement is invalid

Describe the solution you'd like
It would be easy to diagnose that the user typed an uppercase o, and suggest them to replace it with a zero. This is the kind of suggestions rustc has adopted to handle mistakes with the Greek question mark or the non-breaking space.
You may have an error like:

error: failed to parse manifest at `path/to/Cargo.toml`

Caused by:
  failed to parse the version requirement `O.7.3` for dependency `rand`

Caused by:
  the given version requirement is invalid

Help:
  the uppercase "o" `O` looks like a zero `0`, but it isn't
A-semver C-feature-request

Most helpful comment

Working on it ;)
edit: no longer working on it: it seems the best place to add this feature is within the semver crate or its dependency semver-parser.

>All comments

Working on it ;)
edit: no longer working on it: it seems the best place to add this feature is within the semver crate or its dependency semver-parser.

Was this page helpful?
0 / 5 - 0 ratings