Skip to content

Conversation

@euank
Copy link
Contributor

@euank euank commented Aug 24, 2025

Rust 1.89 produces the following output for cargo build in rslib/i18n:

error: unicode codepoint changing visible direction of text present in literal
...
warning: allow(text_direction_codepoint_in_literal) is ignored unless specified at crate level
 --> rslib/i18n/src/generated.rs:7:10
  |
7 | #![allow(text_direction_codepoint_in_literal)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This change fixes it.

This ensures that some third-party crate that pulls in this code as library code (and thus isn't subject to the rust-toolchain file in this repo) doesn't hit this compilation error.

... also the nixpkgs build of anki uses nixpkg's current rust version, not anki's rust-toolchain version 🙃

Rust 1.89 produces the following output:

```
error: unicode codepoint changing visible direction of text present in literal
...
warning: allow(text_direction_codepoint_in_literal) is ignored unless specified at crate level
 --> rslib/i18n/src/generated.rs:7:10
  |
7 | #![allow(text_direction_codepoint_in_literal)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

This change fixes it.

This ensures that some third-party crate that pulls in this code as
library code (and thus isn't subject to the rust-toolchain file in this
repo) doesn't hit this compilation error.
@euank euank mentioned this pull request Aug 24, 2025
15 tasks
Copy link

@rillian rillian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolves the build failure for me.

It's unfortunate to widen the scope of the allow to files where the lint is actually useful, but the change was made to handle literals in macro expansions, which of course could come from other source files or indeed be generated at compile time, so provenance tracking is complicated.

Maybe a better fix would be to convert the text-direction markers to unicode escape sequences \u{202b}? Since this is a generated file, making the rtl strings unreadable is less of a problem.

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html

#![allow(text_direction_codepoint_in_literal)]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another linebreak between this and the following mod ... line would be more readable.

@dae
Copy link
Member

dae commented Sep 1, 2025

Thank you both! Agreed that auto-conversion during generation would be better, and I'll push an update that does so.

@dae dae closed this in 71ec878 Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants