about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/truncated-fields-when-imm.rs
blob: 7d08cdb91e569a8d196a048056c96e336f446751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//@ 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() {}