summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/relate_tys/trait-hrtb.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/nll/relate_tys/trait-hrtb.rs')
-rw-r--r--tests/ui/nll/relate_tys/trait-hrtb.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/nll/relate_tys/trait-hrtb.rs b/tests/ui/nll/relate_tys/trait-hrtb.rs
new file mode 100644
index 000000000..7f40e93cd
--- /dev/null
+++ b/tests/ui/nll/relate_tys/trait-hrtb.rs
@@ -0,0 +1,14 @@
+// Test that NLL generates proper error spans for trait HRTB errors
+//
+// compile-flags:-Zno-leak-check
+
+trait Foo<'a> {}
+
+fn make_foo<'a>() -> Box<dyn Foo<'a>> {
+ panic!()
+}
+
+fn main() {
+ let x: Box<dyn Foo<'static>> = make_foo();
+ let y: Box<dyn for<'a> Foo<'a>> = x; //~ ERROR mismatched types [E0308]
+}