forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathimpls.rs
More file actions
86 lines (74 loc) · 1.68 KB
/
impls.rs
File metadata and controls
86 lines (74 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/// Contains type-specialized versions of
///
/// ```
/// impl<T, I, const N: usize> Index<I> for [T; N]
/// where
/// [T]: Index<I>,
/// {
/// type Output = <[T] as Index<I>>::Output;
/// ...
/// }
/// ```
///
/// and
///
/// ```
/// impl<T, I> ops::Index<I> for [T]
/// where
/// I: SliceIndex<[T]>,
/// {
/// type Output = I::Output;
/// ...
/// }
/// ```
///
/// and
/// ```
/// impl<T, I: SliceIndex<[T]>, A: Allocator> Index<I> for Vec<T, A> {
/// type Output = I::Output;
/// ...
/// }
/// ```
///
/// which the type inference library cannot currently handle (we fail
/// to resolve the `Output` types).
mod index_impls {
use std::alloc::Allocator;
use std::ops::Index;
impl<T, const N: usize> Index<i32> for [T; N] {
type Output = T;
fn index(&self, index: i32) -> &Self::Output {
panic!()
}
}
impl<T, const N: usize> Index<usize> for [T; N] {
type Output = T;
fn index(&self, index: usize) -> &Self::Output {
panic!()
}
}
impl<T> Index<i32> for [T] {
type Output = T;
fn index(&self, index: i32) -> &Self::Output {
panic!()
}
}
impl<T> Index<usize> for [T] {
type Output = T;
fn index(&self, index: usize) -> &Self::Output {
panic!()
}
}
impl<T, A: Allocator> Index<i32> for Vec<T, A> {
type Output = T;
fn index(&self, index: i32) -> &Self::Output {
panic!()
}
}
impl<T, A: Allocator> Index<usize> for Vec<T, A> {
type Output = T;
fn index(&self, index: usize) -> &Self::Output {
panic!()
}
}
}