Skip to content

Commit 4a4f3b0

Browse files
committed
Add regression test for inference failures
1 parent ebd5bea commit 4a4f3b0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//@ run-pass
2+
3+
// regression test for #147964:
4+
// constification of these traits resulted in inference errors due to additional where clauses
5+
6+
use std::borrow::{Cow, Borrow};
7+
8+
pub fn generic_deref<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
9+
let _: &T = &cow;
10+
}
11+
12+
pub fn generic_borrow<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
13+
let _: &T = cow.borrow();
14+
}
15+
16+
pub fn generic_as_ref<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
17+
let _: &T = cow.as_ref();
18+
}
19+
20+
fn main() {}

0 commit comments

Comments
 (0)