rust/tests/ui/issues/issue-40085.rs
2023-01-11 09:32:08 +00:00

14 lines
216 B
Rust

// 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];
}