summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-18959.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/issues/issue-18959.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-18959.rs b/src/test/ui/issues/issue-18959.rs
new file mode 100644
index 000000000..4b6f04e25
--- /dev/null
+++ b/src/test/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);
+}