-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
split_at_mut
should #[track_caller]
#83378
Comments
@ruza-net are you interested in adding this yourself? It should be pretty simple :) just add it to library/core/src/slice/mod.rs like it says in the panic. |
@rustbot claim I would like to try this. |
I think you need to alter the actual assertion to produce formatted output to truly get what you stated as "expected" though, don't you? Something like this: let len = self.len();
assert!(
mid <= len,
"split index (is {}) should be <= len (is {}))",
mid,
len
); All |
This issue has been solved by |
When
split_at_mut
is called withmid > len
, an internal assertion fails. However, it doesn't track its caller, soRUST_BACKTRACE=1
is required to determine the call site.I tried this code:
I expected to see this happen:
An error of the form
thread 'main' panicked at 'split index (is 2) should be <= len (is 1)'
.Instead, this happened:
thread 'main' panicked at 'assertion failed: mid <= self.len()', /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/slice/mod.rs:1279:9
Meta
This occurs on stable (1.50.0), beta (1.51.0-beta.8) and nightly (1.53.0-nightly 2021-03-21).
Tested on playground.
The text was updated successfully, but these errors were encountered: