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
2
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
3
#![ feature( unsized_fn_params) ]
9
4
10
5
use std:: ops;
6
+ use std:: ops:: Index ;
11
7
12
8
pub struct A ;
13
9
14
10
impl ops:: Index < str > for A {
15
11
type Output = ( ) ;
16
12
fn index ( & self , _: str ) -> & Self :: Output {
17
- panic ! ( )
13
+ & ( )
18
14
}
19
15
}
20
16
@@ -24,4 +20,8 @@ impl ops::IndexMut<str> for A {
24
20
}
25
21
}
26
22
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