about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2020-10-20 12:40:02 -0300
committerSantiago Pastorino <spastorino@gmail.com>2020-10-27 14:45:37 -0300
commitf0a71f7f4d583f7c93899ae913d6494cc42ad2ac (patch)
treeebef00929573fcaa7ee6f3c061c01f6052a02f93
parent70b8c79a96a8d6647976736c64cb8c54cfad34bf (diff)
downloadrust-f0a71f7f4d583f7c93899ae913d6494cc42ad2ac.tar.gz
rust-f0a71f7f4d583f7c93899ae913d6494cc42ad2ac.zip
Better test unsized_fn_params
-rw-r--r--src/test/ui/unsized-locals/unsized-index.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/ui/unsized-locals/unsized-index.rs b/src/test/ui/unsized-locals/unsized-index.rs
index 2c31ade7a38..e8782e89481 100644
--- a/src/test/ui/unsized-locals/unsized-index.rs
+++ b/src/test/ui/unsized-locals/unsized-index.rs
@@ -1,20 +1,16 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// run-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_fn_params)]
 
 use std::ops;
+use std::ops::Index;
 
 pub struct A;
 
 impl ops::Index<str> for A {
     type Output = ();
     fn index(&self, _: str) -> &Self::Output {
-        panic!()
+        &()
     }
 }
 
@@ -24,4 +20,8 @@ impl ops::IndexMut<str> for A {
     }
 }
 
-fn main() {}
+fn main() {
+    let a = A {};
+    let s = String::new().into_boxed_str();
+    assert_eq!(&(), a.index(*s));
+}