Allow features like const_try in d_m_b_i_c
This commit is contained in:
parent
e0c2ff7ccc
commit
b2005117bc
2 changed files with 57 additions and 0 deletions
|
@ -173,6 +173,12 @@ impl<'tcx> CheckConstVisitor<'tcx> {
|
|||
None => return true,
|
||||
};
|
||||
|
||||
// If the function belongs to a trait, then it must enable the const_trait_impl
|
||||
// feature to use that trait function (with a const default body).
|
||||
if tcx.trait_of_item(def_id).is_some() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If this crate is not using stability attributes, or this function is not claiming to be a
|
||||
// stable `const fn`, that is all that is required.
|
||||
if !tcx.features().staged_api || tcx.has_attr(def_id, sym::rustc_const_unstable) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue