Skip to content
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

str implement uDebug #52

Open
andrewgazelka opened this issue Nov 30, 2022 · 9 comments
Open

str implement uDebug #52

andrewgazelka opened this issue Nov 30, 2022 · 9 comments

Comments

@andrewgazelka
Copy link

No description provided.

@andrewgazelka
Copy link
Author

@bjorn3
Copy link

bjorn3 commented Dec 4, 2022

I think the panic is somewhere inside c.escape_debug() but I am not quite sure. I did confirm that there is a panic in the codegened code though: https://rust.godbolt.org/z/s74qsE5Yd

@andrewgazelka
Copy link
Author

I wouldn't be surprised if it originates from skip_search (is_grapheme_extended in escape_debug_ext which is used in escape_debug)

@andrewgazelka
Copy link
Author

would it be all too bad to make uDebug for str equivalent to uDisplay but with quotes? is_grapheme_extended seems to add a bit of overhead anyway.

@andrewgazelka andrewgazelka changed the title why does str not implement uDebug str implement uDebug Dec 4, 2022
@reitermarkus
Copy link

reitermarkus commented Feb 29, 2024

I just took a look, the panic comes from EscapeDebug::backslash, which uses EscapeIterInner::from_array, which uses slice::copy_from_slice, which may panic.

Also, EscapeIterInner::new uses debug_assert!, which may panic.

@reitermarkus
Copy link

It seems my deduction was wrong, and it is caused by EscapeDebug::size_hint not being optimized out, as explained in rust-lang/rust#121805 (comment).

I have opened rust-lang/rust#124307, which hopefully fixes this.

@reitermarkus
Copy link

reitermarkus commented Aug 13, 2024

With rust-lang/rust#124307 and rust-lang/rust#124905 merged, this should now not be panicking anymore on nightly.

@reitermarkus
Copy link

From the looks of it, also on 1.80+.

@xangelix
Copy link

With rust-lang/rust#124307 and rust-lang/rust#124905 merged, this should now not be panicking anymore on nightly.

Super exciting! Is there anything else left blocking a uDebug implementation for str?

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

No branches or pull requests

4 participants