From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/unboxed-closures/type-id-higher-rank.rs | 72 ---------------------- 1 file changed, 72 deletions(-) delete mode 100644 src/test/ui/unboxed-closures/type-id-higher-rank.rs (limited to 'src/test/ui/unboxed-closures/type-id-higher-rank.rs') diff --git a/src/test/ui/unboxed-closures/type-id-higher-rank.rs b/src/test/ui/unboxed-closures/type-id-higher-rank.rs deleted file mode 100644 index 1f8aec205..000000000 --- a/src/test/ui/unboxed-closures/type-id-higher-rank.rs +++ /dev/null @@ -1,72 +0,0 @@ -// run-pass -// Test that type IDs correctly account for higher-rank lifetimes -// Also acts as a regression test for an ICE (issue #19791) - -use std::any::{Any, TypeId}; - -struct Struct<'a>(#[allow(unused_tuple_struct_fields)] &'a ()); -trait Trait<'a> {} - -fn main() { - // Bare fns - { - let a = TypeId::of::(); - let b = TypeId::of:: fn(&'static isize, &'a isize)>(); - let c = TypeId::of:: fn(&'a isize, &'b isize)>(); - let d = TypeId::of:: fn(&'b isize, &'a isize)>(); - assert!(a != b); - assert!(a != c); - assert!(a != d); - assert!(b != c); - assert!(b != d); - assert_eq!(c, d); - - // Make sure De Bruijn indices are handled correctly - let e = TypeId::of:: fn(fn(&'a isize) -> &'a isize)>(); - let f = TypeId::of:: fn(&'a isize) -> &'a isize)>(); - assert!(e != f); - - // Make sure lifetime parameters of items are not ignored. - let g = TypeId::of:: fn(&'a dyn Trait<'a>) -> Struct<'a>>(); - let h = TypeId::of:: fn(&'a dyn Trait<'a>) -> Struct<'static>>(); - let i = TypeId::of:: fn(&'a dyn Trait<'b>) -> Struct<'b>>(); - assert!(g != h); - assert!(g != i); - assert!(h != i); - - // Make sure lifetime anonymization handles nesting correctly - let j = TypeId::of:: fn(&'a isize) -> &'a usize)>(); - let k = TypeId::of:: fn(&'b isize) -> &'b usize)>(); - assert_eq!(j, k); - } - // Boxed unboxed closures - { - let a = TypeId::of::>(); - let b = TypeId::of:: Fn(&'static isize, &'a isize)>>(); - let c = TypeId::of:: Fn(&'a isize, &'b isize)>>(); - let d = TypeId::of:: Fn(&'b isize, &'a isize)>>(); - assert!(a != b); - assert!(a != c); - assert!(a != d); - assert!(b != c); - assert!(b != d); - assert_eq!(c, d); - - // Make sure De Bruijn indices are handled correctly - let e = TypeId::of:: Fn(Box &'a isize>)>>(); - let f = TypeId::of:: Fn(&'a isize) -> &'a isize>)>>(); - assert!(e != f); - } - // Raw unboxed closures - // Note that every unboxed closure has its own anonymous type, - // so no two IDs should equal each other, even when compatible - { - let a = id(|_: &isize, _: &isize| {}); - let b = id(|_: &isize, _: &isize| {}); - assert!(a != b); - } - - fn id(_: T) -> TypeId { - TypeId::of::() - } -} -- cgit v1.2.3