2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2014-11-15 19:10:22 -05:00
|
|
|
// Test that `&PrinterSupport`, which is really short for `&'a
|
|
|
|
// PrinterSupport<'b>`, gets properly expanded when it appears in a
|
|
|
|
// closure type. This used to result in messed up De Bruijn indices.
|
|
|
|
|
2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2014-11-15 19:10:22 -05:00
|
|
|
trait PrinterSupport<'ast> {
|
2015-03-25 17:06:52 -07:00
|
|
|
fn ast_map(&self) -> Option<&'ast usize> { None }
|
2014-11-15 19:10:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
struct NoAnn<'ast> {
|
2015-03-25 17:06:52 -07:00
|
|
|
f: Option<&'ast usize>
|
2014-11-15 19:10:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<'ast> PrinterSupport<'ast> for NoAnn<'ast> {
|
|
|
|
}
|
|
|
|
|
2019-05-28 14:47:21 -04:00
|
|
|
fn foo<'ast, G>(f: Option<&'ast usize>, g: G) where G: FnOnce(&dyn PrinterSupport) {
|
2014-11-15 19:10:22 -05:00
|
|
|
let annotation = NoAnn { f: f };
|
|
|
|
g(&annotation)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|