File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1+ // Regression test for #105009. the issue here was that even after the `RevealAll` pass,
2+ // `validate` still used `Reveal::UserFacing`. This meant that it now ends up comparing
3+ // opaque types with their revealed version, resulting in an ICE.
4+ //
5+ // We're using these flags to run the `RevealAll` pass while making it less likely to
6+ // accidentally removing the assignment from `Foo<fn_ptr>` to `Foo<fn_def>`.
7+
8+ // compile-flags: -Zinline_mir=yes -Zmir-opt-level=0 -Zvalidate-mir
9+ // run-pass
10+
11+ use std:: hint:: black_box;
12+
13+ trait Func {
14+ type Ret : Id ;
15+ }
16+
17+ trait Id {
18+ type Assoc ;
19+ }
20+ impl Id for u32 {
21+ type Assoc = u32 ;
22+ }
23+ impl Id for i32 {
24+ type Assoc = i32 ;
25+ }
26+
27+ impl < F : FnOnce ( ) -> R , R : Id > Func for F {
28+ type Ret = R ;
29+ }
30+
31+ fn bar ( ) -> impl Copy + Id {
32+ 0u32
33+ }
34+
35+ struct Foo < T : Func > {
36+ _func : T ,
37+ value : Option < <<T as Func >:: Ret as Id >:: Assoc > ,
38+ }
39+
40+ fn main ( ) {
41+ let mut fn_def = black_box ( Foo {
42+ _func : bar,
43+ value : None ,
44+ } ) ;
45+ let fn_ptr = black_box ( Foo {
46+ _func : bar as fn ( ) -> _ ,
47+ value : None ,
48+ } ) ;
49+
50+ fn_def. value = fn_ptr. value ;
51+ black_box ( fn_def) ;
52+ }
You can’t perform that action at this time.
0 commit comments