From 749295cfbfd408cde8a0c07e021387013fb8b65c Mon Sep 17 00:00:00 2001 From: Ross MacArthur Date: Fri, 27 Dec 2019 13:36:41 +0200 Subject: [PATCH] Add regression test for old NLL ICE --- src/test/ui/issues/issue-51770.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/ui/issues/issue-51770.rs diff --git a/src/test/ui/issues/issue-51770.rs b/src/test/ui/issues/issue-51770.rs new file mode 100644 index 0000000000000..bcb37a5f4ff5d --- /dev/null +++ b/src/test/ui/issues/issue-51770.rs @@ -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 { + a: T, +} + +impl Index for Test { + type Output = T; + + fn index(&self, _index: usize) -> &Self::Output { + &self.a + } +}