diff options
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/late/diagnostics.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/late/lifetimes.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 12 |
3 files changed, 15 insertions, 7 deletions
diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 68f59baffce..d253a9dda86 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1985,8 +1985,8 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { } } - /// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics` so - /// this function will emit an error if `min_const_generics` is enabled, the body identified by + /// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics`. + /// This function will emit an error if `const_generics` is not enabled, the body identified by /// `body_id` is an anonymous constant and `lifetime_ref` is non-static. crate fn maybe_emit_forbidden_non_static_lifetime_error( &self, @@ -2002,7 +2002,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { hir::LifetimeName::Implicit | hir::LifetimeName::Static | hir::LifetimeName::Underscore ); - if self.tcx.features().min_const_generics && is_anon_const && !is_allowed_lifetime { + if !self.tcx.lazy_normalization() && is_anon_const && !is_allowed_lifetime { feature_err( &self.tcx.sess.parse_sess, sym::const_generics, diff --git a/compiler/rustc_resolve/src/late/lifetimes.rs b/compiler/rustc_resolve/src/late/lifetimes.rs index 69f28045bb5..d5ba6f3b53b 100644 --- a/compiler/rustc_resolve/src/late/lifetimes.rs +++ b/compiler/rustc_resolve/src/late/lifetimes.rs @@ -1769,8 +1769,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let result = loop { match *scope { Scope::Body { id, s } => { - // Non-static lifetimes are prohibited in anonymous constants under - // `min_const_generics`. + // Non-static lifetimes are prohibited in anonymous constants without + // `const_generics`. self.maybe_emit_forbidden_non_static_lifetime_error(id, lifetime_ref); outermost_body = Some(id); diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index f764fbc3f8d..5c79cfa9c1d 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -2624,8 +2624,12 @@ impl<'a> Resolver<'a> { continue; } ConstantItemRibKind(trivial) => { + let features = self.session.features_untracked(); // HACK(min_const_generics): We currently only allow `N` or `{ N }`. - if !trivial && self.session.features_untracked().min_const_generics { + if !(trivial + || features.const_generics + || features.lazy_normalization_consts) + { // HACK(min_const_generics): If we encounter `Self` in an anonymous constant // we can't easily tell if it's generic at this stage, so we instead remember // this and then enforce the self type to be concrete later on. @@ -2713,8 +2717,12 @@ impl<'a> Resolver<'a> { continue; } ConstantItemRibKind(trivial) => { + let features = self.session.features_untracked(); // HACK(min_const_generics): We currently only allow `N` or `{ N }`. - if !trivial && self.session.features_untracked().min_const_generics { + if !(trivial + || features.const_generics + || features.lazy_normalization_consts) + { if record_used { self.report_error( span, |
