mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Allow ~const bounds on inherent impls
This commit is contained in:
parent
146abdd119
commit
f749e05f6b
@ -1655,7 +1655,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
walk_list!(self, visit_ty, ty);
|
||||
}
|
||||
AssocItemKind::Fn(box FnKind(_, ref sig, ref generics, ref body))
|
||||
if self.in_const_trait_impl || ctxt == AssocCtxt::Trait =>
|
||||
if self.in_const_trait_impl
|
||||
|| ctxt == AssocCtxt::Trait
|
||||
|| matches!(sig.header.constness, Const::Yes(_)) =>
|
||||
{
|
||||
self.visit_vis(&item.vis);
|
||||
self.visit_ident(item.ident);
|
||||
|
@ -0,0 +1,21 @@
|
||||
// check-pass
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
|
||||
struct S;
|
||||
|
||||
trait A {}
|
||||
trait B {}
|
||||
|
||||
impl const A for S {}
|
||||
impl const B for S {}
|
||||
|
||||
impl S {
|
||||
const fn a<T: ~const A>() where T: ~const B {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const _: () = S::a::<S>();
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user