about summary refs log tree commit diff
path: root/tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs')
-rw-r--r--tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs b/tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs
new file mode 100644
index 00000000000..8bd45cd54a4
--- /dev/null
+++ b/tests/ui/traits/inheritance/supertrait-operator-issue-18088.rs
@@ -0,0 +1,13 @@
+//@ check-pass
+
+//! Tests that operators from supertrait are available directly on `self` for an inheritor trait.
+//!
+//! # Context
+//! Original issue: https://github.com/rust-lang/rust/issues/18088
+
+pub trait Indexable<T>: std::ops::Index<usize, Output = T> {
+    fn index2(&self, i: usize) -> &T {
+        &self[i]
+    }
+}
+fn main() {}