summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-27697.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-27697.rs')
-rw-r--r--tests/ui/issues/issue-27697.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-27697.rs b/tests/ui/issues/issue-27697.rs
new file mode 100644
index 000000000..12af8a8e8
--- /dev/null
+++ b/tests/ui/issues/issue-27697.rs
@@ -0,0 +1,21 @@
+// check-pass
+
+use std::ops::Deref;
+
+trait MyTrait {
+ fn do_something(&self);
+ fn as_str(&self) -> &str;
+}
+
+impl Deref for dyn MyTrait {
+ type Target = str;
+ fn deref(&self) -> &Self::Target {
+ self.as_str()
+ }
+}
+
+fn trait_object_does_something(t: &dyn MyTrait) {
+ t.do_something()
+}
+
+fn main() {}