Skip to content

Unknown feature not reported in presence of another error #85107

Closed
@XAMPPRocky

Description

@XAMPPRocky

I tried this code:

#![feature(const_generics, const_evaluable_checked)]
#![allow(incomplete_features)]

pub trait Condition<const C: bool> {}

pub trait IsTrue {}

impl IsTrue for dyn Condition<true> {}

pub trait Metadata {
    const TAG: Tag;
}

pub trait ValidMetadata {}

impl<A: Metadata> ValidMetadata for A
    where dyn Condition<{ valid(A::TAG) }>: IsTrue
{}

pub const fn valid(TAG: Tag) -> bool {
    !TAG.const_eq(Tag::EOC)
}

#[derive(Debug, Clone, Copy, Eq, PartialEq, PartialOrd, Ord)]
pub struct Tag;

impl Tag {
    pub const EOC: Tag = Tag;

    pub(crate) const fn const_eq(self, rhs: Self) -> bool {
        true
    }
}

I expected to see this happen: An error that reports that const_evaluable_checked is an unknown feature, and see and error about constant expression depends on a generic parameter

error[E0635]: unknown feature `const_evaluable_checked`
 --> src/main.rs:1:28
  |
1 | #![feature(const_generics, const_evaluable_checked)]
  |                            ^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error; 2 warnings emitted

Instead, this happened: I only see the error about constant expression depends on a generic parameter, and nothing about the unknown feature

error: constant expression depends on a generic parameter
  --> src/main.rs:17:53
   |
17 |     where dyn Condition<{ valid_asntype(A::TAG) }>: IsTrue
   |                                                     ^^^^^^
   |
   = note: this may fail depending on what value the parameter takes

error: aborting due to previous error

error: could not compile `playground`

To learn more, run the command again with --verbose.

Meta

rustc --version --verbose:

1.54.0-nightly (2021-05-08 881c1ac408d93bb7adaa)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions