From fc5085d5709df1cc6e409d60216c6a1f5380aa48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 22 Mar 2024 16:45:15 +0100 Subject: [PATCH] add test for #90192 Fixes #90192 --- .../ice-poly-with-mir-opts-90192.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/ui/polymorphization/ice-poly-with-mir-opts-90192.rs diff --git a/tests/ui/polymorphization/ice-poly-with-mir-opts-90192.rs b/tests/ui/polymorphization/ice-poly-with-mir-opts-90192.rs new file mode 100644 index 0000000000000..4557c7e517ceb --- /dev/null +++ b/tests/ui/polymorphization/ice-poly-with-mir-opts-90192.rs @@ -0,0 +1,20 @@ +// issue: rust-lang/rust#90192 +// ICE assertion failed: matches!(ty.kind(), ty :: Param(_)) +//@ compile-flags:-Zpolymorphize=on -Zmir-opt-level=3 +//@ build-pass + +fn test() { + std::mem::size_of::(); +} + +pub fn foo(_: T) -> &'static fn() { + &(test:: as fn()) +} + +fn outer() { + foo(|| ()); +} + +fn main() { + outer::(); +}