-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Clippy slice panic on --fix #8878
Comments
I can't compile your code :/
|
@hellow554 I believe he was using RUSTFLAGS="--cfg skyline_std_v3" (long story short it has to do with trying to do some forwards compatible upgrading of things, the code those errors are from unfortunately needs to work on some weird out-of-tree toolchains) |
And I guess I should clarify, I walked him through a lot of issue reduction and the issue occurs on the standard toolchain, not just the fork. There was also suspicion of build-std being involved but that too was ruled out. The reduction boiled down to these requirements:
Anything else didn't effect whether or not the panic occured. Some things specifically tested and ruled out as having no effect on the panic:
|
Here's a MCVE: use std::collections::HashMap;
pub fn crash() -> Option<&'static str> {
let function_map: HashMap<String, ()> = HashMap::new();
function_map
.get("")
.map(|_| {
Some("") // three newline are important as well
// whitespace beforehand is important!
})
.flatten()
} make sure that the whitespace is important. I'm providing the base64 input as well for clarity:
I'm trying to get the culprit. |
Btw: the ICE comes from these lines: you want to use |
Seems to be a dup of #8734 :) |
@hellow554 wow awesome! thanks so much ❤️ |
Wow, I never expect such a fast reply, thanks a lot! |
Summary
Getting a panic message
slice index starts at 1 but ends at 0
by running the following command:Which results in this stack backtrace:
Backtrace (Click to Expand)
Reproducer
Code and commit
Simply run the following command:
cargo +nightly-2022-05-21 clippy --fix --no-default-features
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: