mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Add regression test for inference failures
This commit is contained in:
@@ -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() {}
|
||||
Reference in New Issue
Block a user