rust/tests/ui/closures/issue-82438-mut-without-upvar.rs

29 lines
439 B
Rust
Raw Normal View History

use std::error::Error;
struct A {
}
impl A {
pub fn new() -> A {
A {
}
}
pub fn f<'a>(
&'a self,
team_name: &'a str,
c: &'a mut dyn FnMut(String, String, u64, u64)
) -> Result<(), Box<dyn Error>> {
Ok(())
}
}
fn main() {
let A = A::new();
let participant_name = "A";
let c = |a, b, c, d| {};
A.f(participant_name, &mut c); //~ ERROR cannot borrow
}