summaryrefslogtreecommitdiffstats
path: root/third_party/rust/extend/tests/compile_pass/generics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/extend/tests/compile_pass/generics.rs')
-rw-r--r--third_party/rust/extend/tests/compile_pass/generics.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/third_party/rust/extend/tests/compile_pass/generics.rs b/third_party/rust/extend/tests/compile_pass/generics.rs
new file mode 100644
index 0000000000..4c56b14677
--- /dev/null
+++ b/third_party/rust/extend/tests/compile_pass/generics.rs
@@ -0,0 +1,15 @@
+use extend::ext;
+
+#[ext]
+impl<'a, T: Clone> Vec<&'a T>
+where
+ T: 'a + Copy,
+{
+ fn size(&self) -> usize {
+ self.len()
+ }
+}
+
+fn main() {
+ assert_eq!(3, vec![&1, &2, &3].size());
+}