@@ -282,9 +282,9 @@ impl LowerWithEnv for (&AdtDefn, chalk_ir::AdtId<ChalkIr>) {
282
282
let ( adt_defn, adt_id) = self ;
283
283
284
284
if adt_defn. flags . fundamental && adt_defn. all_parameters ( ) . len ( ) < 1 {
285
- Err ( RustIrError :: InvalidFundamentalTypesParameters (
285
+ return Err ( RustIrError :: InvalidFundamentalTypesParameters (
286
286
adt_defn. name . clone ( ) ,
287
- ) ) ? ;
287
+ ) ) ;
288
288
}
289
289
290
290
let binders = env. in_binders ( adt_defn. all_parameters ( ) , |env| {
@@ -448,7 +448,7 @@ impl LowerWithEnv for TraitBound {
448
448
449
449
let k = env. trait_kind ( trait_id) ;
450
450
if k. sort != TypeSort :: Trait {
451
- Err ( RustIrError :: NotTrait ( self . trait_name . clone ( ) ) ) ? ;
451
+ return Err ( RustIrError :: NotTrait ( self . trait_name . clone ( ) ) ) ;
452
452
}
453
453
454
454
let parameters = self
@@ -458,20 +458,20 @@ impl LowerWithEnv for TraitBound {
458
458
. collect :: < LowerResult < Vec < _ > > > ( ) ?;
459
459
460
460
if parameters. len ( ) != k. binders . len ( interner) {
461
- Err ( RustIrError :: IncorrectNumberOfTypeParameters {
461
+ return Err ( RustIrError :: IncorrectNumberOfTypeParameters {
462
462
identifier : self . trait_name . clone ( ) ,
463
463
expected : k. binders . len ( interner) ,
464
464
actual : parameters. len ( ) ,
465
- } ) ? ;
465
+ } ) ;
466
466
}
467
467
468
468
for ( binder, param) in k. binders . binders . iter ( interner) . zip ( parameters. iter ( ) ) {
469
469
if binder. kind ( ) != param. kind ( ) {
470
- Err ( RustIrError :: IncorrectTraitParameterKind {
470
+ return Err ( RustIrError :: IncorrectTraitParameterKind {
471
471
identifier : self . trait_name . clone ( ) ,
472
472
expected : binder. kind ( ) ,
473
473
actual : param. kind ( ) ,
474
- } ) ? ;
474
+ } ) ;
475
475
}
476
476
}
477
477
@@ -495,20 +495,20 @@ impl LowerWithEnv for AliasEqBound {
495
495
. collect :: < LowerResult < _ > > ( ) ?;
496
496
497
497
if args. len ( ) != lookup. addl_variable_kinds . len ( ) {
498
- Err ( RustIrError :: IncorrectNumberOfAssociatedTypeParameters {
498
+ return Err ( RustIrError :: IncorrectNumberOfAssociatedTypeParameters {
499
499
identifier : self . name . clone ( ) ,
500
500
expected : lookup. addl_variable_kinds . len ( ) ,
501
501
actual : args. len ( ) ,
502
- } ) ? ;
502
+ } ) ;
503
503
}
504
504
505
505
for ( param, arg) in lookup. addl_variable_kinds . iter ( ) . zip ( args. iter ( ) ) {
506
506
if param. kind ( ) != arg. kind ( ) {
507
- Err ( RustIrError :: IncorrectAssociatedTypeParameterKind {
507
+ return Err ( RustIrError :: IncorrectAssociatedTypeParameterKind {
508
508
identifier : self . name . clone ( ) ,
509
509
expected : param. kind ( ) ,
510
510
actual : arg. kind ( ) ,
511
- } ) ? ;
511
+ } ) ;
512
512
}
513
513
}
514
514
@@ -631,20 +631,20 @@ impl LowerWithEnv for ProjectionTy {
631
631
. collect :: < LowerResult < _ > > ( ) ?;
632
632
633
633
if args. len ( ) != lookup. addl_variable_kinds . len ( ) {
634
- Err ( RustIrError :: IncorrectNumberOfAssociatedTypeParameters {
634
+ return Err ( RustIrError :: IncorrectNumberOfAssociatedTypeParameters {
635
635
identifier : self . name . clone ( ) ,
636
636
expected : lookup. addl_variable_kinds . len ( ) ,
637
637
actual : args. len ( ) ,
638
- } ) ? ;
638
+ } ) ;
639
639
}
640
640
641
641
for ( param, arg) in lookup. addl_variable_kinds . iter ( ) . zip ( args. iter ( ) ) {
642
642
if param. kind ( ) != arg. kind ( ) {
643
- Err ( RustIrError :: IncorrectAssociatedTypeParameterKind {
643
+ return Err ( RustIrError :: IncorrectAssociatedTypeParameterKind {
644
644
identifier : self . name . clone ( ) ,
645
645
expected : param. kind ( ) ,
646
646
actual : arg. kind ( ) ,
647
- } ) ? ;
647
+ } ) ;
648
648
}
649
649
}
650
650
@@ -707,16 +707,16 @@ impl LowerWithEnv for Ty {
707
707
macro_rules! tykind {
708
708
( $k: expr, $tykind: ident, $id: expr) => { {
709
709
if $k. binders. len( interner) != args. len( ) {
710
- Err ( RustIrError :: IncorrectNumberOfTypeParameters {
710
+ return Err ( RustIrError :: IncorrectNumberOfTypeParameters {
711
711
identifier: name. clone( ) ,
712
712
expected: $k. binders. len( interner) ,
713
713
actual: args. len( ) ,
714
- } ) ? ;
714
+ } ) ;
715
715
}
716
716
717
717
let substitution = chalk_ir:: Substitution :: from_fallible(
718
718
interner,
719
- args. iter( ) . map( |t| Ok ( t. lower( env) ? ) ) ,
719
+ args. iter( ) . map( |t| t. lower( env) ) ,
720
720
) ?;
721
721
722
722
for ( param, arg) in $k
@@ -726,11 +726,11 @@ impl LowerWithEnv for Ty {
726
726
. zip( substitution. iter( interner) )
727
727
{
728
728
if param. kind( ) != arg. kind( ) {
729
- Err ( RustIrError :: IncorrectParameterKind {
729
+ return Err ( RustIrError :: IncorrectParameterKind {
730
730
identifier: name. clone( ) ,
731
731
expected: param. kind( ) ,
732
732
actual: arg. kind( ) ,
733
- } ) ? ;
733
+ } ) ;
734
734
}
735
735
}
736
736
chalk_ir:: TyKind :: $tykind( $id, substitution) . intern( interner)
@@ -896,9 +896,9 @@ impl LowerWithEnv for (&Impl, ImplId<ChalkIr>, &AssociatedTyValueIds) {
896
896
debug ! ( ?trait_ref) ;
897
897
898
898
if !polarity. is_positive ( ) && !impl_. assoc_ty_values . is_empty ( ) {
899
- Err ( RustIrError :: NegativeImplAssociatedValues (
899
+ return Err ( RustIrError :: NegativeImplAssociatedValues (
900
900
impl_. trait_ref . trait_name . clone ( ) ,
901
- ) ) ? ;
901
+ ) ) ;
902
902
}
903
903
904
904
let where_clauses = impl_. where_clauses . lower ( env) ?;
@@ -980,10 +980,10 @@ impl LowerWithEnv for (&TraitDefn, chalk_ir::TraitId<ChalkIr>) {
980
980
let binders = env. in_binders ( all_parameters, |env| {
981
981
if trait_defn. flags . auto {
982
982
if all_parameters_len > 1 {
983
- Err ( RustIrError :: AutoTraitParameters ( trait_defn. name . clone ( ) ) ) ? ;
983
+ return Err ( RustIrError :: AutoTraitParameters ( trait_defn. name . clone ( ) ) ) ;
984
984
}
985
985
if !trait_defn. where_clauses . is_empty ( ) {
986
- Err ( RustIrError :: AutoTraitWhereClauses ( trait_defn. name . clone ( ) ) ) ? ;
986
+ return Err ( RustIrError :: AutoTraitWhereClauses ( trait_defn. name . clone ( ) ) ) ;
987
987
}
988
988
}
989
989
0 commit comments