rust/tests/ui/for-loop-while/for-c-in-str.rs
2025-12-02 11:24:03 +09:00

15 lines
638 B
Rust

//! Tests that the E0277 error span, generated by the `for` loop desugaring,
//! points exclusively to the loop header expression and not the full loop block.
fn main() {
for c in "asdf" {
//~^ ERROR `&str` is not an iterator
//~| NOTE `&str` is not an iterator
//~| HELP the trait `Iterator` is not implemented for `&str`
//~| NOTE required for `&str` to implement `IntoIterator`
//~| NOTE in this expansion of desugaring of `for` loop
//~| NOTE in this expansion of desugaring of `for` loop
//~| NOTE in this expansion of desugaring of `for` loop
println!();
}
}