Closed
Description
#![warn(rust_2021_incompatible_closure_captures)]
fn main() {
let a = ("hey".to_string(), "123".to_string());
let _ = || dbg!(a.0);
}
produces:
help: add a dummy let to cause `a` to be fully captured
|
29~ { let _ = &a; match $val {
29+ tmp => {
29+ $crate::eprintln!("[{}:{}] {} = {:#?}",
30+ $crate::file!(), $crate::line!(), $crate::stringify!($val), &tmp);
30+ tmp
30+ }
...
It expanded the dbg!()
macro. This only happens when the macro invocation is the entire body of the closure.