diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/suggestions/issue-106443-sugg-clone-for-bound.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.rs b/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.rs new file mode 100644 index 000000000..3b2e316b2 --- /dev/null +++ b/tests/ui/suggestions/issue-106443-sugg-clone-for-bound.rs @@ -0,0 +1,20 @@ +#[derive(Clone)] +struct S; + +trait X {} + +impl X for S {} + +fn foo<T: X>(_: T) {} +fn bar<T: X>(s: &T) { + foo(s); //~ ERROR the trait bound `&T: X` is not satisfied +} + +fn bar_with_clone<T: X + Clone>(s: &T) { + foo(s); //~ ERROR the trait bound `&T: X` is not satisfied +} + +fn main() { + let s = &S; + bar(s); +} |