passes: check implied feature exists
Add a check confirming that features referenced in `implied_by` meta items actually exist. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
6246d66c6d
commit
e5872990d1
5 changed files with 60 additions and 30 deletions
|
@ -71,11 +71,11 @@ impl<'tcx> LibFeatureCollector<'tcx> {
|
|||
|
||||
fn collect_feature(&mut self, feature: Symbol, since: Option<Symbol>, span: Span) {
|
||||
let already_in_stable = self.lib_features.stable.contains_key(&feature);
|
||||
let already_in_unstable = self.lib_features.unstable.contains(&feature);
|
||||
let already_in_unstable = self.lib_features.unstable.contains_key(&feature);
|
||||
|
||||
match (since, already_in_stable, already_in_unstable) {
|
||||
(Some(since), _, false) => {
|
||||
if let Some(prev_since) = self.lib_features.stable.get(&feature) {
|
||||
if let Some((prev_since, _)) = self.lib_features.stable.get(&feature) {
|
||||
if *prev_since != since {
|
||||
self.span_feature_error(
|
||||
span,
|
||||
|
@ -89,10 +89,10 @@ impl<'tcx> LibFeatureCollector<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
self.lib_features.stable.insert(feature, since);
|
||||
self.lib_features.stable.insert(feature, (since, span));
|
||||
}
|
||||
(None, false, _) => {
|
||||
self.lib_features.unstable.insert(feature);
|
||||
self.lib_features.unstable.insert(feature, span);
|
||||
}
|
||||
(Some(_), _, true) | (None, true, _) => {
|
||||
self.span_feature_error(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue