]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_ast_lowering/src/lib.rs
Actually infer args in visitors
[rust.git] / compiler / rustc_ast_lowering / src / lib.rs
index c7a477fedc6041172d37f91e18bdfbfa29784ba8..a19a2fbbe74f98a91c9e815d7bc0643c4f5f6486 100644 (file)
@@ -51,7 +51,7 @@
 use rustc_hir::def_id::{DefId, DefIdMap, DefPathHash, LocalDefId, CRATE_DEF_ID};
 use rustc_hir::definitions::{DefKey, DefPathData, Definitions};
 use rustc_hir::intravisit;
-use rustc_hir::{ConstArg, GenericArg, ParamName};
+use rustc_hir::{ConstArg, GenericArg, InferKind, ParamName};
 use rustc_index::vec::{Idx, IndexVec};
 use rustc_session::lint::builtin::{BARE_TRAIT_OBJECTS, MISSING_ABI};
 use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
@@ -1219,9 +1219,13 @@ fn lower_generic_arg(
             ast::GenericArg::Lifetime(lt) => GenericArg::Lifetime(self.lower_lifetime(&lt)),
             ast::GenericArg::Type(ty) => {
                 match ty.kind {
-                    TyKind::Infer => {
+                    TyKind::Infer if self.sess.features_untracked().generic_arg_infer => {
                         let hir_id = self.lower_node_id(ty.id);
-                        return GenericArg::Infer(hir::InferArg { hir_id, span: ty.span });
+                        return GenericArg::Infer(hir::InferArg {
+                            hir_id,
+                            span: ty.span,
+                            kind: InferKind::Type,
+                        });
                     }
                     // We parse const arguments as path types as we cannot distinguish them during
                     // parsing. We try to resolve that ambiguity by attempting resolution in both the