]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_passes/src/lib_features.rs
Auto merge of #106916 - lukas-code:overlapping-substs, r=estebank
[rust.git] / compiler / rustc_passes / src / lib_features.rs
index b5843c0ae488b1f17c58d81c1ae91758baf4e8e7..4c6a9b23fdf12a9ed33c99f71337ce81c64364d0 100644 (file)
@@ -137,6 +137,12 @@ fn visit_attribute(&mut self, attr: &'tcx Attribute) {
 }
 
 fn lib_features(tcx: TyCtxt<'_>, (): ()) -> LibFeatures {
+    // If `staged_api` is not enabled then we aren't allowed to define lib
+    // features; there is no point collecting them.
+    if !tcx.features().staged_api {
+        return new_lib_features();
+    }
+
     let mut collector = LibFeatureCollector::new(tcx);
     tcx.hir().walk_attributes(&mut collector);
     collector.lib_features