summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/issue-51770.rs
blob: 3d6bc82f115a0fdd58915fc93f5909ed698d57f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// check-pass

#![crate_type = "lib"]

// In an older version, when NLL was still a feature, the following previously did not compile

use std::ops::Index;

pub struct Test<T> {
    a: T,
}

impl<T> Index<usize> for Test<T> {
    type Output = T;

    fn index(&self, _index: usize) -> &Self::Output {
        &self.a
    }
}