-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// compile-pass | ||
|
||
// `std::ops::Index` has an `: ?Sized` bound on the `Idx` type param. This is | ||
// an accidental left-over from the times when it `Index` was by-reference. | ||
// Tightening the bound now could be a breaking change. Although no crater | ||
// regression were observed (https://github.com/rust-lang/rust/pull/59527), | ||
// let's be conservative and just add a test for this. | ||
#![feature(unsized_locals)] | ||
|
||
use std::ops; | ||
|
||
pub struct A; | ||
|
||
impl ops::Index<str> for A { | ||
type Output = (); | ||
fn index(&self, _: str) -> &Self::Output { panic!() } | ||
} | ||
|
||
impl ops::IndexMut<str> for A { | ||
fn index_mut(&mut self, _: str) -> &mut Self::Output { panic!() } | ||
} | ||
|
||
fn main() {} |