about summary refs log tree commit diff
path: root/tests/ui/traits/issue-40085.rs
blob: 22679b20d1604c75ef0e1c5f9a28774e9f9c5bcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//@ run-pass
use std::ops::Index;
fn bar() {}
static UNIT: () = ();
struct S;
impl Index<fn()> for S {
    type Output = ();
    fn index(&self, _: fn()) -> &() { &UNIT }
}
fn main() {
    S.index(bar);
    S[bar];
}