Smart autocompletion not working when nesting several for loops. See below to reproduce issue.
1.) Create a new fresh project in CLion:
cargo new <project-name>
2.) Create a function which contains several nested for loops:
fn process(string: String) -> HashMap<String, Vec<String>> {
for line in string.lines() {
for sentence in line.split_terminator('.') {
for word in sentence.trim().split_whitespace() {
if word.chars().nth(0).unwrap().is_uppercase() {
todo!()
}
}
}
}
todo!()
}
3.) Realize that type hinting and smart code completion/suggestion works only inside the first for-loop. For the second and third for-loops, they won't work (See images below).



@joslopgar thanks for the report!
Actually, it's not related to nested loops. Reason of completion absence is fail of type inference for line.split_terminator('.') expression. Try to enable new macro expansion engine (see #3628 for details). It should solve your issue.
Thank you for your answer @Undin ! I'm glad this is a known issue, I imagine it's been researched by now.
I tried enabling the new macro expansion engine and it worked!
Should I close the issue then? (This is my time reporting a bug, and I don't know how to proceed).
I tried enabling the new macro expansion engine and it worked!
Glad to hear it!
Should I close the issue then?
No. We will close all issues that are fixed by new macro expansion engine (like this one) after it becomes default option (I hope quite soon)