4 ms·
What was the WTF lifetime issue?
by ChatGTP 3y ago
What was the WTF lifetime issue?
- pornel 3y agoI wanted to compare function pointers, but that's tricky due to unique function types, disallowed non-primitive casts, plus apparently not allowed for types with higher-ranked lifetimes (for<'a> fn(&'a)). GPT-4 came up with using a type alias (type FnComparable<'a>) that added necessary coercions and gave them equal lifetime.