Coerce const FnDefs to implement const Fn traits
This commit is contained in:
@@ -120,7 +120,9 @@ pub enum SelectionCandidate<'tcx> {
|
||||
|
||||
/// Implementation of a `Fn`-family trait by one of the anonymous
|
||||
/// types generated for a fn pointer type (e.g., `fn(int) -> int`)
|
||||
FnPointerCandidate,
|
||||
FnPointerCandidate {
|
||||
is_const: bool,
|
||||
},
|
||||
|
||||
/// Builtin implementation of `DiscriminantKind`.
|
||||
DiscriminantKindCandidate,
|
||||
|
||||
@@ -2750,7 +2750,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
Some(stability) if stability.level.is_unstable() => {
|
||||
// has a `rustc_const_unstable` attribute, check whether the user enabled the
|
||||
// corresponding feature gate.
|
||||
self.features().declared_lib_features.iter().any(|&(sym, _)| sym == stability.feature)
|
||||
self.features()
|
||||
.declared_lib_features
|
||||
.iter()
|
||||
.any(|&(sym, _)| sym == stability.feature)
|
||||
}
|
||||
// functions without const stability are either stable user written
|
||||
// const fn or the user is using feature gates and we thus don't
|
||||
|
||||
Reference in New Issue
Block a user