rust/tests/ui/suggestions/semi-suggestion-when-stmt-and-expr-span-equal.rs
Esteban Küber 1b449e123d Do not emit empty suggestion
The `println!();` statement's span doesn't include the `;`, and the modified suggestions where trying to get the `;` by getting the differenece between the statement's and the expression's spans, which was an empty suggestion.

Fix #133833, fix #133834.
2024-12-04 17:40:39 +00:00

27 lines
747 B
Rust

//! Regression test for suggestions that were fired on empty spans
//! involving macro-call statements. For some reason the semicolon
//! is not included in the overall span of the macro-call statement.
//!
//! Issue 1: <https://github.com/rust-lang/rust/issues/133833>.
//! Issue 2: <https://github.com/rust-lang/rust/issues/133834>.
//! See also: <https://github.com/rust-lang/rust/issues/133845>.
fn foo() -> String {
let mut list = {
println!();
};
list //~ ERROR mismatched types
}
fn bar() {
String::new()
.chars()
.filter(|x| !x.is_whitespace())
.map(|x| {
println!("Child spawned with the size: {}", x);
})
.collect::<String>(); //~ ERROR E0277
}
fn main() {}