1
Fork 0

Use a yes/no enum instead of a bool.

The bool's meaning wasn't obvious to me at some call sites.
This commit is contained in:
Oli Scherer 2022-05-02 15:36:48 +00:00
parent 5428983286
commit 0349f8bd79
2 changed files with 49 additions and 27 deletions

View file

@ -1179,7 +1179,7 @@ impl<'a> Resolver<'a> {
ConstantItemRibKind(trivial, _) => {
let features = self.session.features_untracked();
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
if !(trivial || features.generic_const_exprs) {
if !(trivial == HasGenericParams::Yes || features.generic_const_exprs) {
// 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.
@ -1267,7 +1267,7 @@ impl<'a> Resolver<'a> {
ConstantItemRibKind(trivial, _) => {
let features = self.session.features_untracked();
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
if !(trivial || features.generic_const_exprs) {
if !(trivial == HasGenericParams::Yes || features.generic_const_exprs) {
if let Some(span) = finalize {
self.report_error(
span,