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