Underscores on Rust-By-Example

Hey all - new to Rust. Going through "adventofcode" with it. I was trying to understand a couple examples in "rust-by-example" and some of the variable names looked like they had spaces in them, or there were some extra keywords I didn't yet understand. One example is the Borrowing page: https://doc.rust-lang.org/rust-by-example/scope/borrow.html?highlight=borrow#borrowing

The code example there has a function named "borrow_i32" (I get the underscore very clearly when copying...) but it looks like "borrow i32" in the example window... Some other things from the example that look like they're spaced when they were actually underscored: eat_box_i32, boxed_i32, borrowed_i32, stacked_i32, _ref_to_i32.

So - all the underscores look like spaces. This is confusing. Anybody else getting this behavior? I'm using Chromium in Debian with the dark mode theme.

Thanks.

Everything looks fine in the link you posted from here. Chrome on Win 10.

I'm sure if Debian users of Rust had that problem we would have heard about it a long time ago.

Something is up with your rendering.

To me - if I modify the CSS on the "ace_line" div elements surrounding the lines of code I can display the underscores again. One line in the CSS changes it for me - "contain: strict", which is applied to "ace_hidpi .ace_text-layer > .ace_line, .ace_hidpi .ace_text-layer > .ace_line_group" in "ace/css/ace_editor.css". MDN says "contain: strict" is equivalent to "contain: size layout paint", and that indeed produces the same result for me.

"content: size layout" (just removing the paint) displays the underscores for me without causing any other display issues that I can see.

You should probably open an issue on Rust-By-Example's repo; they'd probably be better at fixing it than here.

2 Likes

Thanks for pointing me over there! Looks like someone figured it out: https://github.com/rust-lang/rust-by-example/issues/1279

2 Likes