From 94a0819fe3a0d679c3042a77bfe6a2afc505daea Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:28 +0200 Subject: Adding upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/const_prop/issue-102553.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/ui/const_prop/issue-102553.rs (limited to 'src/test/ui/const_prop/issue-102553.rs') diff --git a/src/test/ui/const_prop/issue-102553.rs b/src/test/ui/const_prop/issue-102553.rs new file mode 100644 index 000000000..523a9d7ac --- /dev/null +++ b/src/test/ui/const_prop/issue-102553.rs @@ -0,0 +1,24 @@ +// compile-flags: --crate-type=lib +// check-pass + +pub trait Widget { + fn boxed<'w>(self) -> Box + 'w> + where + Self: Sized + 'w; +} + +pub trait WidgetDyn {} + +impl WidgetDyn for T where T: Widget {} + +impl Widget for dyn WidgetDyn + '_ { + fn boxed<'w>(self) -> Box + 'w> + where + Self: Sized + 'w, + { + // Even though this is illegal to const evaluate, this should never + // trigger an ICE because it can never be called from actual code + // (due to the trivially false where-clause predicate). + Box::new(self) + } +} -- cgit v1.2.3