-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a04c789
commit 749295c
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// check-pass | ||
|
||
#![crate_type = "lib"] | ||
|
||
// In an older version, when NLL was still a feature, the following previously did not compile | ||
// #![feature(nll)] | ||
|
||
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 | ||
} | ||
} |