Skip to content

Commit 4aab6ca

Browse files
Allow ?const Trait to pass validation
1 parent 064f439 commit 4aab6ca

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/librustc_ast_lowering/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21572157
mut itctx: ImplTraitContext<'_, 'hir>,
21582158
) -> hir::PolyTraitRef<'hir> {
21592159
if p.trait_ref.constness.is_some() {
2160-
self.diagnostic().span_err(p.span, "`?const` on trait bounds is not yet implemented");
2160+
// self.diagnostic().span_err(p.span, "`?const` on trait bounds is not yet implemented");
21612161
}
21622162

21632163
let bound_generic_params = self.lower_generic_params(

src/librustc_mir/transform/qualify_min_const_fn.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ pub fn is_min_const_fn(tcx: TyCtxt<'tcx>, def_id: DefId, body: &'a Body<'tcx>) -
3333
}
3434
match pred.skip_binder().self_ty().kind {
3535
ty::Param(ref p) => {
36+
// Allow `T: ?const Trait`
37+
if pred.skip_binder().trait_ref.maybe_const
38+
&& feature_allowed(tcx, def_id, sym::const_trait_bound_opt_out)
39+
{
40+
continue;
41+
}
42+
3643
let generics = tcx.generics_of(current);
3744
let def = generics.type_param(p, tcx);
3845
let span = tcx.def_span(def.def_id);

0 commit comments

Comments
 (0)