rust/tests/ui/traits/issue-40085.rs
2024-02-09 15:43:08 -03: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];
}