@@ -597,8 +597,7 @@ impl<'a> CustomPropertiesBuilder<'a> {
597
597
match result {
598
598
Ok ( new_value) => new_value,
599
599
Err ( ..) => {
600
- // Don't touch the map, this has the same effect as
601
- // making it compute to the inherited one.
600
+ map. remove ( name) ;
602
601
return ;
603
602
} ,
604
603
}
@@ -672,8 +671,7 @@ impl<'a> CustomPropertiesBuilder<'a> {
672
671
None => return self . inherited . cloned ( ) ,
673
672
} ;
674
673
if self . may_have_cycles {
675
- let inherited = self . inherited . as_ref ( ) . map ( |m| & * * * m) ;
676
- substitute_all ( & mut map, inherited, self . device ) ;
674
+ substitute_all ( & mut map, self . device ) ;
677
675
}
678
676
map. shrink_to_fit ( ) ;
679
677
Some ( Arc :: new ( map) )
@@ -686,7 +684,6 @@ impl<'a> CustomPropertiesBuilder<'a> {
686
684
/// It does cycle dependencies removal at the same time as substitution.
687
685
fn substitute_all (
688
686
custom_properties_map : & mut CustomPropertiesMap ,
689
- inherited : Option < & CustomPropertiesMap > ,
690
687
device : & Device ,
691
688
) {
692
689
// The cycle dependencies removal in this function is a variant
@@ -724,10 +721,7 @@ fn substitute_all(
724
721
/// all unfinished strong connected components.
725
722
stack : SmallVec < [ usize ; 5 ] > ,
726
723
map : & ' a mut CustomPropertiesMap ,
727
- /// The inherited variables. We may need to restore some if we fail
728
- /// substitution.
729
- inherited : Option < & ' a CustomPropertiesMap > ,
730
- /// to resolve the environment to substitute `env()` variables.
724
+ /// To resolve the environment to substitute `env()` variables.
731
725
device : & ' a Device ,
732
726
}
733
727
@@ -869,16 +863,8 @@ fn substitute_all(
869
863
context. map . insert ( name, computed_value) ;
870
864
} ,
871
865
Err ( ..) => {
872
- // This is invalid, reset it to the unset (inherited) value.
873
- let inherited = context. inherited . and_then ( |m| m. get ( & name) ) . cloned ( ) ;
874
- match inherited {
875
- Some ( computed_value) => {
876
- context. map . insert ( name, computed_value) ;
877
- } ,
878
- None => {
879
- context. map . remove ( & name) ;
880
- } ,
881
- } ;
866
+ // This is invalid, reset it to the guaranteed-invalid value.
867
+ context. map . remove ( & name) ;
882
868
} ,
883
869
}
884
870
@@ -896,7 +882,6 @@ fn substitute_all(
896
882
stack : SmallVec :: new ( ) ,
897
883
var_info : SmallVec :: new ( ) ,
898
884
map : custom_properties_map,
899
- inherited,
900
885
device,
901
886
} ;
902
887
traverse ( name, & mut context) ;
0 commit comments