]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/traits/cache-issue-18209.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / test / ui / traits / cache-issue-18209.rs
diff --git a/src/test/ui/traits/cache-issue-18209.rs b/src/test/ui/traits/cache-issue-18209.rs
new file mode 100644 (file)
index 0000000..15676e4
--- /dev/null
@@ -0,0 +1,20 @@
+// run-pass
+// Test that the cache results from the default method do not pollute
+// the cache for the later call in `load()`.
+//
+// See issue #18209.
+
+// pretty-expanded FIXME #23616
+
+pub trait Foo {
+    fn load_from() -> Box<Self>;
+    fn load() -> Box<Self> {
+        Foo::load_from()
+    }
+}
+
+pub fn load<M: Foo>() -> Box<M> {
+    Foo::load()
+}
+
+fn main() { }