This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed
compiler/rustc_const_eval/src/util
tests/ui/type-alias-impl-trait Expand file tree Collapse file tree 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>(
5757 // we would get unification errors because we're unable to look into opaque types,
5858 // even if they're constrained in our current function.
5959 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+ }
6669 }
6770 errors. is_empty ( )
6871}
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