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

Panicking on for_each_mut_string #141

Closed
Polish-Civil opened this issue Oct 1, 2022 · 4 comments
Closed

Panicking on for_each_mut_string #141

Polish-Civil opened this issue Oct 1, 2022 · 4 comments
Labels
bug Something isn't working question Further information is requested

Comments

@Polish-Civil
Copy link

Hello, i've had an issue recently panicking on slice out of bounds, i think this line is the issue as it doesn't check this string value inside match statement before it's mutation.

I do not have the logs as i just lost them ;/

Value::String(s) => mutate(s),

@chipsenkbeil
Copy link
Owner

Hm, that call eventually triggers this:

s.replace_range(pos..old.len(), new);

I'm not available to test it yet, but I think I meant to write s.replace_range(pos..pos + old.len(), new);.

@Polish-Civil
Copy link
Author

oh yeah pos + old.len() should do it too :)

unable to swap prefix old: [file:] new: [distant:] string: [Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");]

Not sure what that gibberish is though, got it while running rust-analyzer

@chipsenkbeil
Copy link
Owner

Resolved by #146

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants