Add regression test for inference failures
(cherry picked from commit 4a4f3b0e8e)
This commit is contained in:
parent
566809897f
commit
21ffe30cd5
1 changed files with 20 additions and 0 deletions
20
tests/ui/traits/generic-cow-inference-regression.rs
Normal file
20
tests/ui/traits/generic-cow-inference-regression.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//@ run-pass
|
||||
|
||||
// regression test for #147964:
|
||||
// constification of these traits resulted in inference errors due to additional where clauses
|
||||
|
||||
use std::borrow::{Cow, Borrow};
|
||||
|
||||
pub fn generic_deref<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
|
||||
let _: &T = &cow;
|
||||
}
|
||||
|
||||
pub fn generic_borrow<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
|
||||
let _: &T = cow.borrow();
|
||||
}
|
||||
|
||||
pub fn generic_as_ref<'a, T: ToOwned<Owned = U>, U>(cow: Cow<'a, T>) {
|
||||
let _: &T = cow.as_ref();
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue