]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/transform/check_consts/validation.rs
Rollup merge of #73778 - nbdd0121:const_likely, r=oli-obk
[rust.git] / src / librustc_mir / transform / check_consts / validation.rs
index ca1f0aecd048a9d4adac6c72b59a2dc46bdafd41..f00fc96e5915a97e368d497ce735faa328194bc3 100644 (file)
@@ -531,9 +531,12 @@ fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location
                 if is_lang_panic_fn(self.tcx, def_id) {
                     self.check_op(ops::Panic);
                 } else if let Some(feature) = is_unstable_const_fn(self.tcx, def_id) {
-                    // Exempt unstable const fns inside of macros with
+                    // Exempt unstable const fns inside of macros or functions with
                     // `#[allow_internal_unstable]`.
-                    if !self.span.allows_unstable(feature) {
+                    use crate::transform::qualify_min_const_fn::lib_feature_allowed;
+                    if !self.span.allows_unstable(feature)
+                        && !lib_feature_allowed(self.tcx, self.def_id, feature)
+                    {
                         self.check_op(ops::FnCallUnstable(def_id, feature));
                     }
                 } else {