trait objects with late-bound regions and existential bounds are resolved badly
17163c9
Opened by Ariel Ben-Yehuda at
STR
fn assert_sync<T: Sync>(_t: T) {}
fn main() {
let f: &(for<'a> Sync + Fn(&'a u32)->&'a u32) = &|x| x;
assert_sync(f);
}
Expected Result
Code should compile and run
Actual result
<anon>:4:33: 4:35 error: use of undeclared lifetime name `'a` [E0261]
<anon>:4 let f: &(for<'a> Sync + Fn(&'a u32)->&'a u32) = &|x| x;
^~
<anon>:4:33: 4:35 help: see the detailed explanation for E0261
<anon>:4:43: 4:45 error: use of undeclared lifetime name `'a` [E0261]
<anon>:4 let f: &(for<'a> Sync + Fn(&'a u32)->&'a u32) = &|x| x;
^~
<anon>:4:43: 4:45 help: see the detailed explanation for E0261
error: aborting due to 2 previous errors
Traige: still reproduces. Updated code that's had
dynadded andrustfmt'd:fn assert_sync<T: Sync>(_t: T) {} fn main() { let f: &(dyn for<'a> Sync + Fn(&'a u32) -> &'a u32) = &|x| x; assert_sync(f); }Steve Klabnik at 2019-12-25 16:35:36