@@ -840,7 +840,6 @@ fn place_from_bindings_impl<'db>(
840840 } ) if binding. is_undefined_or ( is_non_exported) => Some ( * reachability_constraint) ,
841841 _ => None ,
842842 } ;
843- let mut all_bindings_definitely_reachable = true ;
844843 let mut deleted_reachability = Truthiness :: AlwaysFalse ;
845844
846845 // Evaluate this lazily because we don't always need it (for example, if there are no visible
@@ -933,8 +932,6 @@ fn place_from_bindings_impl<'db>(
933932 }
934933
935934 let binding_ty = binding_type ( db, binding) ;
936- all_bindings_definitely_reachable =
937- all_bindings_definitely_reachable && static_reachability. is_always_true ( ) ;
938935 Some ( narrowing_constraint. narrow ( db, binding_ty, binding. place ( db) ) )
939936 } ,
940937 ) ;
@@ -947,13 +944,7 @@ fn place_from_bindings_impl<'db>(
947944 } ;
948945
949946 let boundness = match boundness_analysis {
950- BoundnessAnalysis :: AlwaysBound => {
951- if all_bindings_definitely_reachable {
952- Boundness :: Bound
953- } else {
954- Boundness :: PossiblyUnbound
955- }
956- }
947+ BoundnessAnalysis :: AlwaysBound => Boundness :: Bound ,
957948 BoundnessAnalysis :: BasedOnUnboundVisibility => match unbound_visibility ( ) {
958949 Some ( Truthiness :: AlwaysTrue ) => {
959950 unreachable ! (
@@ -1135,6 +1126,10 @@ fn place_from_declarations_impl<'db>(
11351126 if all_declarations_definitely_reachable {
11361127 Boundness :: Bound
11371128 } else {
1129+ // For declarations, it is important to consider the possibility that they might only
1130+ // be bound in one control flow path, while the other path contains a binding. In order
1131+ // to even consider the bindings as well in `place_by_id`, we return `PossiblyUnbound`
1132+ // here.
11381133 Boundness :: PossiblyUnbound
11391134 }
11401135 }
0 commit comments