File tree 2 files changed +25
-6
lines changed
compiler/rustc_const_eval/src/util
tests/ui/type-alias-impl-trait
2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -57,12 +57,15 @@ pub fn is_subtype<'tcx>(
57
57
// we would get unification errors because we're unable to look into opaque types,
58
58
// even if they're constrained in our current function.
59
59
for ( key, ty) in infcx. take_opaque_types ( ) {
60
- span_bug ! (
61
- ty. hidden_type. span,
62
- "{}, {}" ,
63
- tcx. type_of( key. def_id) . instantiate( tcx, key. args) ,
64
- ty. hidden_type. ty
65
- ) ;
60
+ let hidden_ty = tcx. type_of ( key. def_id ) . instantiate ( tcx, key. args ) ;
61
+ if hidden_ty != ty. hidden_type . ty {
62
+ span_bug ! (
63
+ ty. hidden_type. span,
64
+ "{}, {}" ,
65
+ tcx. type_of( key. def_id) . instantiate( tcx, key. args) ,
66
+ ty. hidden_type. ty
67
+ ) ;
68
+ }
66
69
}
67
70
errors. is_empty ( )
68
71
}
Original file line number Diff line number Diff line change
1
+ //! ICE: https://github.com/rust-lang/rust/issues/114121
2
+ //! This test checks that MIR validation never constrains
3
+ //! new hidden types that *differ* from the actual hidden types.
4
+ //! This test used to ICE because oli-obk assumed mir validation
5
+ //! was only ever run after opaque types were revealed in MIR.
6
+
7
+ // compile-flags: -Zvalidate-mir
8
+ // check-pass
9
+
10
+ fn main ( ) {
11
+ let _ = Some ( ( ) ) . into_iter ( ) . flat_map ( |_| Some ( ( ) ) . into_iter ( ) . flat_map ( func) ) ;
12
+ }
13
+
14
+ fn func ( _: ( ) ) -> impl Iterator < Item = ( ) > {
15
+ Some ( ( ) ) . into_iter ( ) . flat_map ( |_| vec ! [ ] )
16
+ }
You can’t perform that action at this time.
0 commit comments