rust/tests/ui/async-await/async-closures/truncated-fields-when-imm.rs
2024-12-13 00:04:56 +00:00

15 lines
422 B
Rust

//@ edition: 2021
//@ check-pass
pub struct Struct {
pub path: String,
}
// In `upvar.rs`, `truncate_capture_for_optimization` means that we don't actually
// capture `&(*s.path)` here, but instead just `&(*s)`, but ONLY when the upvar is
// immutable. This means that the assumption we have in `ByMoveBody` pass is wrong.
pub fn test(s: &Struct) {
let c = async move || { let path = &s.path; };
}
fn main() {}