File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
src/test/ui/unsized-locals Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1- // build -pass (FIXME(62277): could be check-pass?)
1+ // run -pass
22
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.
83#![ feature( unsized_fn_params) ]
94
105use std:: ops;
6+ use std:: ops:: Index ;
117
128pub struct A ;
139
1410impl ops:: Index < str > for A {
1511 type Output = ( ) ;
1612 fn index ( & self , _: str ) -> & Self :: Output {
17- panic ! ( )
13+ & ( )
1814 }
1915}
2016
@@ -24,4 +20,8 @@ impl ops::IndexMut<str> for A {
2420 }
2521}
2622
27- fn main ( ) { }
23+ fn main ( ) {
24+ let a = A { } ;
25+ let s = String :: new ( ) . into_boxed_str ( ) ;
26+ assert_eq ! ( & ( ) , a. index( * s) ) ;
27+ }
You can’t perform that action at this time.
0 commit comments