result
}
+ /// All possible values for a constant parameter already exist
+ /// in the crate defining the trait, so they are always non-local[^1].
+ ///
+ /// Because there's no way to have an impl where the first local
+ /// generic argument is a constant, we also don't have to fail
+ /// the orphan check when encountering a parameter or a generic constant.
+ ///
+ /// This means that we can completely ignore constants during the orphan check.
+ ///
+ /// See `src/test/ui/coherence/const-generics-orphan-check-ok.rs` for examples.
+ ///
+ /// [^1]: This might not hold for function pointers or trait objects in the future.
+ /// As these should be quite rare as const arguments and especially rare as impl
+ /// parameters, allowing uncovered const parameters in impls seems more useful
+ /// than allowing `impl<T> Trait<local_fn_ptr, T> for i32` to compile.
fn visit_const(&mut self, _c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
- // All possible values for a constant parameter already exist
- // in the crate defining the trait, so they are always non-local.
- //
- // Because there's no way to have an impl where the first local
- // generic argument is a constant, we also don't have to fail
- // the orphan check when encountering a parameter or a generic constant.
- //
- // This means that we can completely ignore constants during the orphan check.
- //
- // See `src/test/ui/coherence/const-generics-orphan-check-ok.rs` for examples.
ControlFlow::CONTINUE
}
}