diff options
Diffstat (limited to 'tests/ui/regions/issue-11612.rs')
-rw-r--r-- | tests/ui/regions/issue-11612.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/regions/issue-11612.rs b/tests/ui/regions/issue-11612.rs new file mode 100644 index 000000000..9f7f1cc6f --- /dev/null +++ b/tests/ui/regions/issue-11612.rs @@ -0,0 +1,24 @@ +// check-pass +#![allow(dead_code)] +// #11612 +// We weren't updating the auto adjustments with all the resolved +// type information after type check. + +// pretty-expanded FIXME #23616 + +trait A { fn dummy(&self) { } } + +struct B<'a, T:'a> { + f: &'a T +} + +impl<'a, T> A for B<'a, T> {} + +fn foo(_: &dyn A) {} + +fn bar<G>(b: &B<G>) { + foo(b); // Coercion should work + foo(b as &dyn A); // Explicit cast should work as well +} + +fn main() {} |