Skip to content

mode-rust.js is not found #2700

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

Closed
traviscross opened this issue May 11, 2025 · 1 comment · Fixed by #2710
Closed

mode-rust.js is not found #2700

traviscross opened this issue May 11, 2025 · 1 comment · Fixed by #2710
Labels
C-bug Category: A bug, incorrect or unintended behavior

Comments

@traviscross
Copy link
Contributor

traviscross commented May 11, 2025

Problem

When loading a page with Rust editable code blocks, such as the "Rust Codeblocks" page in the test book, the browser throws a 404 on trying to access /mode-rust.js. It's hitting this because the script tag isn't using the hashed version of the file name.

There's some strange interaction with the ace editor going on here. The script tag that triggers this 404 is inserted dynamically.

This was introduced, I'm guessing, by #1368. A bisection points at commit 74200f7, but I'm guessing that's just because it fixed another issue that may have been masking this one.

Is this why the move-between-pages.goml test had to keep fail-on-request-error disabled in #2552?

cc @notriddle @GuillaumeGomez @ehuss

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version


@traviscross traviscross added the C-bug Category: A bug, incorrect or unintended behavior label May 11, 2025
@GuillaumeGomez
Copy link
Member

Yes and it's why I opened #2617.

ehuss added a commit to ehuss/mdBook that referenced this issue May 23, 2025
The reason the ACE editor was failing to load the rust syntax
highlighting is because the syntax highlighting was being created
*after* the editor was created. If the editor is created first, then ACE
tries to load `ace/mode/rust`. Since it isn't already defined, it tried
to compute the URL and load it manually. However, since the URLs now
have a hash in it (via rust-lang#1368),
it was unable to load.

The solution here is to make sure `ace/mode/rust` is defined before
creating the editors. Then ACE knows that it can just load the module
directly instead of trying to fetch it from the server.

Fixes rust-lang#2700
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: A bug, incorrect or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants