2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![allow(unused_imports)]
|
2014-11-05 22:06:04 -05:00
|
|
|
// Test that we don't trigger on the blanket impl for all `&'a T` but
|
|
|
|
// rather keep autoderefing and trigger on the underlying impl. To
|
|
|
|
// know not to stop at the blanket, we have to recursively evaluate
|
|
|
|
// the `T:Foo` bound.
|
|
|
|
|
2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-01-07 11:33:42 +13:00
|
|
|
use std::marker::Sized;
|
2014-11-05 22:06:04 -05:00
|
|
|
|
|
|
|
// Note: this must be generic for the problem to show up
|
2015-01-05 19:13:38 -08:00
|
|
|
trait Foo<A> {
|
2015-02-12 10:29:52 -05:00
|
|
|
fn foo(&self, a: A);
|
2014-11-05 22:06:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Foo<u8> for [u8] {
|
2015-02-12 10:29:52 -05:00
|
|
|
fn foo(&self, a: u8) {}
|
2014-11-05 22:06:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a, A, T> Foo<A> for &'a T where T: Foo<A> {
|
2015-02-12 10:29:52 -05:00
|
|
|
fn foo(&self, a: A) {
|
|
|
|
Foo::foo(*self, a)
|
2014-11-05 22:06:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Bar {
|
|
|
|
fn foo(&self);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct MyType;
|
|
|
|
|
|
|
|
impl Bar for MyType {
|
|
|
|
fn foo(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut m = MyType;
|
|
|
|
(&mut m).foo()
|
|
|
|
}
|