rust/tests/ui/traits/issue-40085.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
217 B
Rust
Raw Normal View History

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