summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-18959.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-18959.rs')
-rw-r--r--tests/ui/issues/issue-18959.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-18959.rs b/tests/ui/issues/issue-18959.rs
new file mode 100644
index 000000000..4b6f04e25
--- /dev/null
+++ b/tests/ui/issues/issue-18959.rs
@@ -0,0 +1,20 @@
+pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
+pub trait Bar: Foo { }
+impl<T: Foo> Bar for T { }
+
+pub struct Thing;
+impl Foo for Thing {
+ fn foo<T>(&self, _: &T) {}
+}
+
+#[inline(never)]
+fn foo(b: &dyn Bar) {
+ //~^ ERROR E0038
+ b.foo(&0)
+}
+
+fn main() {
+ let mut thing = Thing;
+ let test: &dyn Bar = &mut thing;
+ foo(test);
+}