diff options
Diffstat (limited to 'tests/ui/traits/multidispatch-conditional-impl-not-considered.rs')
-rw-r--r-- | tests/ui/traits/multidispatch-conditional-impl-not-considered.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/traits/multidispatch-conditional-impl-not-considered.rs b/tests/ui/traits/multidispatch-conditional-impl-not-considered.rs new file mode 100644 index 000000000..f845e198a --- /dev/null +++ b/tests/ui/traits/multidispatch-conditional-impl-not-considered.rs @@ -0,0 +1,24 @@ +// run-pass +// Test that we correctly ignore the blanket impl +// because (in this case) `T` does not impl `Clone`. +// +// Issue #17594. + +use std::cell::RefCell; + +trait Foo { + fn foo(&self) {} +} + +impl<T> Foo for T where T: Clone {} + +struct Bar; + +impl Bar { + fn foo(&self) {} +} + +fn main() { + let b = RefCell::new(Bar); + b.borrow().foo(); +} |