mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
20 lines
327 B
Rust
20 lines
327 B
Rust
//@ 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
|
|
}
|
|
}
|