From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/suggestions/issue-84973-negative.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/ui/suggestions/issue-84973-negative.rs (limited to 'tests/ui/suggestions/issue-84973-negative.rs') diff --git a/tests/ui/suggestions/issue-84973-negative.rs b/tests/ui/suggestions/issue-84973-negative.rs new file mode 100644 index 000000000..f339251e5 --- /dev/null +++ b/tests/ui/suggestions/issue-84973-negative.rs @@ -0,0 +1,12 @@ +// Checks that we only suggest borrowing if &T actually implements the trait. + +trait Tr {} +impl Tr for &f32 {} +fn bar(t: T) {} + +fn main() { + let a = 0i32; + let b = 0.0f32; + bar(a); //~ ERROR: the trait bound `i32: Tr` is not satisfied [E0277] + bar(b); //~ ERROR: the trait bound `f32: Tr` is not satisfied [E0277] +} -- cgit v1.2.3