From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/traits/suggest-where-clause.rs | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/ui/traits/suggest-where-clause.rs (limited to 'tests/ui/traits/suggest-where-clause.rs') diff --git a/tests/ui/traits/suggest-where-clause.rs b/tests/ui/traits/suggest-where-clause.rs new file mode 100644 index 000000000..46d047a2d --- /dev/null +++ b/tests/ui/traits/suggest-where-clause.rs @@ -0,0 +1,36 @@ +use std::mem; + +struct Misc(T); + +fn check() { + // suggest a where-clause, if needed + mem::size_of::(); + //~^ ERROR the size for values of type + + mem::size_of::>(); + //~^ ERROR the size for values of type + + // ... even if T occurs as a type parameter + + >::from; + //~^ ERROR `u64: From` is not satisfied + + ::Item>>::from; + //~^ ERROR `u64: From<::Item>` is not satisfied + + // ... but not if there are inference variables + + as From>::from; + //~^ ERROR `Misc<_>: From` is not satisfied + + // ... and also not if the error is not related to the type + + mem::size_of::<[T]>(); + //~^ ERROR the size for values of type + + mem::size_of::<[&U]>(); + //~^ ERROR the size for values of type +} + +fn main() { +} -- cgit v1.2.3