rust/tests/ui/nll/issue-51770.rs

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

20 lines
326 B
Rust
Raw Normal View History

2019-12-27 11:36:41 +00:00
// 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
}
}