Skip to content

Commit 6bd69a1

Browse files
Add comment explaining MaybeConstMaybe lowering
1 parent 23ea42c commit 6bd69a1

File tree

1 file changed

+5
-0
lines changed
  • src/librustc_ast_lowering

1 file changed

+5
-0
lines changed

src/librustc_ast_lowering/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12541254
| GenericBound::Trait(ref ty, TraitBoundModifier::MaybeConst) => {
12551255
Some(this.lower_poly_trait_ref(ty, itctx.reborrow()))
12561256
}
1257+
// `?const ?Bound` will cause an error during AST validation
1258+
// anyways, so treat it like `?Bound` as compilation proceeds.
12571259
GenericBound::Trait(_, TraitBoundModifier::Maybe)
12581260
| GenericBound::Trait(_, TraitBoundModifier::MaybeConstMaybe) => {
12591261
None
@@ -2301,6 +2303,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23012303
match f {
23022304
TraitBoundModifier::None => hir::TraitBoundModifier::None,
23032305
TraitBoundModifier::MaybeConst => hir::TraitBoundModifier::MaybeConst,
2306+
2307+
// `MaybeConstMaybe` will cause an error during AST validation, but we need to pick a
2308+
// placeholder for compilation to proceed.
23042309
TraitBoundModifier::MaybeConstMaybe | TraitBoundModifier::Maybe => {
23052310
hir::TraitBoundModifier::Maybe
23062311
}

0 commit comments

Comments
 (0)