diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2024-09-08 01:49:25 -0400 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2024-09-12 13:56:01 -0400 |
| commit | e0bd01167e86d07c03e8ddd2bb0a25f689a2a7f5 (patch) | |
| tree | 199eece79e78d0a347adfdad064c8791f8e562ef /compiler/rustc_resolve/src/def_collector.rs | |
| parent | 8b75004bcad5f25ef31894986945ff75b53d7d94 (diff) | |
| download | rust-e0bd01167e86d07c03e8ddd2bb0a25f689a2a7f5.tar.gz rust-e0bd01167e86d07c03e8ddd2bb0a25f689a2a7f5.zip | |
Re-enable `ConstArgKind::Path` lowering by default
...and remove the `const_arg_path` feature gate as a result. It was only a stopgap measure to fix the regression that the new lowering introduced (which should now be fixed by this PR).
Diffstat (limited to 'compiler/rustc_resolve/src/def_collector.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/def_collector.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/compiler/rustc_resolve/src/def_collector.rs b/compiler/rustc_resolve/src/def_collector.rs index dc1aa0a42f8..e479c4b7511 100644 --- a/compiler/rustc_resolve/src/def_collector.rs +++ b/compiler/rustc_resolve/src/def_collector.rs @@ -347,22 +347,20 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> { } fn visit_anon_const(&mut self, constant: &'a AnonConst) { - if self.resolver.tcx.features().const_arg_path { - // HACK(min_generic_const_args): don't create defs for anon consts if we think they will - // later be turned into ConstArgKind::Path's. because this is before resolve is done, we - // may accidentally identify a construction of a unit struct as a param and not create a - // def. we'll then create a def later in ast lowering in this case. the parent of nested - // items will be messed up, but that's ok because there can't be any if we're just looking - // for bare idents. - - if matches!(constant.value.maybe_unwrap_block().kind, ExprKind::MacCall(..)) { - // See self.pending_anon_const_info for explanation - self.pending_anon_const_info = - Some(PendingAnonConstInfo { id: constant.id, span: constant.value.span }); - return visit::walk_anon_const(self, constant); - } else if constant.value.is_potential_trivial_const_arg() { - return visit::walk_anon_const(self, constant); - } + // HACK(min_generic_const_args): don't create defs for anon consts if we think they will + // later be turned into ConstArgKind::Path's. because this is before resolve is done, we + // may accidentally identify a construction of a unit struct as a param and not create a + // def. we'll then create a def later in ast lowering in this case. the parent of nested + // items will be messed up, but that's ok because there can't be any if we're just looking + // for bare idents. + + if matches!(constant.value.maybe_unwrap_block().kind, ExprKind::MacCall(..)) { + // See self.pending_anon_const_info for explanation + self.pending_anon_const_info = + Some(PendingAnonConstInfo { id: constant.id, span: constant.value.span }); + return visit::walk_anon_const(self, constant); + } else if constant.value.is_potential_trivial_const_arg() { + return visit::walk_anon_const(self, constant); } let def = self.create_def(constant.id, kw::Empty, DefKind::AnonConst, constant.value.span); |
