+ fn visit_param_bound(&mut self, bound: &'a GenericBound) {
+ if let GenericBound::Trait(poly, maybe_bound) = bound {
+ match poly.trait_ref.constness {
+ Some(Constness::NotConst) => {
+ if *maybe_bound == TraitBoundModifier::Maybe {
+ self.err_handler()
+ .span_err(bound.span(), "`?const` and `?` are mutually exclusive");
+ }
+
+ if let Some(ctx) = self.innermost_bound_context() {
+ let msg = format!("`?const` is not permitted in {}", ctx.description());
+ self.err_handler().span_err(bound.span(), &msg);
+ }
+ }
+
+ Some(Constness::Const) => bug!("Parser should reject bare `const` on bounds"),
+ None => {}
+ }
+ }
+
+ visit::walk_param_bound(self, bound)
+ }
+