You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #111068 - Urgau:check-cfg-improvements, r=petrochenkov
Improve check-cfg implementation
This PR makes multiple improvements into the implementation of check-cfg, it is a prerequisite to a follow-up PR that will introduce a simpler and more explicit syntax.
The 2 main area of improvements are:
1. Internal representation of expected values:
- now uses `FxHashSet<Option<Symbol>>` instead of `FxHashSet<Symbol>`, it made the no value expected case only possible when no values where in the `HashSet` which is now represented as `None` (same as cfg represent-it).
- a enum with `Some` and `Any` makes it now clear if some values are expected or not, necessary for `feature` and `target_feature`.
2. Diagnostics: Improve the diagnostics in multiple case and fix case where a missing value could have had a new name suggestion instead of the value diagnostic; and some drive by improvements
I highly recommend reviewing commit by commit.
r? `@petrochenkov`
db.span_suggestion(name_span.to(value_span),"there is a config with a similar name and different values",format!("{best_match} = \"{first_value}\""),Applicability::MaybeIncorrect);
792
+
}else{
793
+
db.span_suggestion(name_span.to(value_span),"there is a config with a similar name and different values", best_match,Applicability::MaybeIncorrect);
794
+
};
795
+
}else{
796
+
db.span_suggestion(name_span,"there is a config with a similar name", best_match,Applicability::MaybeIncorrect);
797
+
}
798
+
799
+
if !possibilities.is_empty(){
800
+
let possibilities = possibilities.join("`, `");
801
+
db.help(format!("expected values for `{best_match}` are: `{possibilities}`"));
802
+
}
803
+
}else{
804
+
db.span_suggestion(name_span,"there is a config with a similar name", best_match,Applicability::MaybeIncorrect);
0 commit comments