]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsized-locals/unsized-index.rs
Auto merge of #106925 - imWildCat:imWildCat/remove-hardcoded-ios-macbi-target-version...
[rust.git] / tests / ui / unsized-locals / unsized-index.rs
1 // run-pass
2
3 #![feature(unsized_fn_params)]
4
5 use std::ops;
6 use std::ops::Index;
7
8 pub struct A;
9
10 impl ops::Index<str> for A {
11     type Output = ();
12     fn index(&self, _: str) -> &Self::Output {
13         &()
14     }
15 }
16
17 impl ops::IndexMut<str> for A {
18     fn index_mut(&mut self, _: str) -> &mut Self::Output {
19         panic!()
20     }
21 }
22
23 fn main() {
24     let a = A {};
25     let s = String::new().into_boxed_str();
26     assert_eq!(&(), a.index(*s));
27 }