]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unsized-locals/unsized-index.rs
Rollup merge of #61207 - taiki-e:arbitrary_self_types-lifetime-elision-2, r=Centril
[rust.git] / src / test / ui / unsized-locals / unsized-index.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2
3 // `std::ops::Index` has an `: ?Sized` bound on the `Idx` type param. This is
4 // an accidental left-over from the times when it `Index` was by-reference.
5 // Tightening the bound now could be a breaking change. Although no crater
6 // regression were observed (https://github.com/rust-lang/rust/pull/59527),
7 // let's be conservative and just add a test for this.
8 #![feature(unsized_locals)]
9
10 use std::ops;
11
12 pub struct A;
13
14 impl ops::Index<str> for A {
15     type Output = ();
16     fn index(&self, _: str) -> &Self::Output { panic!() }
17 }
18
19 impl ops::IndexMut<str> for A {
20     fn index_mut(&mut self, _: str) -> &mut Self::Output { panic!() }
21 }
22
23 fn main() {}