@@ -584,8 +584,7 @@ impl<'a> CustomPropertiesBuilder<'a> {
584
584
match result {
585
585
Ok ( new_value) => new_value,
586
586
Err ( ..) => {
587
- // Don't touch the map, this has the same effect as
588
- // making it compute to the inherited one.
587
+ map. remove ( name) ;
589
588
return ;
590
589
} ,
591
590
}
@@ -659,8 +658,7 @@ impl<'a> CustomPropertiesBuilder<'a> {
659
658
None => return self . inherited . cloned ( ) ,
660
659
} ;
661
660
if self . may_have_cycles {
662
- let inherited = self . inherited . as_ref ( ) . map ( |m| & * * * m) ;
663
- substitute_all ( & mut map, inherited, self . device ) ;
661
+ substitute_all ( & mut map, self . device ) ;
664
662
}
665
663
map. shrink_to_fit ( ) ;
666
664
Some ( Arc :: new ( map) )
@@ -673,7 +671,6 @@ impl<'a> CustomPropertiesBuilder<'a> {
673
671
/// It does cycle dependencies removal at the same time as substitution.
674
672
fn substitute_all (
675
673
custom_properties_map : & mut CustomPropertiesMap ,
676
- inherited : Option < & CustomPropertiesMap > ,
677
674
device : & Device ,
678
675
) {
679
676
// The cycle dependencies removal in this function is a variant
@@ -711,10 +708,7 @@ fn substitute_all(
711
708
/// all unfinished strong connected components.
712
709
stack : SmallVec < [ usize ; 5 ] > ,
713
710
map : & ' a mut CustomPropertiesMap ,
714
- /// The inherited variables. We may need to restore some if we fail
715
- /// substitution.
716
- inherited : Option < & ' a CustomPropertiesMap > ,
717
- /// to resolve the environment to substitute `env()` variables.
711
+ /// To resolve the environment to substitute `env()` variables.
718
712
device : & ' a Device ,
719
713
}
720
714
@@ -856,16 +850,8 @@ fn substitute_all(
856
850
context. map . insert ( name, computed_value) ;
857
851
} ,
858
852
Err ( ..) => {
859
- // This is invalid, reset it to the unset (inherited) value.
860
- let inherited = context. inherited . and_then ( |m| m. get ( & name) ) . cloned ( ) ;
861
- match inherited {
862
- Some ( computed_value) => {
863
- context. map . insert ( name, computed_value) ;
864
- } ,
865
- None => {
866
- context. map . remove ( & name) ;
867
- } ,
868
- } ;
853
+ // This is invalid, reset it to the guaranteed-invalid value.
854
+ context. map . remove ( & name) ;
869
855
} ,
870
856
}
871
857
@@ -883,7 +869,6 @@ fn substitute_all(
883
869
stack : SmallVec :: new ( ) ,
884
870
var_info : SmallVec :: new ( ) ,
885
871
map : custom_properties_map,
886
- inherited,
887
872
device,
888
873
} ;
889
874
traverse ( name, & mut context) ;
0 commit comments