summaryrefslogtreecommitdiffstats
path: root/src/test/ui/coercion/coerce-reborrow-imm-ptr-rcvr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/coercion/coerce-reborrow-imm-ptr-rcvr.rs')
-rw-r--r--src/test/ui/coercion/coerce-reborrow-imm-ptr-rcvr.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/coercion/coerce-reborrow-imm-ptr-rcvr.rs b/src/test/ui/coercion/coerce-reborrow-imm-ptr-rcvr.rs
new file mode 100644
index 000000000..64a365229
--- /dev/null
+++ b/src/test/ui/coercion/coerce-reborrow-imm-ptr-rcvr.rs
@@ -0,0 +1,18 @@
+// run-pass
+
+struct SpeechMaker {
+ speeches: usize
+}
+
+impl SpeechMaker {
+ pub fn how_many(&self) -> usize { self.speeches }
+}
+
+fn foo(speaker: &SpeechMaker) -> usize {
+ speaker.how_many() + 33
+}
+
+pub fn main() {
+ let lincoln = SpeechMaker {speeches: 22};
+ assert_eq!(foo(&lincoln), 55);
+}