-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)
Description
The orphan check rules currently prevent implementations of Index
with the key type generic over BorrowFrom
.
src/ordered_map.rs:64:1: 70:2 error: type parameter `T` must also appear as a type parameter of some type defined within this crate
src/ordered_map.rs:64 impl<K, V, Sized? T> Index<T> for OrderedMap<K, V> where T: Eq + PhfHash + BorrowFrom<K> {
src/ordered_map.rs:65 type Output = V;
src/ordered_map.rs:66
src/ordered_map.rs:67 fn index(&self, k: &T) -> &V {
src/ordered_map.rs:68 self.get(k).expect("invalid key")
src/ordered_map.rs:69 }
...
src/ordered_map.rs:64:1: 70:2 note: for a limited time, you can add `#![feature(old_orphan_check)]` to your crate to disable this rule
src/ordered_map.rs:64 impl<K, V, Sized? T> Index<T> for OrderedMap<K, V> where T: Eq + PhfHash + BorrowFrom<K> {
src/ordered_map.rs:65 type Output = V;
src/ordered_map.rs:66
src/ordered_map.rs:67 fn index(&self, k: &T) -> &V {
src/ordered_map.rs:68 self.get(k).expect("invalid key")
src/ordered_map.rs:69 }
...
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)