@@ -44,10 +44,7 @@ use rustc_infer::infer::InferOk;
44
44
use rustc_infer:: traits:: query:: NoSolution ;
45
45
use rustc_infer:: traits:: ObligationCause ;
46
46
use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment , AllowTwoPhase } ;
47
- use rustc_middle:: ty:: error:: {
48
- ExpectedFound ,
49
- TypeError :: { FieldMisMatch , Sorts } ,
50
- } ;
47
+ use rustc_middle:: ty:: error:: { ExpectedFound , TypeError :: Sorts } ;
51
48
use rustc_middle:: ty:: GenericArgsRef ;
52
49
use rustc_middle:: ty:: { self , AdtKind , Ty , TypeVisitableExt } ;
53
50
use rustc_session:: errors:: ExprParenthesesNeeded ;
@@ -1819,24 +1816,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1819
1816
let target_ty = self . field_ty ( base_expr. span , f, args) ;
1820
1817
let cause = self . misc ( base_expr. span ) ;
1821
1818
match self . at ( & cause, self . param_env ) . sup (
1822
- DefineOpaqueTypes :: No ,
1819
+ // We're already using inference variables for any params, and don't allow converting
1820
+ // between different structs, so there is no way this ever actually defines an opaque type.
1821
+ // Thus choosing `Yes` is fine.
1822
+ DefineOpaqueTypes :: Yes ,
1823
1823
target_ty,
1824
1824
fru_ty,
1825
1825
) {
1826
1826
Ok ( InferOk { obligations, value : ( ) } ) => {
1827
1827
self . register_predicates ( obligations)
1828
1828
}
1829
1829
Err ( _) => {
1830
- // This should never happen, since we're just subtyping the
1831
- // remaining_fields, but it's fine to emit this, I guess.
1832
- self . err_ctxt ( )
1833
- . report_mismatched_types (
1834
- & cause,
1835
- target_ty,
1836
- fru_ty,
1837
- FieldMisMatch ( variant. name , ident. name ) ,
1838
- )
1839
- . emit ( ) ;
1830
+ span_bug ! (
1831
+ cause. span( ) ,
1832
+ "subtyping remaining fields of type changing FRU failed: {target_ty} != {fru_ty}: {}::{}" ,
1833
+ variant. name,
1834
+ ident. name,
1835
+ ) ;
1840
1836
}
1841
1837
}
1842
1838
}
0 commit comments