Skip to content

impl const wrongly accepts impl with non-const provided methods #79450

@jonas-schievink

Description

@jonas-schievink

This prints no error, but prov is not const-safe, so the impl const Tr should not be accepted:

#![feature(const_trait_impl)]

trait Tr {
    fn req(&self);
    
    fn prov(&self) {
        println!("lul");
        self.req();
    }
}

struct S;

impl const Tr for S {
    fn req(&self) {}
}

Metadata

Metadata

Assignees

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.F-const_trait_impl`#![feature(const_trait_impl)]`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